Merge branch 'tracerestrict-sx' into jgrpp
Conflicts: src/saveload/extended_ver_sl.cpp
This commit is contained in:
@@ -46,7 +46,7 @@ std::vector<uint32> _sl_xv_discardable_chunk_ids; ///< list of chunks
|
||||
static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk
|
||||
|
||||
const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_TRACE_RESTRICT, XSCF_NULL, 2, 2, "tracerestrict", NULL, NULL, "TRRM,TRRP" },
|
||||
{ XSLFI_TRACE_RESTRICT, XSCF_NULL, 3, 3, "tracerestrict", NULL, NULL, "TRRM,TRRP" },
|
||||
{ XSLFI_PROG_SIGS, XSCF_NULL, 1, 1, "programmable_signals", NULL, NULL, "SPRG" },
|
||||
{ XSLFI_ADJACENT_CROSSINGS, XSCF_NULL, 1, 1, "adjacent_crossings", NULL, NULL, NULL },
|
||||
{ XSLFI_DEPARTURE_BOARDS, XSCF_IGNORABLE_UNKNOWN, 1, 1, "departure_boards", NULL, NULL, NULL },
|
||||
|
@@ -11,9 +11,10 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../tracerestrict.h"
|
||||
#include "../strings_func.h"
|
||||
#include "../string_func.h"
|
||||
#include "saveload.h"
|
||||
#include <vector>
|
||||
#include "saveload.h"
|
||||
|
||||
static const SaveLoad _trace_restrict_mapping_desc[] = {
|
||||
SLE_VAR(TraceRestrictMappingItem, program_id, SLE_UINT32),
|
||||
@@ -66,7 +67,20 @@ static void Load_TRRP()
|
||||
SlObject(&stub, _trace_restrict_program_stub_desc);
|
||||
prog->items.resize(stub.length);
|
||||
SlArray(&(prog->items[0]), stub.length, SLE_UINT32);
|
||||
assert(prog->Validate().Succeeded());
|
||||
CommandCost validation_result = prog->Validate();
|
||||
if (validation_result.Failed()) {
|
||||
char str[4096];
|
||||
char *strend = str + seprintf(str, lastof(str), "Trace restrict program %d: %s\nProgram dump:",
|
||||
index, GetStringPtr(validation_result.GetErrorMessage()));
|
||||
for (unsigned int i = 0; i < prog->items.size(); i++) {
|
||||
if (i % 3) {
|
||||
strend += seprintf(strend, lastof(str), " %08X", prog->items[i]);
|
||||
} else {
|
||||
strend += seprintf(strend, lastof(str), "\n%4u: %08X", i, prog->items[i]);
|
||||
}
|
||||
}
|
||||
SlErrorCorrupt(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user