(svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
This commit is contained in:
@@ -674,7 +674,7 @@ bool AfterLoadGame()
|
||||
* companies are 'invalid'.
|
||||
*/
|
||||
if (!_network_dedicated && IsValidCompanyID(COMPANY_FIRST)) {
|
||||
c = GetCompany(COMPANY_FIRST);
|
||||
c = Company::Get(COMPANY_FIRST);
|
||||
c->settings = _settings_client.company;
|
||||
}
|
||||
}
|
||||
@@ -1203,7 +1203,7 @@ bool AfterLoadGame()
|
||||
const CargoList::List *packets = v->cargo.Packets();
|
||||
for (CargoList::List::const_iterator it = packets->begin(); it != packets->end(); it++) {
|
||||
CargoPacket *cp = *it;
|
||||
cp->source_xy = IsValidStationID(cp->source) ? GetStation(cp->source)->xy : v->tile;
|
||||
cp->source_xy = IsValidStationID(cp->source) ? Station::Get(cp->source)->xy : v->tile;
|
||||
cp->loaded_at_xy = cp->source_xy;
|
||||
}
|
||||
v->cargo.InvalidateCache();
|
||||
@@ -1222,7 +1222,7 @@ bool AfterLoadGame()
|
||||
const CargoList::List *packets = ge->cargo.Packets();
|
||||
for (CargoList::List::const_iterator it = packets->begin(); it != packets->end(); it++) {
|
||||
CargoPacket *cp = *it;
|
||||
cp->source_xy = IsValidStationID(cp->source) ? GetStation(cp->source)->xy : st->xy;
|
||||
cp->source_xy = IsValidStationID(cp->source) ? Station::Get(cp->source)->xy : st->xy;
|
||||
cp->loaded_at_xy = cp->source_xy;
|
||||
}
|
||||
}
|
||||
@@ -1300,7 +1300,7 @@ bool AfterLoadGame()
|
||||
if ((v->type != VEH_TRAIN || IsFrontEngine(v)) && // for all locs
|
||||
!(v->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
|
||||
v->current_order.IsType(OT_LOADING)) { // loading
|
||||
GetStation(v->last_station_visited)->loading_vehicles.push_back(v);
|
||||
Station::Get(v->last_station_visited)->loading_vehicles.push_back(v);
|
||||
|
||||
/* The loading finished flag is *only* set when actually completely
|
||||
* finished. Because the vehicle is loading, it is not finished. */
|
||||
@@ -1465,7 +1465,7 @@ bool AfterLoadGame()
|
||||
/* Update go to buoy orders because they are just waypoints */
|
||||
Order *order;
|
||||
FOR_ALL_ORDERS(order) {
|
||||
if (order->IsType(OT_GOTO_STATION) && GetStation(order->GetDestination())->IsBuoy()) {
|
||||
if (order->IsType(OT_GOTO_STATION) && Station::Get(order->GetDestination())->IsBuoy()) {
|
||||
order->SetLoadType(OLF_LOAD_IF_POSSIBLE);
|
||||
order->SetUnloadType(OUF_UNLOAD_IF_POSSIBLE);
|
||||
}
|
||||
|
@@ -587,8 +587,8 @@ static bool LoadOldOrder(LoadgameState *ls, int num)
|
||||
|
||||
/* Relink the orders to eachother (in the orders for one vehicle are behind eachother,
|
||||
* with an invalid order (OT_NOTHING) as indication that it is the last order */
|
||||
if (num > 0 && GetOrder(num)->IsValid()) {
|
||||
GetOrder(num - 1)->next = GetOrder(num);
|
||||
if (num > 0 && Order::Get(num)->IsValid()) {
|
||||
Order::Get(num - 1)->next = Order::Get(num);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -729,7 +729,7 @@ static bool LoadOldGood(LoadgameState *ls, int num)
|
||||
/* for TTO games, 12th (num == 11) goods entry is created in the Station constructor */
|
||||
if (_savegame_type == SGT_TTO && num == 11) return true;
|
||||
|
||||
Station *st = GetStation(_current_station_id);
|
||||
Station *st = Station::Get(_current_station_id);
|
||||
GoodsEntry *ge = &st->goods[num];
|
||||
|
||||
if (!LoadChunk(ls, ge, goods_chunk)) return false;
|
||||
@@ -792,7 +792,7 @@ static bool LoadOldStation(LoadgameState *ls, int num)
|
||||
if (!LoadChunk(ls, st, station_chunk)) return false;
|
||||
|
||||
if (st->xy != 0) {
|
||||
st->town = GetTown(RemapTownIndex(_old_town_index));
|
||||
st->town = Town::Get(RemapTownIndex(_old_town_index));
|
||||
|
||||
if (_savegame_type == SGT_TTO) {
|
||||
if (IsInsideBS(_old_string_id, 0x180F, 32)) {
|
||||
@@ -869,7 +869,7 @@ static bool LoadOldIndustry(LoadgameState *ls, int num)
|
||||
if (!LoadChunk(ls, i, industry_chunk)) return false;
|
||||
|
||||
if (i->xy != 0) {
|
||||
i->town = GetTown(RemapTownIndex(_old_town_index));
|
||||
i->town = Town::Get(RemapTownIndex(_old_town_index));
|
||||
|
||||
if (_savegame_type == SGT_TTO) {
|
||||
if (i->type > 0x06) i->type++; // Printing Works were added
|
||||
@@ -900,7 +900,7 @@ static const OldChunks _company_yearly_chunk[] = {
|
||||
|
||||
static bool LoadOldCompanyYearly(LoadgameState *ls, int num)
|
||||
{
|
||||
Company *c = GetCompany(_current_company_id);
|
||||
Company *c = Company::Get(_current_company_id);
|
||||
|
||||
for (uint i = 0; i < 13; i++) {
|
||||
if (_savegame_type == SGT_TTO && i == 6) {
|
||||
@@ -927,7 +927,7 @@ static const OldChunks _company_economy_chunk[] = {
|
||||
|
||||
static bool LoadOldCompanyEconomy(LoadgameState *ls, int num)
|
||||
{
|
||||
Company *c = GetCompany(_current_company_id);
|
||||
Company *c = Company::Get(_current_company_id);
|
||||
|
||||
if (!LoadChunk(ls, &c->cur_economy, _company_economy_chunk)) return false;
|
||||
|
||||
@@ -1131,7 +1131,7 @@ static const OldChunks vehicle_empty_chunk[] = {
|
||||
|
||||
static bool LoadOldVehicleUnion(LoadgameState *ls, int num)
|
||||
{
|
||||
Vehicle *v = GetVehicle(_current_vehicle_id);
|
||||
Vehicle *v = Vehicle::Get(_current_vehicle_id);
|
||||
uint temp = ls->total_read;
|
||||
bool res;
|
||||
|
||||
@@ -1358,11 +1358,11 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
|
||||
if (_old_order_ptr != 0 && _old_order_ptr != 0xFFFFFFFF) {
|
||||
uint max = _savegame_type == SGT_TTO ? 3000 : 5000;
|
||||
uint old_id = RemapOrderIndex(_old_order_ptr);
|
||||
if (old_id < max) v->orders.old = GetOrder(old_id); // don't accept orders > max number of orders
|
||||
if (old_id < max) v->orders.old = Order::Get(old_id); // don't accept orders > max number of orders
|
||||
}
|
||||
v->current_order.AssignOrder(UnpackOldOrder(_old_order));
|
||||
|
||||
if (_old_next_ptr != 0xFFFF) v->next = GetVehiclePoolSize() <= _old_next_ptr ? new (_old_next_ptr) InvalidVehicle() : GetVehicle(_old_next_ptr);
|
||||
if (_old_next_ptr != 0xFFFF) v->next = GetVehiclePoolSize() <= _old_next_ptr ? new (_old_next_ptr) InvalidVehicle() : Vehicle::Get(_old_next_ptr);
|
||||
|
||||
if (_cargo_count != 0) {
|
||||
CargoPacket *cp = new CargoPacket((_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, _cargo_count);
|
||||
|
@@ -157,8 +157,8 @@ static void Load_ORDR()
|
||||
/* The orders were built like this:
|
||||
* While the order is valid, set the previous will get it's next pointer set
|
||||
* We start with index 1 because no order will have the first in it's next pointer */
|
||||
if (GetOrder(i)->IsValid())
|
||||
GetOrder(i - 1)->next = GetOrder(i);
|
||||
if (Order::Get(i)->IsValid())
|
||||
Order::Get(i - 1)->next = Order::Get(i);
|
||||
}
|
||||
} else {
|
||||
int index;
|
||||
|
@@ -1431,35 +1431,35 @@ static void *IntToReference(uint index, SLRefType rt)
|
||||
|
||||
switch (rt) {
|
||||
case REF_ORDERLIST:
|
||||
if (_OrderList_pool.AddBlockIfNeeded(index)) return GetOrderList(index);
|
||||
if (_OrderList_pool.AddBlockIfNeeded(index)) return OrderList::Get(index);
|
||||
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "OrderList index out of range");
|
||||
|
||||
case REF_ORDER:
|
||||
if (_Order_pool.AddBlockIfNeeded(index)) return GetOrder(index);
|
||||
if (_Order_pool.AddBlockIfNeeded(index)) return Order::Get(index);
|
||||
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Order index out of range");
|
||||
|
||||
case REF_VEHICLE:
|
||||
if (_Vehicle_pool.AddBlockIfNeeded(index)) return GetVehicle(index);
|
||||
if (_Vehicle_pool.AddBlockIfNeeded(index)) return Vehicle::Get(index);
|
||||
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Vehicle index out of range");
|
||||
|
||||
case REF_STATION:
|
||||
if (_Station_pool.AddBlockIfNeeded(index)) return GetStation(index);
|
||||
if (_Station_pool.AddBlockIfNeeded(index)) return Station::Get(index);
|
||||
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Station index out of range");
|
||||
|
||||
case REF_TOWN:
|
||||
if (_Town_pool.AddBlockIfNeeded(index)) return GetTown(index);
|
||||
if (_Town_pool.AddBlockIfNeeded(index)) return Town::Get(index);
|
||||
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Town index out of range");
|
||||
|
||||
case REF_ROADSTOPS:
|
||||
if (_RoadStop_pool.AddBlockIfNeeded(index)) return GetRoadStop(index);
|
||||
if (_RoadStop_pool.AddBlockIfNeeded(index)) return RoadStop::Get(index);
|
||||
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "RoadStop index out of range");
|
||||
|
||||
case REF_ENGINE_RENEWS:
|
||||
if (_EngineRenew_pool.AddBlockIfNeeded(index)) return GetEngineRenew(index);
|
||||
if (_EngineRenew_pool.AddBlockIfNeeded(index)) return EngineRenew::Get(index);
|
||||
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "EngineRenew index out of range");
|
||||
|
||||
case REF_CARGO_PACKET:
|
||||
if (_CargoPacket_pool.AddBlockIfNeeded(index)) return GetCargoPacket(index);
|
||||
if (_CargoPacket_pool.AddBlockIfNeeded(index)) return CargoPacket::Get(index);
|
||||
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "CargoPacket index out of range");
|
||||
|
||||
case REF_VEHICLE_OLD:
|
||||
@@ -1469,7 +1469,7 @@ static void *IntToReference(uint index, SLRefType rt)
|
||||
index++;
|
||||
if (index == INVALID_VEHICLE) return NULL;
|
||||
|
||||
if (_Vehicle_pool.AddBlockIfNeeded(index)) return GetVehicle(index);
|
||||
if (_Vehicle_pool.AddBlockIfNeeded(index)) return Vehicle::Get(index);
|
||||
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Vehicle index out of range");
|
||||
|
||||
default: NOT_REACHED();
|
||||
|
@@ -225,7 +225,7 @@ static void CheckValidVehicles()
|
||||
case VEH_ROAD:
|
||||
case VEH_SHIP:
|
||||
case VEH_AIRCRAFT:
|
||||
if (v->engine_type >= total_engines || v->type != GetEngine(v->engine_type)->type) {
|
||||
if (v->engine_type >= total_engines || v->type != Engine::Get(v->engine_type)->type) {
|
||||
v->engine_type = first_engine[v->type];
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user