MCPcopy Create free account
hub / github.com/DFHack/dfhack / apply_hooks

Function apply_hooks

plugins/stockflow.cpp:280–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278
279
280static bool apply_hooks(color_ostream &out, bool enabling) {
281 if (enabling && !gps) {
282 out.printerr("Stockflow needs graphics.\n");
283 return false;
284 }
285
286 if (!INTERPOSE_HOOK(stockflow_hook, feed).apply(enabling) || !INTERPOSE_HOOK(stockflow_hook, render).apply(enabling)) {
287 out.printerr("Could not {} stockflow hooks!\n", enabling? "insert": "remove");
288 return false;
289 }
290
291 if (!helper.reset(out, enabling && Maps::IsValid())) {
292 out.printerr("Could not reset stockflow world data!\n");
293 return false;
294 }
295
296 return true;
297}
298
299static command_result stockflow_cmd(color_ostream &out, vector <string> & parameters) {
300 bool desired = enabled;

Callers 3

stockflow_cmdFunction · 0.85

Calls 2

applyMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected