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: The only one ConstructionTile used bug
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
Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 04-11-2003 04:42 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
The only one ConstructionTile used bug Support Apolyton buy from Amazon

If you ever played around with the ContructionTiles flags in tileimp.txt then you noticed that unlike in CTP1 only one of the three ContructionTiles is used instead of three. While I was trying to fix it I found another bug, the PercentComplete function in TerrImproveData.cpp:

code:
sint32 TerrainImprovementData::PercentComplete() const { sint32 totalTurns, turnsDone; MapPoint p = m_point; //Function replaced by Martin Gühmann //Original function always returns 10 instead of the total production turns. // totalTurns = terrainutil_GetTimeToBuild(p, m_type, m_transformType); totalTurns = terrainutil_GetProductionTime(m_type, p, m_transformType); turnsDone = totalTurns - m_turnsToComplete; if (totalTurns == 0) return 100; return (turnsDone * 100) / totalTurns; }


I noticed that the total production time of a terrain improvement should be returned here. But terrainutil_GetTimeToBuild just returns 10, no matter what you put into the function. From What I understand the terrainutil_GetProductionTime should do the same. And it looks now with the change the function PercentComplete function does work.

Here is the actual fuction I modified, I added another argument to the parameter list in terrainutil.h and in tiledraw.cpp:

code:
void TiledMap:rawPartiallyConstructedImprovement(aui_ Surface *surface, uint32 env, sint32 type, sint32 x, sint32 y, uint16 index, BOOL fog, sint32 percentComplete) //Added sint32 percentComplete by Martin Gühmann { //.... const TerrainImprovementRecord *rec = g_theTerrainImprovementDB->Get(type); /* //MG: Origianal code outcommented and replaced by the code below if(index >= rec->GetNumConstructionTiles()) { if(rec->GetNumConstructionTiles() < 1) { data = m_tileSet->GetImprovementData(1); } else { data = m_tileSet->GetImprovementData((uint16) rec->GetConstructionTiles(rec->GetNumConstructionTiles() - 1)); } } else { data = m_tileSet->GetImprovementData((uint16) rec->GetConstructionTiles(index)); }*/ if(rec->GetNumConstructionTiles() < 1) { data = m_tileSet->GetImprovementData(1); } // else if(rec->GetNumConstructionTiles() < 2) { // data = m_tileSet->GetImprovementData((uint16) rec->GetConstructionTiles(rec->GetNumConstructionTiles() - 1)); // } else { uint16 ctIndex = (uint16)floor((rec->GetNumConstructionTiles() * percentComplete)/100 ); data = m_tileSet->GetImprovementData((uint16) rec->GetConstructionTiles(ctIndex)); // Original code: // data = m_tileSet->GetImprovementData((uint16) rec->GetConstructionTiles(index)); } //.... }


The TileImprovement graphic for unfinished tileimps is now determined on the number of CunstructionTiles in tileimp.txt and the completion state of the improvement. Unfortunatly while I was steting this code in the debug build I got much more Assertion failure messages then before. I think I have tested my last modification and the rush build fix with it but I am not sure at 100%.

And there is another problem, the improvement graphic is only updated when the improvement is in the vision range of a unit and then only when the unit is moved or you enabled GodMode via the Cheat Editor. If it is just in your city radius the graphic isn't updated.

If you like to test these files yourself download the attachment. It includes:

TerrImprovementData.cpp
tiledraw.cpp
tiledmap.h

They aren't in an directory structure so you have to put them on your own into the according directories.

TerrImprovementData.cpp goes into the ..\ctp2_code\gs\gameobj\ folder.
And the other two files go into the ..\ctp2_code\gfx\tilesys\ folder.

-Martin

Attachment: tileimp.zip
This has been downloaded 4 time(s).

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 06-11-2003 22:16 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Re: The only one ConstructionTile used bug Increase the size of your Attachments

quote:
Originally posted by Martin Gühmann
Unfortunatly while I was steting this code in the debug build I got much more Assertion failure messages then before. I think I have tested my last modification and the rush build fix with it but I am not sure at 100%.


I figuered out why I got more debug assertions: I switched to GoodMod of course without its slic files, so finally we have also to test the game on mods.

-Martin

NelsonAndBronte is offline NelsonAndBronte
Settler

Nov 2003
time: 05:31
  Old Post 07-11-2003 23:53
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Inflate your Upload Space

Hi Martin,
You mention you can only see the partially constructed improvement if a unit can see it and not if it is just within your city radius. Is this also true of any ordinary improvement you own? For instance, if someone comes and pillages a tile improvement in your city radius, do you not see it? Do you think that this is a problem?

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

No it is just a problem of not finished tile improvements that their graphics are only updated when you enable good mode or one of your units is moving near the not finished tile improvement.

-Martin

NelsonAndBronte is offline NelsonAndBronte
Settler

Nov 2003
time: 05:31
  Old Post 08-11-2003 02:44
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

I guess I meant whether or not you think we should change the display behaviour of title improvements. This is controlled by tiledraw.cpp, we can change it if you think it appropriate.

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

I already changed the display behaviour for unfinished tile improvements, because this way it comes closer to the CTP1 display behaviour of unfinished tile improvements. The problem is that I don't know where the part of the function is located were the unfinished tile improvements are updated. For finished improvements there is no need to update them every turn, because they don't change their graphics every or every second turn like for the unfinished tile improvemnts. So I think the problem is that this draw function isn't recalled every turn. Of course the is no need for it, as long as nothing changes. I guess the programmers just forgot the construction tiles, because they give them all the same graphics.

-Martin

  < 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.0350 seconds (88.73% PHP - 11.27% 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