diff --git a/binaries/data/mods/official/gui/test/functions_sim_player.js b/binaries/data/mods/official/gui/test/functions_sim_player.js index 9515ff5e56..3c14b44080 100644 --- a/binaries/data/mods/official/gui/test/functions_sim_player.js +++ b/binaries/data/mods/official/gui/test/functions_sim_player.js @@ -14,6 +14,12 @@ function createResourceCounters() addResourceCounter(2, "stone"); addResourceCounter(3, "ore"); addResourceCounter(4, "population"); + + refreshResource("Food", 0); + refreshResource("Wood", 1); + refreshResource("Stone", 2); + refreshResource("Ore", 3); + refreshResource("Population", 4); } // ==================================================================== diff --git a/binaries/data/mods/official/scripts/entity_functions.js b/binaries/data/mods/official/scripts/entity_functions.js index 014959cbdb..ef609c53ac 100644 --- a/binaries/data/mods/official/scripts/entity_functions.js +++ b/binaries/data/mods/official/scripts/entity_functions.js @@ -352,18 +352,35 @@ function entityInitQuasi() id.civ_code = civ_code; } + /* + // Original unoptimized version of the above code (for reference) + if( this.traits.id && this.traits.id.civ ) + { + var id = this.traits.id; + id.civ_code = id.civ.toString().substring (0, 4); + id.civ_code = id.civ_code.toString().toLowerCase(); + + // Exception to make the Romans into rome. + if (id.civ_code == "roma") id.civ_code = "rome"; + // Exception to make the Hellenes into hele. + if (id.civ_code == "hell") id.civ_code = "hele"; + } + */ + stopXTimer(7); + /* + // Profiling code for comparing performance of pure JavaScript objects vs. CJSComplex. // This should be removed when we're done optimizing entity init. var ob = new Object(); ob.traits = new Object(); - for(var i=0; i<10; i++) { + for(var i=0; i<50; i++) { ob["temp"+i] = "blah"; } - for(var i=0; i<10; i++) { + for(var i=0; i<50; i++) { ob.traits["temp"+i] = "blah"; } @@ -386,6 +403,8 @@ function entityInitQuasi() } stopXTimer(9); + + */ } // ====================================================================