 |
|
kaan
|
|
Aarhus
Mar 2001 time: 05:37
|
|
* Prevented cities from revolting twice in a row (so if you have the wonder that gives you revolting cities, you'll at least have a chance to hold onto them)
Any ideas on this one?
i figure that we need to set a flag if the city revolts, and then check it when a city is about to revolt.
any ideas to how, where and when?
|
|
|  |
 |
|
child of Thor
|
|
Not sure exactly, but all the bits should be inplace to do something like this(hapiness level/trigger revolt etc - just to count the revolts).
|
|
|  |
 |
|
Fromafar
|
|
quote: Originally posted by kaan
i figure that we need to set a flag if the city revolts, and then check it when a city is about to revolt.
any ideas to how, where and when? |
The idea looks fine to me. Probable locations are CityData::Revolt to set the flag, and CityData::ShouldRevolt to return FALSE and clear it when the flag has been set.
The main problem is finding out where the flag is saved. We would need to have a save file from a patch-1.1 game at just the right spot to verify this. For SP, the best test set-up would be to have player 1 = human, player 2 = owner of the Egalitarian Act, and player 3 = original owner of the revolting city. The save file (at player 1's turn) should have the flag set for the revolting city, which is owned by player 2 by then. Maybe this is what the m_unknown_from_patch member variable is used for?
|
|
|  |
 |
|
kaan
|
|
Aarhus
Mar 2001 time: 05:37
|
|
I made changes to 3 files.
CityData.cpp
CityData.h
Player.cpp
First of all I renamed m_unknown_from_patch to m_last_turn_revolt in anticipation that this really is the true meaning for that variable.
I added a check in CityData::ShouldRevolt to return false if there were a revolt last turn.
I added setting m_last_turn_revolt to 1 at the end of CityData::Revolt.
Last but not least i opted to add a neutralization function to CityData and call it from Player::AttemptRevolt if the city didnt revolt.
I choose this method because CityData::ShouldRevolt might be called more than once or from other places, if not now then it might in the future (think slic).
Now I only have a slight problem, i dont have VS6 installed
Is there anyone who want to compile and test this peice of code for me?
Thanks in advance
klaus
Attachment: bug12.zip
This has been downloaded 1 time(s).
Last edited by kaan on 03-07-2004 at 15:09
|
|
|  |
 |
|
Fromafar
|
|
You still have to put a declaration of the noRevolt member function in CityData.h to make it compile. After that, it seems to do the job.
Separating the testing and the clearing of the flag is a good idea.
The role and naming of the variables/constants/functions may require some more thought. If it is going to be a simple flag, I would prefer m_last_turn_revolt to be a bool (using true/false), and do the conversion to uint8 only when saving/restoring. Alternatively, it could be designed to be the number of guaranteed revolt free turns left, decremented each turn until it reaches 0. But then, I would prefer the "noRevolt" function to be named differently. And anyway, have it start with a capital first letter because that is the de facto convention for function names.
|
|
|  |
 |
|
kaan
|
|
Aarhus
Mar 2001 time: 05:37
|
|
It seems to be in fine working order, i have polished a bit on the comments and im submitting it to "altered source files" now.
|
|
|  |
 |
|
Fromafar
|
|
Confirming the working part. I do have a request, though. Could you change it so the new value goes to the end of the list, and use a default value of 1 when the value is not found in const.txt? This could save us a lot of work.
I know this is only a partial fix, as you would still get the missing keword (sic) pop-up. However, you will at least be able to continue the game without having to find and update the const.txt files for all the existing mods and scenarios.
Eventually, we have to change the input file parser to make updating easier. But that would take more time.
|
|
|  |
 |
|
kaan
|
|
Aarhus
Mar 2001 time: 05:37
|
|
quote: Originally posted by Fromafar
Confirming the working part. I do have a request, though. Could you change it so the new value goes to the end of the list, and use a default value of 1 when the value is not found in const.txt? This could save us a lot of work.
I know this is only a partial fix, as you would still get the missing keword (sic) pop-up. However, you will at least be able to continue the game without having to find and update the const.txt files for all the existing mods and scenarios.
Eventually, we have to change the input file parser to make updating easier. But that would take more time. |
ill look into it, if possible i will do the same to the previus modification of constDB.
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:37. Apolyton Time is 00:37. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|