|
@@ -216,12 +216,13 @@ void Ship::UpdateCache()
|
|
|
}
|
|
|
|
|
|
Money Ship::GetRunningCost() const
|
|
|
{
|
|
|
const Engine *e = this->GetEngine();
|
|
|
uint cost_factor = GetVehicleProperty(this, PROP_SHIP_RUNNING_COST_FACTOR, e->u.ship.running_cost);
|
|
|
cost_factor *= _settings_game.economy.running_cost_multiplier_water;
|
|
|
return GetPrice(PR_RUNNING_SHIP, cost_factor, e->GetGRF());
|
|
|
}
|
|
|
|
|
|
void Ship::OnNewDay()
|
|
|
{
|
|
|
if ((++this->day_counter & 7) == 0) {
|
|
@@ -411,12 +412,24 @@ static bool ShipAccelerate(Vehicle *v)
|
|
|
uint spd;
|
|
|
byte t;
|
|
|
|
|
|
spd = std::min<uint>(v->cur_speed + 1, v->vcache.cached_max_speed);
|
|
|
spd = std::min<uint>(spd, v->current_order.GetMaxSpeed() * 2);
|
|
|
|
|
|
if(v->breakdown_ctr == 1 && v->breakdown_type == BREAKDOWN_LOW_POWER && v->cur_speed > (v->breakdown_severity * ShipVehInfo(v->engine_type)->max_speed) >> 8) {
|
|
|
if((v->tick_counter & 0x7) == 0 && v->cur_speed > 0) {
|
|
|
spd = v->cur_speed - 1;
|
|
|
} else {
|
|
|
spd = v->cur_speed;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(v->breakdown_ctr == 1 && v->breakdown_type == BREAKDOWN_LOW_SPEED) {
|
|
|
spd = std::min<uint>(spd, v->breakdown_severity);
|
|
|
}
|
|
|
|
|
|
/* updates statusbar only if speed have changed to save CPU time */
|
|
|
if (spd != v->cur_speed) {
|
|
|
v->cur_speed = spd;
|
|
|
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
|
|
}
|
|
|
|
|
@@ -875,12 +888,13 @@ CommandCost CmdBuildShip(DoCommandFlag f
|
|
|
v->last_station_visited = INVALID_STATION;
|
|
|
v->last_loading_station = INVALID_STATION;
|
|
|
v->engine_type = e->index;
|
|
|
|
|
|
v->reliability = e->reliability;
|
|
|
v->reliability_spd_dec = e->reliability_spd_dec;
|
|
|
v->breakdown_chance = 64; // ships have a 50% lower breakdown chance than normal
|
|
|
v->max_age = e->GetLifeLengthInDays();
|
|
|
|
|
|
v->state = TRACK_BIT_DEPOT;
|
|
|
|
|
|
v->SetServiceInterval(Company::Get(_current_company)->settings.vehicle.servint_ships);
|
|
|
v->date_of_last_service = _date;
|