summaryrefslogtreecommitdiff
path: root/library/Core.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-04-10 12:11:00 +0400
committerAlexander Gavrilov2012-04-10 12:11:00 +0400
commit249be0c1a0e267e806a8b0b1342f1f58f53e44fd (patch)
treeb29430c00d5d1ddba5621940cb9cadc817fc5f81 /library/Core.cpp
parent93c795cfc3eebf60157cc56e5aa38c521a60b0b3 (diff)
downloaddfhack-249be0c1a0e267e806a8b0b1342f1f58f53e44fd.tar.gz
dfhack-249be0c1a0e267e806a8b0b1342f1f58f53e44fd.tar.bz2
dfhack-249be0c1a0e267e806a8b0b1342f1f58f53e44fd.tar.xz
Change SC_MAP_LOADED handling: only NULL/not NULL change is meaningful.
Diffstat (limited to 'library/Core.cpp')
-rw-r--r--library/Core.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/library/Core.cpp b/library/Core.cpp
index b3c91034..a752ae62 100644
--- a/library/Core.cpp
+++ b/library/Core.cpp
@@ -893,26 +893,31 @@ int Core::Update()
if (new_wdata != last_world_data_ptr)
{
// we check for map change too
- bool mapchange = new_mapdata != last_local_map_ptr;
+ bool had_map = isMapLoaded();
last_world_data_ptr = new_wdata;
last_local_map_ptr = new_mapdata;
getWorld()->ClearPersistentCache();
// and if the world is going away, we report the map change first
- if(!new_wdata && mapchange)
- plug_mgr->OnStateChange(out, new_mapdata ? SC_MAP_LOADED : SC_MAP_UNLOADED);
+ if(had_map)
+ plug_mgr->OnStateChange(out, SC_MAP_UNLOADED);
// and if the world is appearing, we report map change after that
plug_mgr->OnStateChange(out, new_wdata ? SC_WORLD_LOADED : SC_WORLD_UNLOADED);
- if(new_wdata && mapchange)
- plug_mgr->OnStateChange(out, new_mapdata ? SC_MAP_LOADED : SC_MAP_UNLOADED);
+ if(isMapLoaded())
+ plug_mgr->OnStateChange(out, SC_MAP_LOADED);
}
// otherwise just check for map change...
else if (new_mapdata != last_local_map_ptr)
{
+ bool had_map = isMapLoaded();
last_local_map_ptr = new_mapdata;
- getWorld()->ClearPersistentCache();
- plug_mgr->OnStateChange(out, new_mapdata ? SC_MAP_LOADED : SC_MAP_UNLOADED);
+
+ if (isMapLoaded() != had_map)
+ {
+ getWorld()->ClearPersistentCache();
+ plug_mgr->OnStateChange(out, new_mapdata ? SC_MAP_LOADED : SC_MAP_UNLOADED);
+ }
}
// detect if the viewscreen changed