Originally posted by E
just drafted this. I'm sure I'll have to tweak it
just drafted this. I'm sure I'll have to tweak it
Code:
MapPoint SpotFound; CityInfluenceIterator it(m_point, m_sizeIndex); sint32 s; for(s = 0; s < rec->GetNumShowOnMap(); s++) { const TerrainImprovementRecord *trec = g_theTerrainImprovementDB->Get(s); for(it.Start(); !it.End(); it.Next()) { Cell *cell = g_theWorld->GetCell(it.Pos()); if(m_point == it.Pos()) continue; if(terrainutil_CanPlayerSpecialBuildAt(trec, m_owner, it.Pos)) { SpotFound = it.Pos(); } else { SpotFound = it.Pos(); } } g_player[m_owner]->CreateSpecialImprovement(rec->GetShowOnMapIndex(s), SpotFound, 0); }
Code:
for all tiles in the city radius do if a good tile has been found do if current tile is better than found tile do foundTile := currentTile end else foundTile := currentTile; end end place wonder improvement on foundTile
Code:
for all tiles in the city radius do if current tile is better than found tile do foundTile := currentTile else foundTile := currentTile; end end place wonder improvement on foundTile
Originally posted by E
I got this drafted but didn't see where I needed tothe tileimp. I guess basie off the excludes of a tile imp. So far this just compares if one tile has more improvements than another one.
I got this drafted but didn't see where I needed tothe tileimp. I guess basie off the excludes of a tile imp. So far this just compares if one tile has more improvements than another one.
Code:
void CityData::IsNewTileBetter(const MapPoint &npos, MapPoint &opos, sint32 &wonderimp ) { Cell *ncell = g_theWorld->GetCell(&npos); Cell *ocell = g_theWorld->GetCell(&opos); // Of course preferable is that wonderImp does't remove any tileimps //if wonderImp removes less Imps at newTile than at oldTile do if(ocell->GetNumImprovements() > ncell->GetNumImprovements() ) return true; } else { return false; } }
Code:
IsNewTileBetter(Tile newTile, Tile oldTile, Imp wonderImp) // Of course preferable is that wonderImp does't remove any tileimps if wonderImp removes less Imps at newTile than at oldTile do return true; else // Of course if the better check is be just simple than we can do without an own function return false; end end
Code:
IsNewTileBetter(Tile newTile, Tile oldTile, Imp wonderImp) // Of course preferable is that wonderImp does't remove any tileimps [b]if at newTile are less Imps than at at oldTile do[/b] return true; else // Of course if the better check is be just simple than we can do without an own function return false; end end
-Martin
Comment