1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 06:27:17 +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];
cgi.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(arcm::alt_cgip[0]) arcm::alt_cgip[0]->timestamp = ntimestamp;
if(arcm::alt_cgip[1]) arcm::alt_cgip[1]->timestamp = ntimestamp;
#endif
int limit = 4;
for(auto& t: cgis) if(t.second.use_count) limit++;
int limit = 3;
for(auto& t: cgis) if(t.second.use_count || t.second.timestamp == ntimestamp) limit++;
if(isize(cgis) > limit) {
vector<pair<int, string>> timestamps;
for(auto& t: cgis) if(!t.second.use_count) timestamps.emplace_back(-t.second.timestamp, t.first);
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));
cgis.erase(timestamps.back().second);
timestamps.pop_back();