Have a look at the CellUnitList::IsMovePointsEnough function. This function will test to see if the moving unit is an air unit and then apply the default cost for an air unit -- which therefore ignores the terrain cost of the cell. For any other unit, it uses themovement point value created by Cell::CalcTerrainMoveCost(). This function iterates through all the terrain improvements in a given cell and returns the movement cost of the most effective improvement present. Therefore, since a ship is not an airplane, it is allowed to use undersea tunnels.
It appears that we need a function analogous to GetMovementTypeAir viz:
If this function returns TRUE, then we want the base value for the terrain in the cell unmodified by terrain improvements:
Perhaps the base movement cost should just be stored along with the modified movement cost and accessed through a call to something like "World::GetBaseMoveCost"
Still no luck finding CtP2 in the bargain bins. I saw it a year ago at Mustapha Center in Singapore! Too bad I'm in Boston now....
It appears that we need a function analogous to GetMovementTypeAir viz:
Code:
BOOL CellUnitList::GetMovementTypeWater() const { sint32 i; for (i=0; i < m_nElements; i++) { if (!m_array[i].GetMovementTypeSea() && !m_array[i].GetMovementTypeShallowWater()) { return FALSE; } } return TRUE; }
Code:
const TerrainRecord *rec = g_theTerrainDB->Get(m_terrain_type); sint32 base; bool gotMovement = rec->GetEnvBase()->GetMovement(base); Assert(gotMovement);
Still no luck finding CtP2 in the bargain bins. I saw it a year ago at Mustapha Center in Singapore! Too bad I'm in Boston now....
Comment