Jo, ich guck mal.
Hab jetzt nochmal probiert, alles in eine Klasse zu packen. Das steht am Anfang:
PHP-Code:
class Trade:
def __init__(self):
self.lBonusNoTrade = [ gc.getInfoTypeForString("BONUS_CELTIC"), gc.getInfoTypeForString("BONUS_ROMAN"), gc.getInfoTypeForString("BONUS_NUMID"),
gc.getInfoTypeForString("BONUS_NUBIA"), gc.getInfoTypeForString("BONUS_GREEK"), gc.getInfoTypeForString("BONUS_PERSIA"),
gc.getInfoTypeForString("BONUS_GERMAN"), gc.getInfoTypeForString("BONUS_INDIA"), gc.getInfoTypeForString("BONUS_BALEAREN"),
gc.getInfoTypeForString("BONUS_TEUTONEN"), gc.getInfoTypeForString("BONUS_BAKTRIEN"), gc.getInfoTypeForString("BONUS_KRETA"),
gc.getInfoTypeForString("BONUS_KILIKIEN"), gc.getInfoTypeForString("BONUS_MARS"), gc.getInfoTypeForString("BONUS_THRAKIEN")]
self.lCorn = [
gc.getInfoTypeForString("BONUS_WHEAT"),
gc.getInfoTypeForString("BONUS_GERSTE"),
gc.getInfoTypeForString("BONUS_HAFER"),
gc.getInfoTypeForString("BONUS_ROGGEN"),
gc.getInfoTypeForString("BONUS_HIRSE"),
gc.getInfoTypeForString("BONUS_RICE")
]
self.lCattle = [
gc.getInfoTypeForString("BONUS_COW"),
gc.getInfoTypeForString("BONUS_PIG"),
gc.getInfoTypeForString("BONUS_SHEEP")
]
self.lSpice = [
gc.getInfoTypeForString("BONUS_OLIVES"),
gc.getInfoTypeForString("BONUS_DATTELN")
]
self.lCamel = [ gc.getInfoTypeForString("BONUS_CAMEL") ]
Aber wenn ich die Listen ingame ausgeben, steht immer nur die entsprechende Anzahl -1 drinnen
Vielleicht ist zu dem Zeitpunkt, zu dem initialisiert wird, das XML noch nicht geladen und getInfoTypeForString() funktioniert noch nicht? Aber was tu ich dagegen?