So you got it now. Now we have this piece of code:
So what does return IsValid() in this case?
-Martin
Code:
MapPoint SpotFound; SpotFound.IsValid();
-Martin
bool MapPoint::IsValid(void) const { return (g_theWorld->IsXwrap() || ((x >= 0) && (x < g_mp_size.x))) && (g_theWorld->IsYwrap() || ((y >= 0) && (y < g_mp_size.y))) #if !defined(_SMALL_MAPPOINTS) && (z >= 0) && (z < g_mp_size.z) #endif ; }
MapPoint SpotFound(-1,-1); CityInfluenceIterator it(point, GetVisionRadius()); //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 *ncell = g_theWorld->GetCell(it.Pos()); //it.Pos now it.point? Cell *ocell = g_theWorld->GetCell(SpotFound); if(point == it.Pos()) continue; if(terrainutil_CanPlayerSpecialBuildAt(trec, m_owner, it.Pos())){ if ((!SpotFound.IsValid()) ||(ncell->GetNumDBImprovements() > ocell->GetNumDBImprovements()) ||(ncell->GetGoldFromTerrain() > ocell->GetGoldFromTerrain()) ){ SpotFound = it.Pos(); } } } g_player[m_owner]->CreateSpecialImprovement(rec->GetShowOnMapIndex(s), SpotFound, 0); }
MapPoint SpotFound(-1,-1); CityInfluenceIterator it(point, GetVisionRadius()); //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 *ncell = g_theWorld->GetCell(it.Pos()); //it.Pos now it.point? Cell *ocell = g_theWorld->GetCell(SpotFound); if(point == it.Pos()) continue; if(terrainutil_CanPlayerSpecialBuildAt(trec, m_owner, it.Pos())){ if ((!SpotFound.IsValid()) ||(ncell->GetNumDBImprovements() > ocell->GetNumDBImprovements()) ||(ncell->GetGoldFromTerrain() > ocell->GetGoldFromTerrain()) ){ SpotFound = it.Pos(); } } } g_player[m_owner]->CreateSpecialImprovement(rec->GetShowOnMapIndex(s), SpotFound, 0); }
// EMOD Visible wonders 4-25-2006 MapPoint SpotFound(-1,-1); CityInfluenceIterator it(point, GetVisionRadius()); //m_sizeIndex GetVisionRadius() sint32 s; for(s = 0; s < rec->GetNumShowOnMap(); s++) { const TerrainImprovementRecord *trec = g_theTerrainImprovementDB->Get(s); for(it.Start(); !it.End(); it.Next()) { Cell *ncell = g_theWorld->GetCell(it.Pos()); //it.Pos now it.point? Cell *ocell = g_theWorld->GetCell(SpotFound); if(point == it.Pos()) continue; if(terrainutil_CanPlayerSpecialBuildAt(trec, m_owner, it.Pos())){ if ((!SpotFound.IsValid()) ||(ncell->GetNumDBImprovements() > ocell->GetNumDBImprovements()) ||(ncell->GetGoldFromTerrain() > ocell->GetGoldFromTerrain()) ){ SpotFound = it.Pos(); } SpotFound = it.Pos(); } } g_player[m_owner]->CreateSpecialImprovement(rec->GetShowOnMapIndex(s), SpotFound, 0); } //for all tiles in the city radius do // if current tile allows building of wonder imp do // if no good tile has been found yet // or current tile is better than found tile do // foundTile := currentTile // end // end //end
for all tiles in the city radius do if current tile allows building of wonder imp do if no good tile has been found yet or current tile is better than found tile do foundTile := currentTile end foundTile := currentTile end end
for all tiles in the city radius do if current tile is city tile do // Do this first before you do anything else continue if current tile allows building of wonder imp do if a good tile has been found do Get new cell from currentTile Get old cell from foundTile if currentTile has less tileimps than foundTile do foundTile := currentTile end else do // No good tile has been found yet foundTile := currentTile end end end
Comment