summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-16 23:34:14 +0000
committersmatz <smatz@openttd.org>2009-05-16 23:34:14 +0000
commit6221d74644922ea4bbba3ed9cd8bbec42398f77b (patch)
tree0069bbd6bb7525754c5d9353132f5dc64a0996cc /src/saveload
parent814f153b5a98e0030cbd221e6a89e083ce62bb1d (diff)
downloadopenttd-6221d74644922ea4bbba3ed9cd8bbec42398f77b.tar.xz
(svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp10
-rw-r--r--src/saveload/oldloader_sl.cpp20
-rw-r--r--src/saveload/order_sl.cpp4
-rw-r--r--src/saveload/saveload.cpp18
-rw-r--r--src/saveload/vehicle_sl.cpp2
5 files changed, 27 insertions, 27 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index cc982485e..b33b7e14a 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -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);
}
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index 812427b2c..b668828c0 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -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);
diff --git a/src/saveload/order_sl.cpp b/src/saveload/order_sl.cpp
index dc583a371..c7c66e130 100644
--- a/src/saveload/order_sl.cpp
+++ b/src/saveload/order_sl.cpp
@@ -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;
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index b74c2af40..89731bf9c 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -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();
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index a05987a27..695b2c831 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -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;