Moved the Woodes Rogers missing items discussion here, since it is related to the game initialization.
I moved the initItems code OUT of the InitGame function and put it here into NewGame_continue instead:
As @Levis hinted at, this has indeed resolved those compile.log messages by initializing the items BEFORE the characters.
This may also improve performance a bit, as InitGame was called when you start up the engine and again when you Start New Game.
This meant that the items were initialized at least twice. This changes it so it happens ONLY when you Start New Game.
Hopefully that will not cause any problems.
That being said, this also brings us to @Levis' original point that there is more intialization going on than necessary.
Note that NewGame_continue contains the following:
However, Reinit can also do item and ship initialization. I thought it also did characters, but that seems to not be the case now.
Since it is called with "true", though, that skips a lot of parts of the initialization process.
So it seems that the above three functions truly are executed only once when you start a new game.
I moved the initItems code OUT of the InitGame function and put it here into NewGame_continue instead:
Code:
// PB -->
trace("Gauging: perks");
NationsInit();
if(LoadSegment("items\initItems.c"))
{
InitItems();
Trace("Gauging: items");
UnloadSegment("items\initItems.c");
}
ReloadProgressUpdate();
CharactersInit();
trace("Gauging: characters");
// <-- PB
This may also improve performance a bit, as InitGame was called when you start up the engine and again when you Start New Game.
This meant that the items were initialized at least twice. This changes it so it happens ONLY when you Start New Game.
Hopefully that will not cause any problems.
That being said, this also brings us to @Levis' original point that there is more intialization going on than necessary.
Note that NewGame_continue contains the following:
Code:
// PB -->
trace("Gauging: perks");
NationsInit();
if(LoadSegment("items\initItems.c"))
{
InitItems(); // <-- ITEMS INITIALIZED
Trace("Gauging: items");
UnloadSegment("items\initItems.c");
}
ReloadProgressUpdate();
CharactersInit(); // <-- CHARACTERS INITIALIZED
trace("Gauging: characters");
// <-- PB
// KK -->
ShipsInit(); // <-- SHIPS INITIALIZED
trace("Gauging: ships");
// <-- KK
Trace("Gauging: ng initgame start");
InitGame();
[...]
// do reinit up here 05-04-24
Trace("Gauging: start reinit");
Reinit(true, false); // 05-04-06 now do while still loading so we get nice reloadprogress update stuff...
Since it is called with "true", though, that skips a lot of parts of the initialization process.
So it seems that the above three functions truly are executed only once when you start a new game.