Gedrin,
I (finally) had time to study them yesterday and I found a few odd things in them, you may have put them there deliberately but you may not have, so I thought I'd mention them.
1) Back when I still had CtPI installed on my system I tried your triggers for a while and all the time got messages about having received advances that I already possessed. Example: (didn't actually occur, but it could have) in turn 100 I invented Monarchy and in turn 120 I got the message that I had gained the advance of Monarchy due to the dissemination code (don't remember the exact text anymore). This can easily be prevented by performing one extra test (to see if the player already has the advance) before sending the message to human players, like this:
2) You make the same mistake (presuming it is a mistake) as I did for the Garrison code, you treat the discovery.type and discovery.trade as two seperate cases, but in fact discovery.type covers the trading of advances as well, so you during trade you add two instead of one to the variable that keep track of the number of times a new advance is gained. (Actually, you *might* even be adding four to the variable since there are two parties involved in trade so it's possible (though I'm not certain of it) that the trigger is activated twice).
3) For number of players you take the number of players that was in the game at the start, not the number of players currently in the game. Did you do make that choice deliberately or did you not see a better way to do it? If the latter is the case, I might have a solution for you. I didn't actually test it (don't have CtP installed at the moment), but something similar seemed to work when I working on flat-map support. It would look something like this:
[code]numberOfPlayers = 0;
if (player.0 == 0) {numberOfPlayers = numberOfPlayers + 1;}
if (player.1 == 1) {numberOfPlayers = numberOfPlayers + 1;}
if (player.2 == 2) {numberOfPlayers = numberOfPlayers + 1;}
if (player.3 == 3) {numberOfPlayers = numberOfPlayers + 1;}
if (player.4 == 4) {numberOfPlayers = numberOfPlayers + 1;}
if (player.5 == 5) {numberOfPlayers = numberOfPlayers + 1;}
if (player.6 == 6) {numberOfPlayers = numberOfPlayers + 1;}
...(etc until: )
if (player.32 == 32) {numberOfPlayers = numberOfPlayers + 1;}
IIRC every player that doesn't exist has the value 0, so only the players that exist are counted.
Like I said, I haven't actually tested any of this so I may well be wrong about everything or my 'solutions' might not work at all, but if you ever want to improve your code, you could have a look at this.
Further I'd like to say that I really like all the cool SLIC work you're doing and I'm looking forward the your next thing![](http://apolyton.net/forums/smile.gif)
[This message has been edited by Locutus (edited September 29, 2000).]
I (finally) had time to study them yesterday and I found a few odd things in them, you may have put them there deliberately but you may not have, so I thought I'd mention them.
1) Back when I still had CtPI installed on my system I tried your triggers for a while and all the time got messages about having received advances that I already possessed. Example: (didn't actually occur, but it could have) in turn 100 I invented Monarchy and in turn 120 I got the message that I had gained the advance of Monarchy due to the dissemination code (don't remember the exact text anymore). This can easily be prevented by performing one extra test (to see if the player already has the advance) before sending the message to human players, like this:
Code:
if ((advanceGranted == 1) && (IsHumanPlayer(playerIndex) == 1) && !HasAdvance(playerIndex, discovery.type)) { Message(playerIndex, '117DisseminationDiscovery'); }
3) For number of players you take the number of players that was in the game at the start, not the number of players currently in the game. Did you do make that choice deliberately or did you not see a better way to do it? If the latter is the case, I might have a solution for you. I didn't actually test it (don't have CtP installed at the moment), but something similar seemed to work when I working on flat-map support. It would look something like this:
[code]numberOfPlayers = 0;
if (player.0 == 0) {numberOfPlayers = numberOfPlayers + 1;}
if (player.1 == 1) {numberOfPlayers = numberOfPlayers + 1;}
if (player.2 == 2) {numberOfPlayers = numberOfPlayers + 1;}
if (player.3 == 3) {numberOfPlayers = numberOfPlayers + 1;}
if (player.4 == 4) {numberOfPlayers = numberOfPlayers + 1;}
if (player.5 == 5) {numberOfPlayers = numberOfPlayers + 1;}
if (player.6 == 6) {numberOfPlayers = numberOfPlayers + 1;}
...(etc until: )
if (player.32 == 32) {numberOfPlayers = numberOfPlayers + 1;}
IIRC every player that doesn't exist has the value 0, so only the players that exist are counted.
Like I said, I haven't actually tested any of this so I may well be wrong about everything or my 'solutions' might not work at all, but if you ever want to improve your code, you could have a look at this.
Further I'd like to say that I really like all the cool SLIC work you're doing and I'm looking forward the your next thing
![](http://apolyton.net/forums/smile.gif)
[This message has been edited by Locutus (edited September 29, 2000).]
Comment