Merge 1.9.0-beta2

This commit is contained in:
Pavel Stupnikov
2019-02-14 00:47:22 +03:00
1364 changed files with 22213 additions and 10721 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: vehicle_gui.cpp 27895 2017-08-20 08:28:05Z alberth $ */
/* $Id$ */
/*
* This file is part of OpenTTD.
@@ -417,7 +417,7 @@ struct RefitWindow : public Window {
do {
if (v->type == VEH_TRAIN && !vehicles_to_refit.Contains(v->index)) continue;
const Engine *e = v->GetEngine();
uint32 cmask = e->info.refit_mask;
CargoTypes cmask = e->info.refit_mask;
byte callback_mask = e->info.callback_mask;
/* Skip this engine if it does not carry anything */
@@ -682,7 +682,7 @@ struct RefitWindow : public Window {
/**
* Gets the #StringID to use for displaying capacity.
* @param Cargo and cargo subtype to check for capacity.
* @param option Cargo and cargo subtype to check for capacity.
* @return INVALID_STRING_ID if there is no capacity. StringID to use in any other case.
* @post String parameters have been set.
*/
@@ -690,8 +690,8 @@ struct RefitWindow : public Window {
{
assert(_current_company == _local_company);
Vehicle *v = Vehicle::Get(this->window_number);
CommandCost cost = DoCommand(v->tile, this->selected_vehicle, option->cargo | (int)this->auto_refit << 6 | option->subtype << 8 |
this->num_vehicles << 16, DC_QUERY_COST, GetCmdRefitVeh(v->type));
CommandCost cost = DoCommand(v->tile, this->selected_vehicle, option->cargo | option->subtype << 8 | this->num_vehicles << 16 |
(int)this->auto_refit << 24, DC_QUERY_COST, GetCmdRefitVeh(v->type));
if (cost.Failed()) return INVALID_STRING_ID;
@@ -818,8 +818,8 @@ struct RefitWindow : public Window {
Vehicle *v = Vehicle::Get(this->window_number);
this->selected_vehicle = v->index;
this->num_vehicles = UINT8_MAX;
FALLTHROUGH;
}
FALLTHROUGH;
case 2: { // The vehicle selection has changed; rebuild the entire list.
if (!gui_scope) break;
@@ -844,8 +844,8 @@ struct RefitWindow : public Window {
this->information_width = max_width;
this->ReInit();
}
FALLTHROUGH;
}
FALLTHROUGH;
case 1: // A new cargo has been selected.
if (!gui_scope) break;
@@ -906,8 +906,8 @@ struct RefitWindow : public Window {
if (_ctrl_pressed) this->num_vehicles = UINT8_MAX;
break;
}
FALLTHROUGH;
}
FALLTHROUGH;
default:
/* Clear the selection. */
@@ -941,8 +941,8 @@ struct RefitWindow : public Window {
this->InvalidateData(1);
if (click_count == 1) break;
FALLTHROUGH;
}
FALLTHROUGH;
case WID_VR_REFIT: // refit button
if (this->cargo != NULL) {
@@ -1044,9 +1044,9 @@ void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *pare
uint ShowRefitOptionsList(int left, int right, int y, EngineID engine)
{
/* List of cargo types of this engine */
uint32 cmask = GetUnionOfArticulatedRefitMasks(engine, false);
CargoTypes cmask = GetUnionOfArticulatedRefitMasks(engine, false);
/* List of cargo types available in this climate */
uint32 lmask = _cargo_mask;
CargoTypes lmask = _cargo_mask;
/* Draw nothing if the engine is not refittable */
if (HasAtMostOneBit(cmask)) return y;
@@ -1677,9 +1677,8 @@ public:
this->SetDirty();
}
virtual void OnTick()
virtual void OnGameTick()
{
if (_pause_mode != PM_UNPAUSED) return;
if (this->vehicles.NeedResort()) {
StationID station = (this->vli.type == VL_STATION_LIST) ? this->vli.index : INVALID_STATION;
@@ -2354,7 +2353,7 @@ static const uint32 _vehicle_command_translation_table[][4] = {
CMD_REVERSE_TRAIN_DIRECTION | CMD_MSG(STR_ERROR_CAN_T_REVERSE_DIRECTION_TRAIN),
CMD_TURN_ROADVEH | CMD_MSG(STR_ERROR_CAN_T_MAKE_ROAD_VEHICLE_TURN),
0xffffffff, // invalid for ships
0xffffffff // invalid for aircrafts
0xffffffff // invalid for aircraft
},
};
@@ -2717,7 +2716,7 @@ public:
}
}
virtual void OnTick()
virtual void OnGameTick()
{
const Vehicle *v = Vehicle::Get(this->window_number);
bool veh_stopped = v->IsStoppedInDepot();