fix-unit-occupancy, autogems: stop running while embarking

Related to #1286 fix
develop
lethosor 2018-06-21 16:16:16 -04:00
parent 46e31305a1
commit 9c7bd562d4
3 changed files with 4 additions and 2 deletions

@ -45,6 +45,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- Fixed many tools passing incorrect arguments to printf-style functions, including a few possible crashes (`changelayer`, `follow`, `forceequip`, `generated-creature-renamer`) - Fixed many tools passing incorrect arguments to printf-style functions, including a few possible crashes (`changelayer`, `follow`, `forceequip`, `generated-creature-renamer`)
- Fixed ``-g`` flag (GDB) in Linux ``dfhack`` script (particularly on x64) - Fixed ``-g`` flag (GDB) in Linux ``dfhack`` script (particularly on x64)
- `autochop`, `autodump`, `autogems`, `automelt`, `autotrade`, `buildingplan`, `dwarfmonitor`, `fix-unit-occupancy`, `fortplan`, `stockflow`: fix issues with periodic tasks not working for some time after save/load cycles - `autochop`, `autodump`, `autogems`, `automelt`, `autotrade`, `buildingplan`, `dwarfmonitor`, `fix-unit-occupancy`, `fortplan`, `stockflow`: fix issues with periodic tasks not working for some time after save/load cycles
- `autogems`, `fix-unit-occupancy`: stopped running when a fort isn't loaded (e.g. while embarking)
- `buildingplan`, `fortplan`: stop running before a world has fully loaded - `buildingplan`, `fortplan`: stop running before a world has fully loaded
- `autogems`: - `autogems`:
- stop running repeatedly when paused - stop running repeatedly when paused

@ -222,7 +222,8 @@ void create_jobs() {
} }
DFhackCExport command_result plugin_onupdate(color_ostream &out) { DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (running && !World::ReadPauseState() && (world->frame_counter % DELTA_TICKS == 0)) { if (running && !World::ReadPauseState() && Maps::IsValid() &&
(world->frame_counter % DELTA_TICKS == 0)) {
create_jobs(); create_jobs();
} }

@ -211,7 +211,7 @@ DFhackCExport command_result plugin_enable (color_ostream &out, bool enable)
DFhackCExport command_result plugin_onupdate (color_ostream &out) DFhackCExport command_result plugin_onupdate (color_ostream &out)
{ {
if (is_enabled && World::isFortressMode()) if (is_enabled && World::isFortressMode() && Maps::IsValid())
{ {
if (world->frame_counter % run_interval == 0 && !World::ReadPauseState()) if (world->frame_counter % run_interval == 0 && !World::ReadPauseState())
{ {