 |
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:31
|
|
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).
|
|
|  |
 |
|
NelsonAndBronte
|
|
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?
|
|
|  |
 |
|
NelsonAndBronte
|
|
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.
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:31. Apolyton Time is 00:31. |
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
|
|
|
|
|
|