| 343 | |
| 344 | |
| 345 | DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) { |
| 346 | if (event == DFHack::SC_MAP_LOADED) { |
| 347 | if (!helper.reset(out, enabled)) { |
| 348 | out.printerr("Could not load stockflow world data!\n"); |
| 349 | return CR_FAILURE; |
| 350 | } |
| 351 | } else if (event == DFHack::SC_MAP_UNLOADED) { |
| 352 | if (!helper.reset(out, false)) { |
| 353 | out.printerr("Could not unload stockflow world data!\n"); |
| 354 | return CR_FAILURE; |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | return CR_OK; |
| 359 | } |
| 360 | |
| 361 | DFhackCExport command_result plugin_enable(color_ostream& out, bool enable) { |
| 362 | /* Accept the "enable stockflow"/"disable stockflow" syntax, where available. */ |