Originally posted by BureauBert
I just wonder how the latter (g.last_player) would work for the Diplomod script which needs to set up these huge arrays for storing e.g. the "has contact" information. For this setup a definite number of (max-) players is needed, as far as my understanding goes . I suspect that using g.last_player for this purpose would screw things up as soon as an additional (splinter-) civ appears. At least I think this is what already caused a lot of problems with the original version of Diplomod, and caused me to modify the setup of the array:
I changed it from
to
... where MOD_MAXPLAYERS comes from the known function using preference("MaxPlayers"). For being on the safe side I could have used e.g. "28" instead of "MOD_MAXPLAYERS" as well, but I have been afraid that this would blow up the array enormously and need a lot of memory. Using g.max_player for this purpose would probably have this effect, too (but I really don't know anything about memory allocation). In this case I imagine a reliable variable containing the original preference value (= the maximum of players in the current game, and keeping this value even if the userprofile settings are changed in the meantime) could be useful. But certainly Dale or someone else who worked more intensely with Diplomod could tell if this actually is the case.
I guess the difference between the "exe's MaxPlayers" and the "current game's MaxPlayer's" wouldn't hurt so much regarding the size of other arrays that need to be set up at gamestart and indexed by players - so it might be preferable to use g.max_player for these.
I just wonder how the latter (g.last_player) would work for the Diplomod script which needs to set up these huge arrays for storing e.g. the "has contact" information. For this setup a definite number of (max-) players is needed, as far as my understanding goes . I suspect that using g.last_player for this purpose would screw things up as soon as an additional (splinter-) civ appears. At least I think this is what already caused a lot of problems with the original version of Diplomod, and caused me to modify the setup of the array:
I changed it from
Code:
DIP_hascontact[(DIP_NumOfPlayers * DIP_NumOfPlayers) + DIP_NumOfPlayers]
Code:
DIP_hascontact[(MOD_MAXPLAYERS * MOD_MAXPLAYERS) + MOD_MAXPLAYERS]
I guess the difference between the "exe's MaxPlayers" and the "current game's MaxPlayer's" wouldn't hurt so much regarding the size of other arrays that need to be set up at gamestart and indexed by players - so it might be preferable to use g.max_player for these.
I tried to use a constant for that array something like 32 or 40 I don't know what it was exactly. That was the reason for the constant of g.max_players, to allow slic writers not to hard encode this value into the scripts, so that noone needs to change their scripts if we increase the maximum. However back to my original point, with the constant we had some problems, it was odd half of the time we were able to start a new game, but the other half of the time the game crashed.
-Martin
Comment