MatzeHH said:
That is what I was thinking before I tried to use a mod in a scenario.
In scenarios, the human player is not always player 0.
Matze
Same with Multiplayer. Especially in a simultaneous game.
Simultaneous games make all the players active at the start. When a player becomes "active", in a simultaneous game their turn (doTurn())is run automatically (unlike a SP game where the turn is run at the end of the turn, when they become inactive). In order to make sure that player 0 won't always have their turn run first, thus whenever there's a tie in who built a wonder/researched a tech first, player 0 won't always get the win, the players start their turn in a random order every turn.
Of course, you don't have to worry about doing something at the "start" of a turn anyway in simultaneous games, since I believe that all changes happen at the beginning of a player's turn in simultaneous mode anyway.
While theres probably no real problem in doing it this way, just realize that if at the end of these statements you have some function "doBeginTurn()", that the actual order that the players turns are being run for a simultaneous game are going to be different than the order of the doBeginTurn() runs. In many cases, this won't matter, but if somehow it's critical that the turns are run in the correct order, you'll have problems in a simultaneous game.
If you do have this problem, I would recommend going into the CvPlayer::setTurnActive() function, go into the code block where it says:
Code:
[b]// Insert your begin-turn code here[/b]
if (GC.getGameINLINE().isMPOption(MPOPTION_SIMULTANEOUS_TURNS)) {
doTurn();
}
doTurnUnits();
and put a function call (or python function call) to do what you want. This would be where a turn actually starts.