Debug: Show all town persistent storage registers, not just the caller GRFID
This commit is contained in:
@@ -200,6 +200,11 @@ public:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual std::vector<uint32> GetPSAGRFIDs(uint index) const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
virtual void ExtraInfo(uint index, std::function<void(const char *)> print) const {}
|
virtual void ExtraInfo(uint index, std::function<void(const char *)> print) const {}
|
||||||
virtual bool ShowExtraInfoOnly(uint index) const { return false; };
|
virtual bool ShowExtraInfoOnly(uint index) const { return false; };
|
||||||
|
|
||||||
@@ -508,25 +513,28 @@ struct NewGRFInspectWindow : Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint psa_size = nih->GetPSASize(index, this->caller_grfid);
|
std::vector<uint32> psa_grfids = nih->GetPSAGRFIDs(index);
|
||||||
const int32 *psa = nih->GetPSAFirstPosition(index, this->caller_grfid);
|
for (const uint32 grfid : psa_grfids) {
|
||||||
if (psa_size != 0 && psa != nullptr) {
|
uint psa_size = nih->GetPSASize(index, grfid);
|
||||||
if (nih->PSAWithParameter()) {
|
const int32 *psa = nih->GetPSAFirstPosition(index, grfid);
|
||||||
this->DrawString(r, i++, "Persistent storage [%08X]:", BSWAP32(this->caller_grfid));
|
if (psa_size != 0 && psa != nullptr) {
|
||||||
} else {
|
if (nih->PSAWithParameter()) {
|
||||||
this->DrawString(r, i++, "Persistent storage:");
|
this->DrawString(r, i++, "Persistent storage [%08X]:", BSWAP32(grfid));
|
||||||
}
|
} else {
|
||||||
assert(psa_size % 4 == 0);
|
this->DrawString(r, i++, "Persistent storage:");
|
||||||
uint last_non_blank = 0;
|
}
|
||||||
for (uint j = 0; j < psa_size; j++) {
|
assert(psa_size % 4 == 0);
|
||||||
if (psa[j] != 0) last_non_blank = j;
|
uint last_non_blank = 0;
|
||||||
}
|
for (uint j = 0; j < psa_size; j++) {
|
||||||
const uint psa_limit = (last_non_blank + 3) & ~3;
|
if (psa[j] != 0) last_non_blank = j;
|
||||||
for (uint j = 0; j < psa_limit; j += 4, psa += 4) {
|
}
|
||||||
this->DrawString(r, i++, " %i: %i %i %i %i", j, psa[0], psa[1], psa[2], psa[3]);
|
const uint psa_limit = (last_non_blank + 3) & ~3;
|
||||||
}
|
for (uint j = 0; j < psa_limit; j += 4, psa += 4) {
|
||||||
if (last_non_blank != psa_size) {
|
this->DrawString(r, i++, " %i: %i %i %i %i", j, psa[0], psa[1], psa[2], psa[3]);
|
||||||
this->DrawString(r, i++, " %i to %i are all 0", psa_limit, psa_size - 1);
|
}
|
||||||
|
if (last_non_blank != psa_size) {
|
||||||
|
this->DrawString(r, i++, " %i to %i are all 0", psa_limit, psa_size - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -543,6 +543,11 @@ class NIHIndustry : public NIHelper {
|
|||||||
return (int32 *)(&i->psa->storage);
|
return (int32 *)(&i->psa->storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<uint32> GetPSAGRFIDs(uint index) const override
|
||||||
|
{
|
||||||
|
return { 0 };
|
||||||
|
}
|
||||||
|
|
||||||
void ExtraInfo(uint index, std::function<void(const char *)> print) const override
|
void ExtraInfo(uint index, std::function<void(const char *)> print) const override
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
@@ -866,6 +871,17 @@ class NIHTown : public NIHelper {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual std::vector<uint32> GetPSAGRFIDs(uint index) const
|
||||||
|
{
|
||||||
|
Town *t = Town::Get(index);
|
||||||
|
|
||||||
|
std::vector<uint32> output;
|
||||||
|
for (const auto &iter : t->psa_list) {
|
||||||
|
output.push_back(iter->grfid);
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
void ExtraInfo(uint index, std::function<void(const char *)> print) const override
|
void ExtraInfo(uint index, std::function<void(const char *)> print) const override
|
||||||
{
|
{
|
||||||
const Town *t = Town::Get(index);
|
const Town *t = Town::Get(index);
|
||||||
|
Reference in New Issue
Block a user