|
|
@ -337,6 +337,8 @@ static void FixOldStations()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static StringID *_old_vehicle_names = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
static void FixOldVehicles()
|
|
|
|
static void FixOldVehicles()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Check for shared orders, and link them correctly */
|
|
|
|
/* Check for shared orders, and link them correctly */
|
|
|
@ -345,6 +347,8 @@ static void FixOldVehicles()
|
|
|
|
FOR_ALL_VEHICLES(v) {
|
|
|
|
FOR_ALL_VEHICLES(v) {
|
|
|
|
Vehicle *u;
|
|
|
|
Vehicle *u;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
v->name = CopyFromOldName(_old_vehicle_names[v->index]);
|
|
|
|
|
|
|
|
|
|
|
|
/* We haven't used this bit for stations for ages */
|
|
|
|
/* We haven't used this bit for stations for ages */
|
|
|
|
if (v->type == VEH_ROAD &&
|
|
|
|
if (v->type == VEH_ROAD &&
|
|
|
|
v->u.road.state != RVSB_IN_DEPOT &&
|
|
|
|
v->u.road.state != RVSB_IN_DEPOT &&
|
|
|
@ -427,6 +431,8 @@ static void ReadTTDPatchFlags()
|
|
|
|
and 1 becomes 2. The rest of the values are okay */
|
|
|
|
and 1 becomes 2. The rest of the values are okay */
|
|
|
|
if (_old_vehicle_multiplier < 2) _old_vehicle_multiplier++;
|
|
|
|
if (_old_vehicle_multiplier < 2) _old_vehicle_multiplier++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_old_vehicle_names = MallocT<StringID>(_old_vehicle_multiplier * 850);
|
|
|
|
|
|
|
|
|
|
|
|
/* TTDPatch increases the Vehicle-part in the middle of the game,
|
|
|
|
/* TTDPatch increases the Vehicle-part in the middle of the game,
|
|
|
|
so if the multipler is anything else but 1, the assert fails..
|
|
|
|
so if the multipler is anything else but 1, the assert fails..
|
|
|
|
bump the assert value so it doesn't!
|
|
|
|
bump the assert value so it doesn't!
|
|
|
@ -1279,8 +1285,8 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
|
|
|
|
|
|
|
|
|
|
|
|
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() : GetVehicle(_old_next_ptr);
|
|
|
|
|
|
|
|
|
|
|
|
_old_string_id = RemapOldStringID(_old_string_id);
|
|
|
|
_old_vehicle_names[_current_vehicle_id] = RemapOldStringID(_old_string_id);
|
|
|
|
v->name = CopyFromOldName(_old_string_id);
|
|
|
|
v->name = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/* Vehicle-subtype is different in TTD(Patch) */
|
|
|
|
/* Vehicle-subtype is different in TTD(Patch) */
|
|
|
|
if (v->type == VEH_EFFECT) v->subtype = v->subtype >> 1;
|
|
|
|
if (v->type == VEH_EFFECT) v->subtype = v->subtype >> 1;
|
|
|
@ -1626,9 +1632,11 @@ static bool LoadOldMain(LoadgameState *ls)
|
|
|
|
DEBUG(oldloader, 3, "Reading main chunk...");
|
|
|
|
DEBUG(oldloader, 3, "Reading main chunk...");
|
|
|
|
/* Load the biggest chunk */
|
|
|
|
/* Load the biggest chunk */
|
|
|
|
_old_map3 = MallocT<byte>(OLD_MAP_SIZE * 2);
|
|
|
|
_old_map3 = MallocT<byte>(OLD_MAP_SIZE * 2);
|
|
|
|
|
|
|
|
_old_vehicle_names = NULL;
|
|
|
|
if (!LoadChunk(ls, NULL, main_chunk)) {
|
|
|
|
if (!LoadChunk(ls, NULL, main_chunk)) {
|
|
|
|
DEBUG(oldloader, 0, "Loading failed");
|
|
|
|
DEBUG(oldloader, 0, "Loading failed");
|
|
|
|
free(_old_map3);
|
|
|
|
free(_old_map3);
|
|
|
|
|
|
|
|
free(_old_vehicle_names);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DEBUG(oldloader, 3, "Done, converting game data...");
|
|
|
|
DEBUG(oldloader, 3, "Done, converting game data...");
|
|
|
@ -1702,6 +1710,7 @@ static bool LoadOldMain(LoadgameState *ls)
|
|
|
|
DEBUG(oldloader, 1, "TTD(Patch) savegame successfully converted");
|
|
|
|
DEBUG(oldloader, 1, "TTD(Patch) savegame successfully converted");
|
|
|
|
|
|
|
|
|
|
|
|
free(_old_map3);
|
|
|
|
free(_old_map3);
|
|
|
|
|
|
|
|
free(_old_vehicle_names);
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|