Merge branch 'master' into day_length
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "../fios.h"
|
||||
#include "../gamelog_internal.h"
|
||||
#include "../network/network.h"
|
||||
#include "../network/network_func.h"
|
||||
#include "../gfxinit.h"
|
||||
#include "../viewport_func.h"
|
||||
#include "../industry.h"
|
||||
@@ -2951,18 +2952,20 @@ bool AfterLoadGame()
|
||||
}
|
||||
|
||||
/*
|
||||
* Only keep order-backups for network clients.
|
||||
* Only keep order-backups for network clients (and when replaying).
|
||||
* If we are a network server or not networking, then we just loaded a previously
|
||||
* saved-by-server savegame. There are no clients with a backup, so clear it.
|
||||
* Furthermore before savegame version 192 the actual content was always corrupt.
|
||||
*/
|
||||
if (!_networking || _network_server || IsSavegameVersionBefore(192)) {
|
||||
#ifndef DEBUG_DUMP_COMMANDS
|
||||
/* Note: We cannot use CleanPool since that skips part of the destructor
|
||||
* and then leaks un-reachable Orders in the order pool. */
|
||||
OrderBackup *ob;
|
||||
FOR_ALL_ORDER_BACKUPS(ob) {
|
||||
delete ob;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@@ -160,14 +160,14 @@ static void Save_ITBL()
|
||||
/** Load industry-type build data. */
|
||||
static void Load_ITBL()
|
||||
{
|
||||
int index;
|
||||
for (int i = 0; i < NUM_INDUSTRYTYPES; i++) {
|
||||
index = SlIterateArray();
|
||||
assert(index == i);
|
||||
SlObject(_industry_builder.builddata + i, _industrytype_builder_desc);
|
||||
for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) {
|
||||
_industry_builder.builddata[it].Reset();
|
||||
}
|
||||
int index;
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
if ((uint)index >= NUM_INDUSTRYTYPES) SlErrorCorrupt("Too many industry builder datas");
|
||||
SlObject(_industry_builder.builddata + index, _industrytype_builder_desc);
|
||||
}
|
||||
index = SlIterateArray();
|
||||
assert(index == -1);
|
||||
}
|
||||
|
||||
extern const ChunkHandler _industry_chunk_handlers[] = {
|
||||
|
@@ -51,7 +51,7 @@ void Load_NewGRFMapping(OverrideManagerBase &mapping)
|
||||
|
||||
int index;
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
if ((uint)index >= max_id) break;
|
||||
if ((uint)index >= max_id) SlErrorCorrupt("Too many NewGRF entity mappings");
|
||||
SlObject(&mapping.mapping_ID[index], _newgrf_mapping_desc);
|
||||
}
|
||||
}
|
||||
|
@@ -1667,9 +1667,11 @@ static void SlLoadChunk(const ChunkHandler *ch)
|
||||
case CH_ARRAY:
|
||||
_sl.array_index = 0;
|
||||
ch->load_proc();
|
||||
if (_next_offs != 0) SlErrorCorrupt("Invalid array length");
|
||||
break;
|
||||
case CH_SPARSE_ARRAY:
|
||||
ch->load_proc();
|
||||
if (_next_offs != 0) SlErrorCorrupt("Invalid array length");
|
||||
break;
|
||||
default:
|
||||
if ((m & 0xF) == CH_RIFF) {
|
||||
|
Reference in New Issue
Block a user