Merge: Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:
@@ -98,7 +98,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
if (!_settings_game.economy.infrastructure_sharing[type]) return CMD_ERROR;
|
||||
|
||||
const Company *c = Company::GetIfValid(GetTileOwner(tile));
|
||||
if (c == NULL || !c->settings.infra_others_buy_in_depot[type]) return CMD_ERROR;
|
||||
if (c == nullptr || !c->settings.infra_others_buy_in_depot[type]) return CMD_ERROR;
|
||||
}
|
||||
|
||||
/* Validate the engine type. */
|
||||
@@ -145,7 +145,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
SavedRandomSeeds saved_seeds;
|
||||
if (flags != subflags) SaveRandomSeeds(&saved_seeds);
|
||||
|
||||
Vehicle *v = NULL;
|
||||
Vehicle *v = nullptr;
|
||||
switch (type) {
|
||||
case VEH_TRAIN: value.AddCost(CmdBuildRailVehicle(tile, subflags, e, GB(p1, 24, 8), &v)); break;
|
||||
case VEH_ROAD: value.AddCost(CmdBuildRoadVehicle(tile, subflags, e, GB(p1, 24, 8), &v)); break;
|
||||
@@ -161,7 +161,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
}
|
||||
|
||||
if (refitting) {
|
||||
value.AddCost(CmdRefitVehicle(tile, flags, v->index, cargo, NULL));
|
||||
value.AddCost(CmdRefitVehicle(tile, flags, v->index, cargo, nullptr));
|
||||
} else {
|
||||
/* Fill in non-refitted capacities */
|
||||
_returned_refit_capacity = e->GetDisplayDefaultCapacity(&_returned_mail_refit_capacity);
|
||||
@@ -215,7 +215,7 @@ CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *v, uint16 data, uint3
|
||||
CommandCost CmdSellVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
||||
if (v == NULL) return CMD_ERROR;
|
||||
if (v == nullptr) return CMD_ERROR;
|
||||
|
||||
Vehicle *front = v->First();
|
||||
|
||||
@@ -231,7 +231,7 @@ CommandCost CmdSellVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
|
||||
/* Can we actually make the order backup, i.e. are there enough orders? */
|
||||
if (p1 & MAKE_ORDER_BACKUP_FLAG &&
|
||||
front->orders.list != NULL &&
|
||||
front->orders.list != nullptr &&
|
||||
!front->orders.list->IsShared() &&
|
||||
!Order::CanAllocateItem(front->orders.list->GetNumOrders())) {
|
||||
/* Only happens in exceptional cases when there aren't enough orders anyhow.
|
||||
@@ -255,7 +255,7 @@ CommandCost CmdSellVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
|
||||
/**
|
||||
* Helper to run the refit cost callback.
|
||||
* @param v The vehicle we are refitting, can be NULL.
|
||||
* @param v The vehicle we are refitting, can be nullptr.
|
||||
* @param engine_type Which engine to refit
|
||||
* @param new_cid Cargo type we are refitting to.
|
||||
* @param new_subtype New cargo subtype.
|
||||
@@ -268,7 +268,7 @@ static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID ne
|
||||
const Engine *e = Engine::Get(engine_type);
|
||||
|
||||
/* Is this vehicle a NewGRF vehicle? */
|
||||
if (e->GetGRF() != NULL) {
|
||||
if (e->GetGRF() != nullptr) {
|
||||
const CargoSpec *cs = CargoSpec::Get(new_cid);
|
||||
uint32 param1 = (cs->classes << 16) | (new_subtype << 8) | e->GetGRF()->cargo_map[new_cid];
|
||||
|
||||
@@ -282,12 +282,12 @@ static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID ne
|
||||
}
|
||||
|
||||
*auto_refit_allowed = e->info.refit_cost == 0;
|
||||
return (v == NULL || v->cargo_type != new_cid) ? e->info.refit_cost : 0;
|
||||
return (v == nullptr || v->cargo_type != new_cid) ? e->info.refit_cost : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Learn the price of refitting a certain engine
|
||||
* @param v The vehicle we are refitting, can be NULL.
|
||||
* @param v The vehicle we are refitting, can be nullptr.
|
||||
* @param engine_type Which engine to refit
|
||||
* @param new_cid Cargo type we are refitting to.
|
||||
* @param new_subtype New cargo subtype.
|
||||
@@ -369,7 +369,7 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles,
|
||||
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
byte actual_subtype = new_subtype;
|
||||
for (; v != NULL; v = (only_this ? NULL : v->Next())) {
|
||||
for (; v != nullptr; v = (only_this ? nullptr : v->Next())) {
|
||||
/* Reset actual_subtype for every new vehicle */
|
||||
if (!v->IsArticulatedPart()) actual_subtype = new_subtype;
|
||||
|
||||
@@ -481,7 +481,7 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles,
|
||||
CommandCost CmdRefitVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||
if (v == NULL) return CMD_ERROR;
|
||||
if (v == nullptr) return CMD_ERROR;
|
||||
|
||||
/* Don't allow disasters and sparks and such to be refitted.
|
||||
* We cannot check for IsPrimaryVehicle as autoreplace also refits in free wagon chains. */
|
||||
@@ -587,7 +587,7 @@ CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||
if ((flags & DC_AUTOREPLACE) == 0) SetBit(p2, 0);
|
||||
|
||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||
if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
|
||||
CommandCost ret = CheckVehicleControlAllowed(v);
|
||||
if (ret.Failed()) return ret;
|
||||
@@ -686,7 +686,7 @@ CommandCost CmdMassStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32
|
||||
if (!GenerateVehicleSortList(&list, vli)) return CMD_ERROR;
|
||||
} else {
|
||||
/* Get the list of vehicles in the depot */
|
||||
BuildDepotVehicleList(vli.vtype, tile, &list, NULL);
|
||||
BuildDepotVehicleList(vli.vtype, tile, &list, nullptr);
|
||||
}
|
||||
|
||||
for (uint i = 0; i < list.size(); i++) {
|
||||
@@ -785,7 +785,7 @@ static bool IsUniqueVehicleName(const char *name)
|
||||
const Vehicle *v;
|
||||
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (v->name != NULL && strcmp(v->name, name) == 0) return false;
|
||||
if (v->name != nullptr && strcmp(v->name, name) == 0) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -855,7 +855,7 @@ CommandCost CmdToggleReuseDepotVehicles(TileIndex tile, DoCommandFlag flags, uin
|
||||
// Identify template to toggle
|
||||
TemplateVehicle *template_vehicle = TemplateVehicle::GetIfValid(p1);
|
||||
|
||||
if (template_vehicle == NULL) {
|
||||
if (template_vehicle == nullptr) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -884,7 +884,7 @@ CommandCost CmdToggleKeepRemainingVehicles(TileIndex tile, DoCommandFlag flags,
|
||||
// Identify template to toggle
|
||||
TemplateVehicle *template_vehicle = TemplateVehicle::GetIfValid(p1);
|
||||
|
||||
if (template_vehicle == NULL) {
|
||||
if (template_vehicle == nullptr) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -913,7 +913,7 @@ CommandCost CmdToggleRefitAsTemplate(TileIndex tile, DoCommandFlag flags, uint32
|
||||
// Identify template to toggle
|
||||
TemplateVehicle *template_vehicle = TemplateVehicle::GetIfValid(p1);
|
||||
|
||||
if (template_vehicle == NULL) {
|
||||
if (template_vehicle == nullptr) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -942,7 +942,7 @@ CommandCost CmdToggleTemplateReplaceOldOnly(TileIndex tile, DoCommandFlag flags,
|
||||
// Identify template to toggle
|
||||
TemplateVehicle *template_vehicle = TemplateVehicle::GetIfValid(p1);
|
||||
|
||||
if (template_vehicle == NULL) {
|
||||
if (template_vehicle == nullptr) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ CommandCost CmdVirtualTrainFromTemplateVehicle(TileIndex tile, DoCommandFlag fla
|
||||
|
||||
TemplateVehicle* tv = TemplateVehicle::GetIfValid(template_vehicle_id);
|
||||
|
||||
if (tv == NULL) {
|
||||
if (tv == nullptr) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -986,7 +986,7 @@ CommandCost CmdVirtualTrainFromTemplateVehicle(TileIndex tile, DoCommandFlag fla
|
||||
StringID err = INVALID_STRING_ID;
|
||||
Train* train = VirtualTrainFromTemplateVehicle(tv, err);
|
||||
|
||||
if (train == NULL) {
|
||||
if (train == nullptr) {
|
||||
return_cmd_error(err);
|
||||
}
|
||||
}
|
||||
@@ -1004,15 +1004,15 @@ Train* VirtualTrainFromTemplateVehicle(TemplateVehicle* tv, StringID &err)
|
||||
assert(tv->owner == _current_company);
|
||||
|
||||
head = CmdBuildVirtualRailVehicle(tv->engine_type, true, err);
|
||||
if (!head) return NULL;
|
||||
if (!head) return nullptr;
|
||||
|
||||
tail = head;
|
||||
tv = tv->GetNextUnit();
|
||||
while (tv) {
|
||||
tmp = CmdBuildVirtualRailVehicle(tv->engine_type, true, err);
|
||||
if (!tmp) {
|
||||
CmdDeleteVirtualTrain(INVALID_TILE, DC_EXEC, head->index, 0, NULL);
|
||||
return NULL;
|
||||
CmdDeleteVirtualTrain(INVALID_TILE, DC_EXEC, head->index, 0, nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
tmp->cargo_type = tv->cargo_type;
|
||||
@@ -1042,7 +1042,7 @@ CommandCost CmdVirtualTrainFromTrain(TileIndex tile, DoCommandFlag flags, uint32
|
||||
VehicleID vehicle_id = p1;
|
||||
Vehicle* vehicle = Vehicle::GetIfValid(vehicle_id);
|
||||
|
||||
if (vehicle == NULL || vehicle->type != VEH_TRAIN) {
|
||||
if (vehicle == nullptr || vehicle->type != VEH_TRAIN) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -1063,7 +1063,7 @@ CommandCost CmdVirtualTrainFromTrain(TileIndex tile, DoCommandFlag flags, uint32
|
||||
while (train) {
|
||||
tmp = CmdBuildVirtualRailVehicle(train->engine_type, false, err);
|
||||
if (!tmp) {
|
||||
CmdDeleteVirtualTrain(tile, flags, head->index, 0, NULL);
|
||||
CmdDeleteVirtualTrain(tile, flags, head->index, 0, nullptr);
|
||||
return_cmd_error(err);
|
||||
}
|
||||
|
||||
@@ -1096,7 +1096,7 @@ CommandCost CmdDeleteVirtualTrain(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||
|
||||
Vehicle* vehicle = Vehicle::GetIfValid(vehicle_id);
|
||||
|
||||
if (vehicle == NULL || vehicle->type != VEH_TRAIN) {
|
||||
if (vehicle == nullptr || vehicle->type != VEH_TRAIN) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -1128,7 +1128,7 @@ CommandCost CmdReplaceTemplateVehicle(TileIndex tile, DoCommandFlag flags, uint3
|
||||
TemplateVehicle* template_vehicle = TemplateVehicle::GetIfValid(template_vehicle_id);
|
||||
Vehicle* vehicle = Vehicle::GetIfValid(virtual_train_id);
|
||||
|
||||
if (vehicle == NULL || vehicle->type != VEH_TRAIN) {
|
||||
if (vehicle == nullptr || vehicle->type != VEH_TRAIN) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -1139,15 +1139,15 @@ CommandCost CmdReplaceTemplateVehicle(TileIndex tile, DoCommandFlag flags, uint3
|
||||
if (should_execute) {
|
||||
VehicleID old_ID = INVALID_VEHICLE;
|
||||
|
||||
if (template_vehicle != NULL) {
|
||||
if (template_vehicle != nullptr) {
|
||||
old_ID = template_vehicle->index;
|
||||
delete template_vehicle;
|
||||
template_vehicle = NULL;
|
||||
template_vehicle = nullptr;
|
||||
}
|
||||
|
||||
template_vehicle = TemplateVehicleFromVirtualTrain(train);
|
||||
|
||||
if (template_vehicle == NULL) {
|
||||
if (template_vehicle == nullptr) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -1193,7 +1193,7 @@ CommandCost CmdTemplateVehicleFromTrain(TileIndex tile, DoCommandFlag flags, uin
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
for (Train *v = clicked; v != NULL; v = v->GetNextUnit()) {
|
||||
for (Train *v = clicked; v != nullptr; v = v->GetNextUnit()) {
|
||||
if (!IsEngineBuildable(v->engine_type, VEH_TRAIN, _current_company)) {
|
||||
return_cmd_error(STR_ERROR_RAIL_VEHICLE_NOT_AVAILABLE + VEH_TRAIN);
|
||||
}
|
||||
@@ -1203,8 +1203,8 @@ CommandCost CmdTemplateVehicleFromTrain(TileIndex tile, DoCommandFlag flags, uin
|
||||
|
||||
if (should_execute) {
|
||||
TemplateVehicle *tmp;
|
||||
TemplateVehicle *prev = NULL;
|
||||
for (; clicked != NULL; clicked = clicked->Next()) {
|
||||
TemplateVehicle *prev = nullptr;
|
||||
for (; clicked != nullptr; clicked = clicked->Next()) {
|
||||
tmp = new TemplateVehicle(clicked->engine_type);
|
||||
SetupTemplateVehicleFromVirtual(tmp, prev, clicked);
|
||||
prev = tmp;
|
||||
@@ -1235,7 +1235,7 @@ CommandCost CmdDeleteTemplateVehicle(TileIndex tile, DoCommandFlag flags, uint32
|
||||
// Identify template to delete
|
||||
TemplateVehicle *del = TemplateVehicle::GetIfValid(p1);
|
||||
|
||||
if (del == NULL) return CMD_ERROR;
|
||||
if (del == nullptr) return CMD_ERROR;
|
||||
|
||||
bool should_execute = (flags & DC_EXEC) != 0;
|
||||
|
||||
@@ -1303,7 +1303,7 @@ CommandCost CmdDeleteTemplateReplacement(TileIndex tile, DoCommandFlag flags, ui
|
||||
|
||||
if (should_execute) {
|
||||
TemplateReplacement* tr = GetTemplateReplacementByGroupID(group_id);
|
||||
if (tr != NULL) {
|
||||
if (tr != nullptr) {
|
||||
delete tr;
|
||||
}
|
||||
|
||||
@@ -1328,11 +1328,11 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
CommandCost total_cost(EXPENSES_NEW_VEHICLES);
|
||||
|
||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||
if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
Vehicle *v_front = v;
|
||||
Vehicle *w = NULL;
|
||||
Vehicle *w_front = NULL;
|
||||
Vehicle *w_rear = NULL;
|
||||
Vehicle *w = nullptr;
|
||||
Vehicle *w_front = nullptr;
|
||||
Vehicle *w_rear = nullptr;
|
||||
|
||||
/*
|
||||
* v_front is the front engine in the original vehicle
|
||||
@@ -1352,7 +1352,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
int veh_counter = 0;
|
||||
do {
|
||||
veh_counter++;
|
||||
} while ((v = v->Next()) != NULL);
|
||||
} while ((v = v->Next()) != nullptr);
|
||||
|
||||
if (!Vehicle::CanAllocateItem(veh_counter)) {
|
||||
return_cmd_error(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME);
|
||||
@@ -1380,7 +1380,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
|
||||
if (cost.Failed()) {
|
||||
/* Can't build a part, then sell the stuff we already made; clear up the mess */
|
||||
if (w_front != NULL) DoCommand(w_front->tile, w_front->index | (1 << 20), 0, flags, GetCmdSellVeh(w_front));
|
||||
if (w_front != nullptr) DoCommand(w_front->tile, w_front->index | (1 << 20), 0, flags, GetCmdSellVeh(w_front));
|
||||
return cost;
|
||||
}
|
||||
|
||||
@@ -1413,7 +1413,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
}
|
||||
w_rear = w; // trains needs to know the last car in the train, so they can add more in next loop
|
||||
}
|
||||
} while (v->type == VEH_TRAIN && (v = v->GetNextVehicle()) != NULL);
|
||||
} while (v->type == VEH_TRAIN && (v = v->GetNextVehicle()) != nullptr);
|
||||
|
||||
if ((flags & DC_EXEC) && v_front->type == VEH_TRAIN) {
|
||||
/* for trains this needs to be the front engine due to the callback function */
|
||||
@@ -1439,7 +1439,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
do {
|
||||
do {
|
||||
if (flags & DC_EXEC) {
|
||||
assert(w != NULL);
|
||||
assert(w != nullptr);
|
||||
|
||||
/* Find out what's the best sub type */
|
||||
byte subtype = GetBestFittingSubType(v, w, v->cargo_type);
|
||||
@@ -1459,7 +1459,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
|
||||
if (v->cargo_type != initial_cargo && initial_cargo != CT_INVALID) {
|
||||
bool dummy;
|
||||
total_cost.AddCost(GetRefitCost(NULL, v->engine_type, v->cargo_type, v->cargo_subtype, &dummy));
|
||||
total_cost.AddCost(GetRefitCost(nullptr, v->engine_type, v->cargo_type, v->cargo_subtype, &dummy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1468,10 +1468,10 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (v != NULL);
|
||||
} while (v != nullptr);
|
||||
|
||||
if ((flags & DC_EXEC) && v->type == VEH_TRAIN) w = w->GetNextVehicle();
|
||||
} while (v->type == VEH_TRAIN && (v = v->GetNextVehicle()) != NULL);
|
||||
} while (v->type == VEH_TRAIN && (v = v->GetNextVehicle()) != nullptr);
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
/*
|
||||
@@ -1482,7 +1482,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
DoCommand(0, w_front->index | (p2 & 1 ? CO_SHARE : CO_COPY) << 30, v_front->index, flags, CMD_CLONE_ORDER);
|
||||
|
||||
/* Now clone the vehicle's name, if it has one. */
|
||||
if (v_front->name != NULL) CloneVehicleName(v_front, w_front);
|
||||
if (v_front->name != nullptr) CloneVehicleName(v_front, w_front);
|
||||
}
|
||||
|
||||
/* Since we can't estimate the cost of cloning a vehicle accurately we must
|
||||
@@ -1554,7 +1554,7 @@ CommandCost CmdSendVehicleToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||
}
|
||||
|
||||
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
||||
if (v == NULL) return CMD_ERROR;
|
||||
if (v == nullptr) return CMD_ERROR;
|
||||
if (!v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
|
||||
return v->SendToDepot(flags, (DepotCommand)(p1 & DEPOT_COMMAND_MASK), p2);
|
||||
@@ -1572,7 +1572,7 @@ CommandCost CmdSendVehicleToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||
CommandCost CmdSetVehicleUnitNumber(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||
if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
|
||||
CommandCost ret = CheckOwnership(v->owner);
|
||||
if (ret.Failed()) return ret;
|
||||
@@ -1596,7 +1596,7 @@ CommandCost CmdSetVehicleUnitNumber(TileIndex tile, DoCommandFlag flags, uint32
|
||||
CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||
if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
|
||||
CommandCost ret = CheckOwnership(v->owner);
|
||||
if (ret.Failed()) return ret;
|
||||
@@ -1610,7 +1610,7 @@ CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
free(v->name);
|
||||
v->name = reset ? NULL : stredup(text);
|
||||
v->name = reset ? nullptr : stredup(text);
|
||||
InvalidateWindowClassesData(GetWindowClassForVehicleType(v->type), 1);
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
@@ -1634,7 +1634,7 @@ CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
CommandCost CmdChangeServiceInt(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||
if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
|
||||
CommandCost ret = CheckOwnership(v->owner);
|
||||
if (ret.Failed()) return ret;
|
||||
|
Reference in New Issue
Block a user