1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 13:07:16 +00:00

fixup to the fake underlying map being erased while in fake+product

This commit is contained in:
Zeno Rogue 2024-06-18 18:43:12 +02:00
parent 83205b042b
commit d987895171

View File

@ -1362,19 +1362,19 @@ EX void check_cgi() {
cgip = &cgis[s]; cgip = &cgis[s];
cgi.timestamp = ++ntimestamp; cgi.timestamp = ++ntimestamp;
if(mhybrid) hybrid::underlying_cgip->timestamp = ntimestamp; if(mhybrid) hybrid::underlying_cgip->timestamp = ntimestamp;
if(fake::in()) fake::underlying_cgip->timestamp = ntimestamp; if(fake::in() || (mhybrid && PIU(fake::in()))) fake::underlying_cgip->timestamp = ntimestamp;
#if CAP_ARCM #if CAP_ARCM
if(arcm::alt_cgip[0]) arcm::alt_cgip[0]->timestamp = ntimestamp; if(arcm::alt_cgip[0]) arcm::alt_cgip[0]->timestamp = ntimestamp;
if(arcm::alt_cgip[1]) arcm::alt_cgip[1]->timestamp = ntimestamp; if(arcm::alt_cgip[1]) arcm::alt_cgip[1]->timestamp = ntimestamp;
#endif #endif
int limit = 4; int limit = 3;
for(auto& t: cgis) if(t.second.use_count) limit++; for(auto& t: cgis) if(t.second.use_count || t.second.timestamp == ntimestamp) limit++;
if(isize(cgis) > limit) { if(isize(cgis) > limit) {
vector<pair<int, string>> timestamps; vector<pair<int, string>> timestamps;
for(auto& t: cgis) if(!t.second.use_count) timestamps.emplace_back(-t.second.timestamp, t.first); for(auto& t: cgis) if(!t.second.use_count) timestamps.emplace_back(-t.second.timestamp, t.first);
sort(timestamps.begin(), timestamps.end()); sort(timestamps.begin(), timestamps.end());
while(isize(timestamps) > 4) { while(isize(timestamps) > limit && timestamps.back().first != -ntimestamp) {
DEBB(DF_GEOM, ("erasing geometry ", timestamps.back().second)); DEBB(DF_GEOM, ("erasing geometry ", timestamps.back().second));
cgis.erase(timestamps.back().second); cgis.erase(timestamps.back().second);
timestamps.pop_back(); timestamps.pop_back();