Merge branch 'template_train_replacement' into template_train_replacement-sx
# Conflicts: # projects/openttd_vs100.vcxproj # projects/openttd_vs100.vcxproj.filters # projects/openttd_vs140.vcxproj # projects/openttd_vs140.vcxproj.filters # projects/openttd_vs80.vcproj # projects/openttd_vs90.vcproj # source.list
This commit is contained in:
@@ -44,6 +44,8 @@
|
||||
#include "../fios.h"
|
||||
#include "../error.h"
|
||||
|
||||
#include "../tbtr_template_vehicle.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "saveload_internal.h"
|
||||
@@ -454,6 +456,8 @@ extern const ChunkHandler _linkgraph_chunk_handlers[];
|
||||
extern const ChunkHandler _airport_chunk_handlers[];
|
||||
extern const ChunkHandler _object_chunk_handlers[];
|
||||
extern const ChunkHandler _persistent_storage_chunk_handlers[];
|
||||
extern const ChunkHandler _template_replacement_chunk_handlers[];
|
||||
extern const ChunkHandler _template_vehicle_chunk_handlers[];
|
||||
|
||||
/** Array of all chunks in a savegame, \c NULL terminated. */
|
||||
static const ChunkHandler * const _chunk_handlers[] = {
|
||||
@@ -491,6 +495,8 @@ static const ChunkHandler * const _chunk_handlers[] = {
|
||||
_airport_chunk_handlers,
|
||||
_object_chunk_handlers,
|
||||
_persistent_storage_chunk_handlers,
|
||||
_template_replacement_chunk_handlers,
|
||||
_template_vehicle_chunk_handlers,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -1265,6 +1271,7 @@ static size_t ReferenceToInt(const void *obj, SLRefType rt)
|
||||
switch (rt) {
|
||||
case REF_VEHICLE_OLD: // Old vehicles we save as new ones
|
||||
case REF_VEHICLE: return ((const Vehicle*)obj)->index + 1;
|
||||
case REF_TEMPLATE_VEHICLE: return ((const TemplateVehicle*)obj)->index + 1;
|
||||
case REF_STATION: return ((const Station*)obj)->index + 1;
|
||||
case REF_TOWN: return ((const Town*)obj)->index + 1;
|
||||
case REF_ORDER: return ((const Order*)obj)->index + 1;
|
||||
@@ -1324,6 +1331,10 @@ static void *IntToReference(size_t index, SLRefType rt)
|
||||
if (Vehicle::IsValidID(index)) return Vehicle::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid Vehicle");
|
||||
|
||||
case REF_TEMPLATE_VEHICLE:
|
||||
if (TemplateVehicle::IsValidID(index)) return TemplateVehicle::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid TemplateVehicle");
|
||||
|
||||
case REF_STATION:
|
||||
if (Station::IsValidID(index)) return Station::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid Station");
|
||||
|
Reference in New Issue
Block a user