Attempt to fix minimap crash
This commit is contained in:
@@ -192,7 +192,7 @@ void load_replay_commands(const std::string &filename, std::function<void(const
|
||||
fk.cp.data = bs.ReadData();
|
||||
fk.cp.callback = nullptr;
|
||||
_fake_commands.push(fk);
|
||||
error_func(fmt::format("Command {}({}) company={} client={} tile={}", GetCommandName(fk.cp.cmd), fk.cp.cmd, fk.cp.company, fk.client_id));
|
||||
error_func(fmt::format("Command {}({}) company={} client={}", GetCommandName(fk.cp.cmd), fk.cp.cmd, fk.cp.company, fk.client_id));
|
||||
}
|
||||
}
|
||||
catch (BitIStreamUnexpectedEnd &) {
|
||||
|
||||
@@ -255,20 +255,28 @@ MinimapIndustryKdtreeEntry get_industry_entry(const Industry *ind) {
|
||||
}
|
||||
|
||||
void minimap_add_industry(const Industry *ind) {
|
||||
auto x = get_industry_entry(ind);
|
||||
//fmt::print("ADD {}: {},{} {}\n", ind->index, x.mx, x.my, is_cached_industry(ind));
|
||||
if (!is_cached_industry(ind)) return;
|
||||
_minimap_industry_idx.Insert(get_industry_entry(ind));
|
||||
}
|
||||
|
||||
void minimap_remove_industry(const Industry *ind) {
|
||||
auto x = get_industry_entry(ind);
|
||||
//fmt::print("REMOVE {}: {},{} {}\n", ind->index, x.mx, x.my, is_cached_industry(ind));
|
||||
if (!is_cached_industry(ind)) return;
|
||||
_minimap_industry_idx.Remove(get_industry_entry(ind));
|
||||
}
|
||||
|
||||
void minimap_init_industries() {
|
||||
_max_industry_outputs = 0;
|
||||
for (auto i : Industry::Iterate()) {
|
||||
minimap_add_industry(i);
|
||||
std::vector<MinimapIndustryKdtreeEntry> entries;
|
||||
for (auto ind : Industry::Iterate()) {
|
||||
if (is_cached_industry(ind)) entries.push_back(get_industry_entry(ind));
|
||||
auto x = get_industry_entry(ind);
|
||||
//fmt::print("INIT {}: {},{} {}\n", ind->index, x.mx, x.my, is_cached_industry(ind));
|
||||
}
|
||||
_minimap_industry_idx.Build(entries.begin(), entries.end());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -415,7 +415,7 @@ protected:
|
||||
return {};
|
||||
}
|
||||
|
||||
Debug(misc, 0, "{}/{} {} {} company={} tile={}", _date, _date_fract, _random.state[0], GetCommandName(Tcmd), (int)_current_company, tile);
|
||||
// Debug(misc, 0, "{}/{} {} {} company={} tile={}", _date, _date_fract, _random.state[0], GetCommandName(Tcmd), (int)_current_company, tile);
|
||||
if (desync_log) LogCommandExecution(Tcmd, err_message, tile, EndianBufferWriter<CommandDataBuffer>::FromValue(args), false);
|
||||
|
||||
/* Actually try and execute the command. */
|
||||
|
||||
Reference in New Issue
Block a user