blob: 43570b5156890a7a2e69d5b835d656aa83668c7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
const airport_name_list = 'res://resources/airports.txt'
var airport_names = []
const airport_difficulties = ["easy", "medium", "hard"]
func load_airport_names():
var f = File.new()
f.open(airport_name_list, File.READ)
var index = 1
while not f.eof_reached(): # iterate through all lines until the end of file is reached
airport_names.push_back(f.get_line())
f.close()
func get_random_airport_name(exceptions=[]):
var name_index:int = randi() % len(airport_names)
while airport_names[name_index] in exceptions:
name_index = randi() % len(airport_names)
return airport_names[name_index]
|