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: Bugs in buildingutil.cpp ?
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 05-11-2003 01:55
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Bugs in buildingutil.cpp ? Support Apolyton, buy Galactic Civilizations: Deluxe Edition

I was idly looking through the code and came upon the following lines in buildingutil.cpp. These three functions appear to be intended to return the maximum offense bonus for buildings present in a city. However, the body of the code seems to look for the wrong building characteristics for both water and ar improvements. AFAICS this implies that improvements such as costal forts or flak guns do not function as expected. The correction appears obvious. Thoughts?


code:
double buildingutil_GetOffenseBonusLand(const uint64 built_improvements) { double best = 0; FOREACH_BUILT(GetOffenseBonusLand) { double cur; if(rec->GetOffenseBonusLand(cur) && cur > best) best = cur; } return best; } double buildingutil_GetOffenseBonusWater(const uint64 built_improvements) { double best = 0; FOREACH_BUILT(GetOffenseBonusWater) { double cur; if(rec->GetOffenseBonusLand(cur) && cur > best) best = cur; } return best; } double buildingutil_GetOffenseBonusAir(const uint64 built_improvements) { double best = 0; FOREACH_BUILT(GetOffenseBonusWater) { double cur; if(rec->GetOffenseBonusLand(cur) && cur > best) best = cur; } return best; })

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

Yes it looks like some copy and paste work, so all you have to do is to find the right functions make shure all of them are implemented properly and plug them in.

-Martin

NelsonAndBronte is offline NelsonAndBronte
Settler

Nov 2003
time: 05:31
  Old Post 05-11-2003 02:51
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

I replaced the code with the proper look up values. The code to actually return the values entered in buildings.txt looks correct. I havent tried to compile CTP2, yet. Here is the changed code:

code:
double buildingutil_GetOffenseBonusWater(const uint64 built_improvements) { // Iterate through all the buildings in the city // and return the value of the MAXMIMUM bonus only, // This bonus is not additive double best = 0; FOREACH_BUILT(GetOffenseBonusWater) { double cur; if(rec->GetOffenseBonusWater(cur) && cur > best) best = cur; // original code below checked for the wrong bonus // if(rec->GetOffenseBonusLand(cur) && cur > best) // best = cur; } return best; } double buildingutil_GetOffenseBonusAir(const uint64 built_improvements) { // Iterate through all the buildings in the city // and return the value of the MAXMIMUM bonus only, // This bonus is not additive double best = 0; FOREACH_BUILT(GetOffenseBonusAir) { double cur; if(rec->GetOffenseBonusAir(cur) && cur > best) best = cur; } return best; // original code below checked for the wrong bonus // FOREACH_BUILT(GetOffenseBonusWater) { // double cur; // if(rec->GetOffenseBonusLand(cur) && cur > best) // best = cur; // } // return best; }

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:31
  Old Post 05-11-2003 02:54 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

nice one

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 05-11-2003 03:11 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Lose 30 kilos (of popups)

quote:
Originally posted by The Big Mc
nice one


Yup nice one I just would reduce the commented lines like this:

code:
double buildingutil_GetOffenseBonusAir(const uint64 built_improvements) { // Iterate through all the buildings in the city // and return the value of the MAXMIMUM bonus only, // This bonus is not additive double best = 0; FOREACH_BUILT(GetOffenseBonusWater) { double cur; if(rec->GetOffenseBonusAir(cur) && cur > best) // Original Code: // if(rec->GetOffenseBonusLand(cur) && cur > best) best = cur; } return best; }


And finally you should add your name to the fix so that we know in the case of doubt who to bla.. äh I mean who to give the credits for the fix.

-Martin

Maquiladora is offline Maquiladora
Emperor

Jun 2001
time: 05:31
  Old Post 05-11-2003 04:31 Visit Maquiladora's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Inflate your Upload Space

Now youre finding AND fixing bugs i never knew existed, this is all going strangely quickly

  < 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.0404 seconds (87.76% PHP - 12.24% 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