1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-17 10:44:48 +00:00

ray:: fixed crashes when rmap is destroyed while in use

This commit is contained in:
Zeno Rogue 2021-05-12 20:19:45 +02:00
parent c6beebec79
commit 891f163954

View File

@ -1676,9 +1676,11 @@ struct raycast_map {
};
unique_ptr<raycast_map> rmap;
bool reset_rmap = false;
EX void reset_raycaster() {
our_raycaster = nullptr; rmap = nullptr;
our_raycaster = nullptr;
reset_rmap = true;
rots::saved_matrices_ray = {};
}
@ -1851,6 +1853,8 @@ EX void cast() {
if(o->uFogColor != -1)
glUniform4f(o->uFogColor, cols[0], cols[1], cols[2], cols[3]);
if(reset_rmap) rmap = nullptr, reset_rmap = false;
if(!rmap) rmap = (unique_ptr<raycast_map>) new raycast_map;
if(rmap->need_to_create(cs)) {