DFHack/dfhack — pull request #439 by lethosor (2014-12-07 02:15:57+00:00)
Title: Allow plugins to easily specify required globals

This allows `using df::global::*`-type lines and checks for globals in plugin_init to be replaced by a single macro, REQUIRE_GLOBAL. DFHack will refuse to load a plugin if any of its required globals are null, before calling plugin_init. Many plugins currently fail to check for globals in plugin_init, leading to crashes (for example, burrows).
Note that REQUIRED_GLOBAL must be used after DFHACK_PLUGIN, as it appends to a vector defined there (I've updated the skeleton plugin accordingly). The technique it uses is similar to [static_add_to_map](https://github.com/DFHack/dfhack/blob/a273327c6a380d742a76657fa566ce34dc067919/library/include/MiscUtils.h#L300), but feel free to suggest a better way to do this.