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: ProcessMatches
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
NelsonAndBronte is offline NelsonAndBronte
Settler

Nov 2003
time: 05:31
  Old Post 11-11-2003 00:38
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
DEBUG: ProcessMatches Enter the AD-FREE zone

One request (From Peter Triggs) was around exposing the number of passes the AI uses to compare its armies against goals. This number is at present hard coded in Scheduler.cpp :

code:
sint32 Scheduler::s_max_match_list_cycles = 6;


I changed this line to
code:
sint32 Scheduler::s_max_match_list_cycles = g_theConstDB->GetMaxMatchListCycles();


And added to Constdb.h


code:
//added DWT sint32 m_max_match_list_cycles; //added DWT sint32 GetMaxMatchListCycles() const { return m_max_match_list_cycles; }


Finally added to Constdb.cpp a new token TOKEN_MAX_MATCH_LIST_CYCLES, which corresponds to a const.txt name of MAX_MATCH_LIST_CYCLES.
If I've done this all correctly, all you need to do is to add a new entry MAX_MATCH_LIST_CYCLES to Constdb.txt and you can set the number of passes to whatever you want.

Hopefully I'll will receive the game soon to try this out myself!

Attachment: maxpasses.zip
This has been downloaded 5 time(s).

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:31
  Old Post 13-11-2003 14:58
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Full PM-box? Change here!

Thanks, NelsonandBronte,

Now all I've got to get is MS VC++6 so that I can try this out.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 15-11-2003 22:39 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton

I had to remove a comma in ConstDB.cpp on line 916 and had to add an #include "ConstDB.h" to Scheduler.cpp to make the code to compile.

-Martin

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 15-11-2003 23:54 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton or Terrorists Win

Another problem I found is when I try run the game with this code is that the game crashs on startup.

So I changed this line in Scheduler.cpp:

code:
// added DWT sint32 Scheduler::s_max_match_list_cycles = 10;//= g_theConstDB->GetMaxMatchListCycles();


And it does work but you can't set the max_match_list_cycles in Const.txt anymore. OK you can set it but without any effect.

Obviously it is used before the database is loaded.

-Martin

Fromafar is offline Fromafar
Prince

May 2003
time: 06:31
  Old Post 18-11-2003 03:30
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton or Terrorists Win

Yeah, the static variable will be initialised right at the start of the program, before g_theConstDB will have been created.

Fortunately, there is an easy solution. Because s_max_match_list_cycles is only referenced once, you may remove/bypass it completely, and replace the occurrence in CtpAi.cpp with a direct call to g_theConstDB->GetMaxMatchListCycles().

At the time of the call, the database(s) will have been loaded.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 21-11-2003 23:54 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton or Terrorists Win

Actual I don't like this solution it would be better if it would be a static varable but then I can't initialize outside of a function or a constructor. So I came to this hack:

code:
if (g_theGameSettings->GetDifficulty() == (LEVELS_OF_DIFFICULTY - 1)) diff_cycles = 2; //Modified by Martin Gühmann so that this can be exposed to const.txt //if ( cycle < Scheduler::s_max_match_list_cycles + diff_cycles) if ( cycle < g_theConstDB->GetMaxMatchListCycles() + diff_cycles)


You can see that the DifficuiltDB is accessed everytime the code runs, so it shouldn't be such a big problem if the ConstDB is checked everytime. You can see on impossible the AI gets two extra cycles, well I would rather replace the diff cycles with the AI intelegence cycles from the DiffDB.

-Martin

Fromafar is offline Fromafar
Prince

May 2003
time: 06:31
  Old Post 22-11-2003 23:44
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Avatar Enlargement: We've got the solution

Hi Martin,

Did you include the wrong version of constDB.cpp in the altered source code update? After downloading, I got the "extra comma" problem that you reported some posts ago.

Another problem is that this modification requires const.txt to be updated. Unfortunately, this does not only apply to the regular game (included in the update), but also to the scenarios.

I think we have to add some mechanism to make the variables optional in const.txt, and use the original hardcoded value (6) when missing.

Last edited by Fromafar on 22-11-2003 at 23:53

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 23-11-2003 00:03 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by Fromafar
Hi Martin,

Did you include the wrong version of constDB.cpp in the altered source code update? After downloading, I got the "extra comma" problem that you reported some posts ago.


This is indeed right.

quote:
Originally posted by Fromafar
Another problem is that this modification requires const.txt to be updated. Unfortunately, this does not only apply to the regular game (included in the update), but also to the scenarios.

I think we have to add some mechanism to make the variables optional in const.txt, and use the original hardcoded value (6) when missing.


The problem is that there will be probably a lot of files that needs to be updated in the final version. For the standart scenarios we can provide the update with the patch itsself but for everything else it is up to the creators of the scenario, maybe we can support the most popular scenarios as well. For instance there is a slic file in the Magnificant Samurai scenario that contains a bug, so we have to do some work on them anyway. For other stuff for instance readding the rerouting trade button in the trade manager we need additional flag Freight in the tileimp.txt to give roads a Freight bonus. Also some other stuff that makes the game better should also be included the scenarios, so there will be stuff that works on the new patch and other stuff that don't work on the patch.

-Martin

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:31
  Old Post 23-11-2003 00:08 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Avatar Enlargement: We've got the solution

That doesn't stop us making the alterations optional - that should be possible, and in most cases it should be fairly easy.

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:31.
Apolyton Time is 00:31.
    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.0377 seconds (87.36% PHP - 12.64% 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