* Update the caches of this ship. */
| 229 | * Update the caches of this ship. |
| 230 | */ |
| 231 | void Ship::UpdateCache() |
| 232 | { |
| 233 | const ShipVehicleInfo *svi = ShipVehInfo(this->engine_type); |
| 234 | |
| 235 | /* Get speed fraction for the current water type. Aqueducts are always canals. */ |
| 236 | bool is_ocean = GetEffectiveWaterClass(this->tile) == WaterClass::Sea; |
| 237 | uint raw_speed = GetVehicleProperty(this, PROP_SHIP_SPEED, svi->max_speed); |
| 238 | this->vcache.cached_max_speed = svi->ApplyWaterClassSpeedFrac(raw_speed, is_ocean); |
| 239 | |
| 240 | /* Update cargo aging period. */ |
| 241 | this->vcache.cached_cargo_age_period = GetVehicleProperty(this, PROP_SHIP_CARGO_AGE_PERIOD, EngInfo(this->engine_type)->cargo_age_period); |
| 242 | |
| 243 | this->UpdateVisualEffect(); |
| 244 | } |
| 245 | |
| 246 | Money Ship::GetRunningCost() const |
| 247 | { |
no test coverage detected