mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-01 00:07:02 +00:00
clear cgis, fixed missing textures
This commit is contained in:
parent
adf0f36ea1
commit
9a1858e2f9
@ -964,6 +964,7 @@ void geometry_information::make_floor_textures_here() {
|
||||
IMAGESAVE(sdark, "texture-test.png");
|
||||
*/
|
||||
rb.reset();
|
||||
last_texture_step = vid.texture_step;
|
||||
}
|
||||
|
||||
void make_floor_textures() {
|
||||
|
31
geometry.cpp
31
geometry.cpp
@ -432,6 +432,8 @@ void switch_always3() {
|
||||
geometry_information *cgip;
|
||||
map<string, geometry_information> cgis;
|
||||
|
||||
int last_texture_step;
|
||||
|
||||
void check_cgi() {
|
||||
string s;
|
||||
auto V = [&] (string a, string b) { s += a; s += ": "; s += b; s += "; "; };
|
||||
@ -473,6 +475,35 @@ void check_cgi() {
|
||||
V("LQ", its(vid.linequality));
|
||||
|
||||
cgip = &cgis[s];
|
||||
|
||||
if(isize(cgis) > 2) {
|
||||
cgi.timestamp = ticks;
|
||||
vector<pair<int, string>> timestamps;
|
||||
for(auto& t: cgis) timestamps.emplace_back(-t.second.timestamp, t.first);
|
||||
sort(timestamps.begin(), timestamps.end());
|
||||
while(isize(timestamps) > 2) {
|
||||
println(hlog, "erasing geometry ", timestamps.back().second);
|
||||
cgis.erase(timestamps.back().second);
|
||||
timestamps.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
if(floor_textures && last_texture_step != vid.texture_step) {
|
||||
println(hlog, "changed ", last_texture_step, " to ", vid.texture_step);
|
||||
delete floor_textures;
|
||||
floor_textures = NULL;
|
||||
}
|
||||
|
||||
if(!floor_textures && DIM == 3 && (cgi.state & 2))
|
||||
make_floor_textures();
|
||||
|
||||
}
|
||||
|
||||
void clear_cgis() {
|
||||
printf("clear_cgis\n");
|
||||
for(auto& p: cgis) if(&p.second != &cgi) { cgis.erase(p.first); return; }
|
||||
}
|
||||
|
||||
auto ah_clear_geo = addHook(hooks_clear_cache, 0, clear_cgis);
|
||||
|
||||
}
|
||||
|
1
hyper.h
1
hyper.h
@ -4605,6 +4605,7 @@ hpcshape
|
||||
void require_basics() { if(state & 1) return; state |= 1; prepare_basics(); }
|
||||
void require_shapes() { if(state & 2) return; state |= 2; prepare_shapes(); }
|
||||
void require_usershapes() { if(usershape_state == usershape_changes) return; usershape_state = usershape_changes; prepare_usershapes(); }
|
||||
int timestamp;
|
||||
};
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user