Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Call To Power II > CtP2-Source Code Project > DEBUG: Prevented cities from revolting twice in a row
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
CivGroups
CTP2 Source Code Project (59): Not a Member - Join

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
kaan is offline kaan
Prince
Aarhus
Mar 2001
time: 05:37
  Old Post 02-07-2004 02:45
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
DEBUG: Prevented cities from revolting twice in a row Increase the size of your Attachments

* 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 is offline child of Thor
Emperor
UK
Jan 2002
time: 05:37
  Old Post 02-07-2004 15:15
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Increase Your PM Length

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 is offline Fromafar
Prince

May 2003
time: 06:37
  Old Post 02-07-2004 22:22
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Re: DEBUG: Prevented cities from revolting twice in a row Support Apolyton buy from Amazon

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 is offline kaan
Prince
Aarhus
Mar 2001
time: 05:37
  Old Post 03-07-2004 01:56
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

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 is offline Fromafar
Prince

May 2003
time: 06:37
  Old Post 04-07-2004 02:01
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Full PM-box? Change here!

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 is offline kaan
Prince
Aarhus
Mar 2001
time: 05:37
  Old Post 04-07-2004 22:57
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

I think that is a very good idea Fromafar.
That is the idea that we have the possibility to decide how many turns instead of just a BOOL.
So i implemented it and exposed the value in const.txt and this is the result.

As before i still dont have a compiler at hand so please test it for me

affected files :

.\ctp2_code\gs\database\ConstDB.cpp
.\ctp2_code\gs\database\ConstDB.h
.\ctp2_code\gs\gameobj\CityData.cpp
.\ctp2_code\gs\gameobj\CityData.h
.\ctp2_code\gs\gameobj\Player.cpp
.\ctp2_data\default\gamedata\Const.txt
. \Scenarios\AlexanderTheGreat\scen0000\default\game
data\Const.txt

All files are based on the files from 2004.06.05.CTP2.All.zip

Attachment: 20040604-ctp2bug12.zip
This has been downloaded 1 time(s).

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:37
Post  Old Post 04-07-2004 23:52 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

quote:
Originally posted by kaan
As before i still dont have a compiler at hand so please test it for me


And so far you wasn't able to compile it on VC++ 7. Or you don't even have this on hand.

-Martin

kaan is offline kaan
Prince
Aarhus
Mar 2001
time: 05:37
  Old Post 05-07-2004 00:54
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

quote:
Originally posted by Martin Gühmann


And so far you wasn't able to compile it on VC++ 7. Or you don't even have this on hand.

-Martin


i just started to assemble the requred files last night
one hell of a download those directX files.
I will try to compile in .NET sometime later tonight.

kaan is offline kaan
Prince
Aarhus
Mar 2001
time: 05:37
  Old Post 08-07-2004 09:56
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

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 is offline Fromafar
Prince

May 2003
time: 06:37
  Old Post 08-07-2004 16:30
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Increase Your PM Length

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 is offline kaan
Prince
Aarhus
Mar 2001
time: 05:37
  Old Post 08-07-2004 16:48
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

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.

kaan is offline kaan
Prince
Aarhus
Mar 2001
time: 05:37
  Old Post 10-07-2004 07:25
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Remove this text

I have discovered why there is a folder called database and a folder called newdb

ConstDB.cpp rely on Token.cpp to do the parsing of const.txt
Token.cpp seems to originate from ctp1 and provides no way to peek ahead when parsing (it is a very basic parser).

The best way to get optional values in const.txt would probably be to convert ConstDB.cpp to the newdb format with lexers and all that.
As that would reach far beyond the scope of this bugfix i will leave it here and maybe look at it again in the future.


I did move the new variables to the end of const.txt but no other changes was made.

Attachment: 20040710.bug12.zip
This has been downloaded 1 time(s).

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:37.
Apolyton Time is 00:37.
    top of page
Rate This Thread:
Forum Jump:
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
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0454 seconds (87.54% PHP - 12.46% MySQL) with 36 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net