Add town cargo production/acceptance cache to town GRF debug window

This commit is contained in:
Jonathan G Rennison 2019-05-26 21:03:29 +01:00
parent 8eeae134db
commit 8a3dcfb1c5

View File

@ -571,6 +571,28 @@ class NIHTown : public NIHelper {
return nullptr;
}
void ExtraInfo(uint index, std::function<void(const char *)> print) const override
{
const Town *t = Town::Get(index);
char buffer[1024];
print("Debug Info:");
seprintf(buffer, lastof(buffer), " Index: %u", index);
print(buffer);
char *b = buffer;
b += seprintf(b, lastof(buffer), " cargo_produced: ");
SetDParam(0, t->cargo_produced);
b = GetString(b, STR_JUST_CARGO_LIST, lastof(buffer));
print(buffer);
b = buffer;
b += seprintf(b, lastof(buffer), " cargo_accepted_total: ");
SetDParam(0, t->cargo_accepted_total);
b = GetString(b, STR_JUST_CARGO_LIST, lastof(buffer));
print(buffer);
}
};
static const NIFeature _nif_town = {