From cbdc4e96869621cd1a6bba0d8702ef5a2eead78e Mon Sep 17 00:00:00 2001 From: Acumen Date: Mon, 27 Feb 2006 04:58:04 +0000 Subject: [PATCH] Quick fix in the init(), where non-foundations seemed to produce errors (since their building property would be undefined). Just added an extra if check. This was SVN commit r3570. --- .../mods/official/entities/template_entity_script.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/binaries/data/mods/official/entities/template_entity_script.js b/binaries/data/mods/official/entities/template_entity_script.js index e75d606e80..e33e439827 100644 --- a/binaries/data/mods/official/entities/template_entity_script.js +++ b/binaries/data/mods/official/entities/template_entity_script.js @@ -31,7 +31,7 @@ function entityInit() this.addCreateQueue = entityAddCreateQueue; // If this is a foundation, initialize traits from the building we're converting into - if( this.building != "" ) + if( this.building && this.building != "" ) { var building = getEntityTemplate( this.building ); this.traits.id.generic = building.traits.id.generic; @@ -47,13 +47,13 @@ function entityInit() // Generate civ code (1st four characters of civ name, in lower case eg "Carthaginians" => "cart"). if (this.traits.id && this.traits.id.civ) { - this.traits.id.civ_code = this.traits.id.civ.toString().substring (0, 4) - this.traits.id.civ_code = this.traits.id.civ_code.toString().toLowerCase() + this.traits.id.civ_code = this.traits.id.civ.toString().substring (0, 4); + this.traits.id.civ_code = this.traits.id.civ_code.toString().toLowerCase(); // Exception to make the Romans into rome. - if (this.traits.id.civ_code == "roma") this.traits.id.civ_code = "rome" + if (this.traits.id.civ_code == "roma") this.traits.id.civ_code = "rome"; // Exception to make the Hellenes into hele. - if (this.traits.id.civ_code == "hell") this.traits.id.civ_code = "hele" + if (this.traits.id.civ_code == "hell") this.traits.id.civ_code = "hele"; } // If entity can contain garrisoned units, empty it.