New plugin interface

develop
Petr Mrázek 2012-02-21 18:19:17 +01:00
parent 0b9e849096
commit 2cd2ee9b0c
58 changed files with 151 additions and 306 deletions

@ -26,11 +26,14 @@ endif()
# set up versioning.
set(DF_VERSION_MAJOR "0")
set(DF_VERSION_MINOR "31")
set(DF_VERSION_PATCH "25")
set(DF_VERSION_MINOR "34")
set(DF_VERSION_PATCH "02")
set(DF_VERSION "${DF_VERSION_MAJOR}.${DF_VERSION_MINOR}.${DF_VERSION_PATCH}")
set(DFHACK_RELEASE "9b")
set(DFHACK_RELEASE "1")
set(DFHACK_VERSION "${DF_VERSION_MAJOR}.${DF_VERSION_MINOR}.${DF_VERSION_PATCH}-r${DFHACK_RELEASE}")
add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}")
## where to install things (after the build is done, classic 'make install' or package structure)
# the dfhack libraries will be installed here:
@ -99,5 +102,5 @@ ELSEIF(WIN32)
SET(CPACK_GENERATOR "ZIP")
ENDIF()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_PACKAGE_FILE_NAME "dfhack-${DF_VERSION}-r${DFHACK_RELEASE}-${CMAKE_SYSTEM_NAME}")
set(CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${CMAKE_SYSTEM_NAME}")
INCLUDE(CPack)

@ -385,7 +385,8 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
for (size_t j = 0; j < plug->size();j++)
{
const PluginCommand & pcmd = (plug->operator[](j));
out.insert({pcmd.isHotkeyCommand(),pcmd.name,pcmd.description});
sortable so = {pcmd.isHotkeyCommand(),pcmd.name,pcmd.description};
out.insert(so);
}
}
for(auto iter = out.begin();iter != out.end();iter++)

@ -46,7 +46,7 @@ namespace DFHack
}
void * LookupPlugin (DFLibrary * plugin ,const char * function)
{
return (DFLibrary *) GetProcAddress((HMODULE)plugin, function);
return (void *) GetProcAddress((HMODULE)plugin, function);
}
void ClosePlugin (DFLibrary * plugin)
{

@ -120,6 +120,14 @@ struct Plugin::RefLock
mutex * mut;
int refcount;
};
struct Plugin::RefAutolock
{
RefLock * lock;
RefAutolock(RefLock * lck):lock(lck){ lock->lock(); };
~RefAutolock(){ lock->unlock(); };
};
Plugin::Plugin(Core * core, const std::string & filepath, const std::string & _filename, PluginManager * pm)
{
filename = filepath;
@ -154,15 +162,13 @@ Plugin::~Plugin()
bool Plugin::load()
{
access->lock();
RefAutolock lock(access);
if(state == PS_BROKEN)
{
access->unlock();
return false;
}
else if(state == PS_LOADED)
{
access->unlock();
return true;
}
Core & c = Core::getInstance();
@ -172,16 +178,23 @@ bool Plugin::load()
{
con.printerr("Can't load plugin %s\n", filename.c_str());
state = PS_BROKEN;
access->unlock();
return false;
}
const char * (*_PlugName)() =(const char * (*)()) LookupPlugin(plug, "plugin_name");
if(!_PlugName)
const char ** plug_name =(const char ** ) LookupPlugin(plug, "name");
if(!plug_name)
{
con.printerr("Plugin %s has no name.\n", filename.c_str());
ClosePlugin(plug);
state = PS_BROKEN;
access->unlock();
return false;
}
const char ** plug_version =(const char ** ) LookupPlugin(plug, "version");
if(!plug_version || strcmp(DFHACK_VERSION, *plug_version) != 0)
{
con.printerr("Plugin sx was not built for this version of DFHack.\n"
"Plugin: %s, DFHack: %s\n", *plug_name, *plug_version, DFHACK_VERSION);
ClosePlugin(plug);
state = PS_BROKEN;
return false;
}
plugin_init = (command_result (*)(Core *, std::vector <PluginCommand> &)) LookupPlugin(plug, "plugin_init");
@ -190,20 +203,18 @@ bool Plugin::load()
con.printerr("Plugin %s has no init function.\n", filename.c_str());
ClosePlugin(plug);
state = PS_BROKEN;
access->unlock();
return false;
}
plugin_status = (command_result (*)(Core *, std::string &)) LookupPlugin(plug, "plugin_status");
plugin_onupdate = (command_result (*)(Core *)) LookupPlugin(plug, "plugin_onupdate");
plugin_shutdown = (command_result (*)(Core *)) LookupPlugin(plug, "plugin_shutdown");
plugin_onstatechange = (command_result (*)(Core *, state_change_event)) LookupPlugin(plug, "plugin_onstatechange");
//name = _PlugName();
this->name = *plug_name;
plugin_lib = plug;
if(plugin_init(&c,commands) == CR_OK)
{
state = PS_LOADED;
parent->registerCommands(this);
access->unlock();
return true;
}
else
@ -211,10 +222,8 @@ bool Plugin::load()
con.printerr("Plugin %s has failed to initialize properly.\n", filename.c_str());
ClosePlugin(plugin_lib);
state = PS_BROKEN;
access->unlock();
return false;
}
// not reachable
}
bool Plugin::unload()

@ -102,6 +102,7 @@ namespace DFHack
class Plugin
{
struct RefLock;
struct RefAutolock;
enum plugin_state
{
PS_UNLOADED,
@ -185,5 +186,8 @@ namespace DFHack
DFHACK_EXPORT bool default_hotkey(Core *, df::viewscreen *);
DFHACK_EXPORT bool dwarfmode_hotkey(Core *, df::viewscreen *);
DFHACK_EXPORT bool cursor_hotkey(Core *, df::viewscreen *);
}
};
/// You have to have this in every plugin you write - just once. Ideally on top of the main file.
#define DFHACK_PLUGIN(plugin_name) DFhackCExport const char * version = DFHACK_VERSION;\
DFhackCExport const char * name = plugin_name;

@ -45,39 +45,43 @@ if (BUILD_DWARFEXPORT)
add_subdirectory (dwarfexport)
endif()
DFHACK_PLUGIN(reveal reveal.cpp)
DFHACK_PLUGIN(probe probe.cpp)
DFHACK_PLUGIN(drybuckets drybuckets.cpp)
DFHACK_PLUGIN(getplants getplants.cpp)
DFHACK_PLUGIN(plants plants.cpp)
DFHACK_PLUGIN(fastdwarf fastdwarf.cpp)
DFHACK_PLUGIN(prospector prospector.cpp)
DFHACK_PLUGIN(cleaners cleaners.cpp)
DFHACK_PLUGIN(weather weather.cpp)
DFHACK_PLUGIN(vdig vdig.cpp)
DFHACK_PLUGIN(colonies colonies.cpp)
DFHACK_PLUGIN(mode mode.cpp)
DFHACK_PLUGIN(liquids liquids.cpp)
DFHACK_PLUGIN(tiletypes tiletypes.cpp)
DFHACK_PLUGIN(tubefill tubefill.cpp)
DFHACK_PLUGIN(autodump autodump.cpp)
DFHACK_PLUGIN(cleanowned cleanowned.cpp)
DFHACK_PLUGIN(deramp deramp.cpp)
DFHACK_PLUGIN(flows flows.cpp)
DFHACK_PLUGIN(filltraffic filltraffic.cpp)
DFHACK_PLUGIN(seedwatch seedwatch.cpp)
DFHACK_PLUGIN(initflags initflags.cpp)
DFHACK_PLUGIN(stockpiles stockpiles.cpp)
DFHACK_PLUGIN(rename rename.cpp)
DFHACK_PLUGIN(fixwagons fixwagons.cpp)
DFHACK_PLUGIN(jobutils jobutils.cpp)
DFHACK_PLUGIN(regrass regrass.cpp)
DFHACK_PLUGIN(workflow workflow.cpp)
DFHACK_PLUGIN(showmood showmood.cpp)
DFHACK_PLUGIN(fixveins fixveins.cpp)
DFHACK_PLUGIN(fixpositions fixpositions.cpp)
DFHACK_PLUGIN(follow follow.cpp)
#DFHACK_PLUGIN(versionosd versionosd.cpp)
OPTION(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if (BUILD_SUPPORTED)
DFHACK_PLUGIN(reveal reveal.cpp)
DFHACK_PLUGIN(probe probe.cpp)
DFHACK_PLUGIN(drybuckets drybuckets.cpp)
DFHACK_PLUGIN(getplants getplants.cpp)
DFHACK_PLUGIN(plants plants.cpp)
DFHACK_PLUGIN(fastdwarf fastdwarf.cpp)
DFHACK_PLUGIN(prospector prospector.cpp)
DFHACK_PLUGIN(cleaners cleaners.cpp)
DFHACK_PLUGIN(weather weather.cpp)
DFHACK_PLUGIN(vdig vdig.cpp)
DFHACK_PLUGIN(colonies colonies.cpp)
DFHACK_PLUGIN(mode mode.cpp)
DFHACK_PLUGIN(liquids liquids.cpp)
DFHACK_PLUGIN(tiletypes tiletypes.cpp)
DFHACK_PLUGIN(tubefill tubefill.cpp)
DFHACK_PLUGIN(autodump autodump.cpp)
DFHACK_PLUGIN(cleanowned cleanowned.cpp)
DFHACK_PLUGIN(deramp deramp.cpp)
DFHACK_PLUGIN(flows flows.cpp)
DFHACK_PLUGIN(filltraffic filltraffic.cpp)
DFHACK_PLUGIN(seedwatch seedwatch.cpp)
DFHACK_PLUGIN(initflags initflags.cpp)
DFHACK_PLUGIN(stockpiles stockpiles.cpp)
DFHACK_PLUGIN(rename rename.cpp)
DFHACK_PLUGIN(fixwagons fixwagons.cpp)
DFHACK_PLUGIN(jobutils jobutils.cpp)
DFHACK_PLUGIN(regrass regrass.cpp)
DFHACK_PLUGIN(workflow workflow.cpp)
DFHACK_PLUGIN(showmood showmood.cpp)
DFHACK_PLUGIN(fixveins fixveins.cpp)
DFHACK_PLUGIN(fixpositions fixpositions.cpp)
DFHACK_PLUGIN(follow follow.cpp)
#DFHACK_PLUGIN(versionosd versionosd.cpp)
endif()
# this is the skeleton plugin. If you want to make your own, make a copy and then change it
OPTION(BUILD_SKELETON "Build the skeleton plugin." OFF)

@ -38,7 +38,6 @@ DFhackCExport const char * plugin_name ( void )
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
lua::state st=lua::glua::Get();
//maybe remake it to run automaticaly
lua::RegisterConsole(st,&c->con);

@ -32,18 +32,14 @@ using MapExtras::Block;
using MapExtras::MapCache;
using df::global::world;
DFHACK_PLUGIN("autodump");
command_result df_autodump(Core * c, vector <string> & parameters);
command_result df_autodump_destroy_here(Core * c, vector <string> & parameters);
command_result df_autodump_destroy_item(Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "autodump";
}
DFhackCExport command_result plugin_init ( Core * c, vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"autodump", "Teleport items marked for dumping to the cursor.",
df_autodump, false,

@ -22,6 +22,8 @@ using namespace df::enums;
using df::global::world;
using df::global::cursor;
DFHACK_PLUGIN("cleaners");
command_result cleanmap (Core * c, bool snow, bool mud)
{
// Invoked from clean(), already suspended
@ -186,14 +188,8 @@ command_result clean (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "cleaners";
}
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"clean","Removes contaminants from map tiles, items and creatures.",
clean, false,

@ -28,14 +28,10 @@ using df::global::world;
command_result df_cleanowned (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "cleanowned";
}
DFHACK_PLUGIN("cleanowned");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"cleanowned", "Confiscates and dumps garbage owned by dwarfs.",
df_cleanowned, false,

@ -14,14 +14,10 @@ using namespace DFHack::Simple;
command_result colonies (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "colonies";
}
DFHACK_PLUGIN("colonies");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"colonies", "List or change wild colonies (ants hills and such)",
colonies, false,

@ -17,6 +17,8 @@ using namespace df::enums;
using df::global::world;
DFHACK_PLUGIN("deramp");
command_result df_deramp (Core * c, vector <string> & parameters)
{
if (!parameters.empty())
@ -80,14 +82,8 @@ command_result df_deramp (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "deramp";
}
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"deramp", "De-ramp. All ramps marked for removal are replaced with floors.",
df_deramp, false,

@ -21,14 +21,10 @@ using namespace DFHack;
command_result readFlag (Core * c, vector <string> & parameters);
command_result writeFlag (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "buildprobe";
}
DFHACK_PLUGIN("buildprobe");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("bshow","Output building occupancy value",readFlag));
commands.push_back(PluginCommand("bset","Set building occupancy value",writeFlag));
return CR_OK;

@ -28,16 +28,12 @@ using namespace DFHack::Simple;
command_result catsplosion (Core * c, std::vector <std::string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "catsplosion";
}
DFHACK_PLUGIN("catsplosion");
// Mandatory init function. If you have some global state, create it here.
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
// Fill the command list with your commands.
commands.clear();
commands.push_back(PluginCommand(
"catsplosion", "Do nothing, look pretty.",
catsplosion, false,

@ -80,14 +80,10 @@ command_result df_frozenwater (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "frozen";
}
DFHACK_PLUGIN("frozen");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("frozenlava", "Changes all ice into frozen magma.", df_frozenlava));
commands.push_back(PluginCommand("frozenwater", "Changes all ice into frozen water.", df_frozenwater));
return CR_OK;

@ -155,7 +155,6 @@ DFhackCExport const char * plugin_name ( void )
DFhackCExport command_result plugin_init ( Core * c,
std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("dumpitems",
"Dump items\
\n Options:\

@ -34,14 +34,10 @@ command_result trackpos (Core * c, vector <string> & parameters);
command_result colormods (Core * c, vector <string> & parameters);
command_result zoom (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "kittens";
}
DFHACK_PLUGIN("kittens");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("nyan","NYAN CAT INVASION!",kittens, true));
commands.push_back(PluginCommand("ktimer","Measure time between game updates and console lag (toggle).",ktimer));
commands.push_back(PluginCommand("trackmenu","Track menu ID changes (toggle).",trackmenu));

@ -30,14 +30,10 @@ enum HEXVIEW_STATES
};
command_result memview (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "memview";
}
DFHACK_PLUGIN("memview");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("memview","Shows memory in real time. Params: adrr length refresh_rate. If addr==0 then stop viewing",memview));
memdata.state=STATE_OFF;
mymutex=new tthread::mutex;

@ -12,14 +12,10 @@ using namespace DFHack;
command_result df_notes (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "notes";
}
DFHACK_PLUGIN("notes");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("dumpnotes",
"Dumps in-game notes",
df_notes));

@ -19,14 +19,10 @@ uint64_t timeLast = 0;
command_result rawdump_i (Core * c, vector <string> & parameters);
command_result rawdump_p (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "rawdump";
}
DFHACK_PLUGIN("rawdump");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("dump_inorganic","Dump inorganic raws.",rawdump_i));
commands.push_back(PluginCommand("dump_plants","Dump plant raws.",rawdump_p));
return CR_OK;

@ -199,14 +199,10 @@ struct Settings
Brush * brush;
} settings;
DFhackCExport const char * plugin_name ( void )
{
return "tiles";
}
DFHACK_PLUGIN("tiles");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("tiles", "A tile painter. See 'tile help' for details.", df_tiles));
commands.push_back(PluginCommand("paint", "Paint with the current tiles settings.", df_paint));
return CR_OK;

@ -21,17 +21,13 @@ using df::global::world;
// mostly to allow having the mandatory stuff on top of the file and commands on the bottom
command_result tilesieve (Core * c, std::vector <std::string> & parameters);
// A plugins must be able to return its name. This must correspond to the filename - skeleton.plug.so or skeleton.plug.dll
DFhackCExport const char * plugin_name ( void )
{
return "tilesieve";
}
// A plugin must be able to return its name. This must correspond to the filename - skeleton.plug.so or skeleton.plug.dll
DFHACK_PLUGIN("tilesieve");
// Mandatory init function. If you have some global state, create it here.
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
// Fill the command list with your commands.
commands.clear();
commands.push_back(PluginCommand(
"tilesieve", "Scan map for unknown tiles.",
tilesieve, false, /* true means that the command can't be used from non-interactive user interface */

@ -29,15 +29,10 @@ command_result df_vectors (Core * c,
command_result df_clearvec (Core * c,
vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "vectors";
}
DFHACK_PLUGIN("vectors");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("vectors",
"Scan memory for vectors.\
\n 1st param: start of scan\

@ -1 +1 @@
Subproject commit 23fbb78edaff35a62887803e178a24f9148ffc84
Subproject commit f149da6efead3c46845d7478d1ff3d11119c589d

@ -17,6 +17,8 @@ using namespace df::enums;
using df::global::world;
DFHACK_PLUGIN("drybuckets");
command_result df_drybuckets (Core * c, vector <string> & parameters)
{
if (!parameters.empty())
@ -39,14 +41,8 @@ command_result df_drybuckets (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "drybuckets";
}
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("drybuckets", "Removes water from buckets.", df_drybuckets));
return CR_OK;
}

@ -35,17 +35,12 @@ using df::global::world;
// mostly to allow having the mandatory stuff on top of the file and commands on the bottom
command_result export_dwarves (Core * c, std::vector <std::string> & parameters);
// A plugins must be able to return its name. This must correspond to the filename - export.plug.so or export.plug.dll
DFhackCExport const char * plugin_name ( void )
{
return "dwarfexport";
}
DFHACK_PLUGIN("dwarfexport");
// Mandatory init function. If you have some global state, create it here.
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
// Fill the command list with your commands.
commands.clear();
commands.push_back(PluginCommand("dwarfexport",
"Export dwarves to RuneSmith-compatible XML.",
export_dwarves /*,

@ -16,10 +16,7 @@ using df::global::world;
using df::global::ui;
// dfhack interface
DFhackCExport const char * plugin_name ( void )
{
return "fastdwarf";
}
DFHACK_PLUGIN("fastdwarf");
DFhackCExport command_result plugin_shutdown ( Core * c )
{
@ -68,8 +65,6 @@ static command_result fastdwarf (Core * c, vector <string> & parameters)
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("fastdwarf",
"enable/disable fastdwarf (parameter=0/1)",
fastdwarf));

@ -34,14 +34,10 @@ void allNormal(DFCoord coord, MapExtras::MapCache & map);
void allLow(DFCoord coord, MapExtras::MapCache & map);
void allRestricted(DFCoord coord, MapExtras::MapCache & map);
DFhackCExport const char * plugin_name ( void )
{
return "filltraffic";
}
DFHACK_PLUGIN("filltraffic");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"filltraffic","Flood-fill with selected traffic designation from cursor",
filltraffic, cursor_hotkey,

@ -224,14 +224,10 @@ command_result df_fixmerchants (Core *c, vector<string> &parameters)
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "fixpositions";
}
DFHACK_PLUGIN("fixpositions");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"fixdiplomats", "Add Diplomat position to Elven civilizations for tree cap diplomacy.",
df_fixdiplomats, false));

@ -97,14 +97,10 @@ command_result df_fixveins (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "fixveins";
}
DFHACK_PLUGIN("fixveins");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("fixveins",
"Remove invalid references to mineral inclusions and restore missing ones.",
df_fixveins));

@ -84,14 +84,10 @@ command_result df_fixwagons (Core *c, vector<string> &parameters)
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "fixwagons";
}
DFHACK_PLUGIN("fixwagons");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"fixwagons", "Fix all civilizations to be able to bring wagons.",
df_fixwagons, false,

@ -56,14 +56,10 @@ command_result df_flows (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "flows";
}
DFHACK_PLUGIN("flows");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("flows",
"Counts map blocks with flowing liquids.",
df_flows));

@ -22,15 +22,10 @@ command_result follow (Core * c, std::vector <std::string> & parameters);
df::unit *followedUnit;
int32_t prevX, prevY, prevZ;
DFhackCExport const char * plugin_name ( void )
{
return "follow";
}
DFHACK_PLUGIN("follow");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"follow", "Follow the selected unit until camera control is released",
follow, false,

@ -134,14 +134,10 @@ command_result df_getplants (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "getplants";
}
DFHACK_PLUGIN("getplants");
DFhackCExport command_result plugin_init ( Core * c, vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
"getplants", "Cut down all of the specified trees or gather specified shrubs",
df_getplants, false,

@ -17,14 +17,10 @@ using df::global::d_init;
command_result twaterlvl(Core * c, vector <string> & parameters);
command_result tidlers(Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "initflags";
}
DFHACK_PLUGIN("initflags");
DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> &commands)
{
commands.clear();
if (d_init) {
commands.push_back(PluginCommand("twaterlvl", "Toggle display of water/magma depth.",
twaterlvl, dwarfmode_hotkey));

@ -45,14 +45,10 @@ static command_result job_material(Core *c, vector <string> & parameters);
static command_result job_duplicate(Core *c, vector <string> & parameters);
static command_result job_cmd(Core *c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "jobutils";
}
DFHACK_PLUGIN("jobutils");
DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> &commands)
{
commands.clear();
if (!world || !ui)
return CR_FAILURE;

@ -24,6 +24,26 @@ using namespace DFHack;
using namespace df::enums;
typedef vector <df::coord> coord_vec;
CommandHistory liquids_hist;
command_result df_liquids (Core * c, vector <string> & parameters);
DFHACK_PLUGIN("liquids");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
liquids_hist.load("liquids.history");
commands.clear();
commands.push_back(PluginCommand("liquids", "Place magma, water or obsidian.", df_liquids, true));
return CR_OK;
}
DFhackCExport command_result plugin_shutdown ( Core * c )
{
liquids_hist.save("liquids.history");
return CR_OK;
}
class Brush
{
public:
@ -200,29 +220,6 @@ private:
Core *c_;
};
CommandHistory liquids_hist;
command_result df_liquids (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "liquids";
}
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
liquids_hist.load("liquids.history");
commands.clear();
commands.push_back(PluginCommand("liquids", "Place magma, water or obsidian.", df_liquids, true));
return CR_OK;
}
DFhackCExport command_result plugin_shutdown ( Core * c )
{
liquids_hist.save("liquids.history");
return CR_OK;
}
command_result df_liquids (Core * c, vector <string> & parameters)
{
int32_t x,y,z;

@ -25,10 +25,7 @@ typedef std::vector<df::plant *> PlantList;
command_result mapexport (Core * c, std::vector <std::string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "mapexport";
}
DFHACK_PLUGIN("mapexport");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -14,10 +14,7 @@ using namespace DFHack;
command_result mode (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "mode";
}
DFHACK_PLUGIN("mode");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -24,10 +24,7 @@ command_result df_grow (Core * c, vector <string> & parameters);
command_result df_immolate (Core * c, vector <string> & parameters);
command_result df_extirpate (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "plants";
}
DFHACK_PLUGIN("plants");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -34,10 +34,7 @@ using df::global::world;
command_result df_probe (Core * c, vector <string> & parameters);
command_result df_cprobe (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "probe";
}
DFHACK_PLUGIN("probe");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -179,10 +179,7 @@ void printVeins(DFHack::Console & con, MatMap &mat_map,
command_result prospector (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "prospector";
}
DFHACK_PLUGIN("prospector");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -4,7 +4,7 @@
#include <PluginManager.h>
#include <modules/Maps.h>
#include <modules/Gui.h>
#include <extra/MapExtras.h>
//#include <extra/MapExtras.h>
#include <vector>
#include <cstdio>
#include <stack>
@ -25,10 +25,7 @@ static tthread::thread * QTThread;
command_result runqt (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "Qt Test";
}
DFHACK_PLUGIN("qtplug");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -52,10 +52,7 @@ command_result df_regrass (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport const char *plugin_name ( void )
{
return "regrass";
}
DFHACK_PLUGIN("regrass");
DFhackCExport command_result plugin_init (Core *c, std::vector<PluginCommand> &commands)
{

@ -29,10 +29,7 @@ using df::global::world;
static command_result rename(Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "rename";
}
DFHACK_PLUGIN("rename");
DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> &commands)
{

@ -64,10 +64,7 @@ command_result revtoggle(DFHack::Core * c, std::vector<std::string> & params);
command_result revflood(DFHack::Core * c, std::vector<std::string> & params);
command_result nopause(DFHack::Core * c, std::vector<std::string> & params);
DFhackCExport const char * plugin_name ( void )
{
return "reveal";
}
DFHACK_PLUGIN("reveal");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -245,10 +245,7 @@ command_result df_seedwatch(Core* pCore, vector<string>& parameters)
return CR_OK;
}
DFhackCExport const char* plugin_name(void)
{
return "seedwatch";
}
DFHACK_PLUGIN("seedwatch");
DFhackCExport command_result plugin_init(Core* pCore, vector<PluginCommand>& commands)
{

@ -13,10 +13,7 @@ using namespace DFHack;
command_result server (Core * c, std::vector <std::string> & parameters);
// A plugins must be able to return its name. This must correspond to the filename - skeleton.plug.so or skeleton.plug.dll
DFhackCExport const char * plugin_name ( void )
{
return "server";
}
DFHACK_PLUGIN("server");
// Mandatory init function. If you have some global state, create it here.
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)

@ -266,10 +266,7 @@ command_result df_showmood (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport const char *plugin_name ( void )
{
return "showmood";
}
DFHACK_PLUGIN("showmood");
DFhackCExport command_result plugin_init (Core *c, std::vector<PluginCommand> &commands)
{

@ -21,11 +21,9 @@ using namespace df::enums;
// mostly to allow having the mandatory stuff on top of the file and commands on the bottom
command_result skeleton (Core * c, std::vector <std::string> & parameters);
// A plugins must be able to return its name. This must correspond to the filename - skeleton.plug.so or skeleton.plug.dll
DFhackCExport const char * plugin_name ( void )
{
return "skeleton";
}
// A plugin must be able to return its name and version.
// The name string provided must correspond to the filename - skeleton.plug.so or skeleton.plug.dll in this case
DFHACK_PLUGIN("skeleton");
// Mandatory init function. If you have some global state, create it here.
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
@ -48,7 +46,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
DFhackCExport command_result plugin_shutdown ( Core * c )
{
// You *MUST* kill all threads you created before this returns.
// If everythin fails, just return CR_FAILURE. Your plugin will be
// If everything fails, just return CR_FAILURE. Your plugin will be
// in a zombie state, but things won't crash.
return CR_OK;
}

@ -25,10 +25,7 @@ using df::building_stockpilest;
static command_result copystock(Core *c, vector <string> & parameters);
static bool copystock_guard(Core *c, df::viewscreen *top);
DFhackCExport const char * plugin_name ( void )
{
return "stockpiles";
}
DFHACK_PLUGIN("stockpiles");
DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> &commands)
{

@ -1 +1 @@
Subproject commit 852f0452d13578dccd9971518a3627cc29e8abf6
Subproject commit 37aaaca12d719ab47faedd1570158f37ad0362c7

@ -635,10 +635,7 @@ CommandHistory tiletypes_hist;
command_result df_tiletypes (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "tiletypes";
}
DFHACK_PLUGIN("tiletypes");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -20,10 +20,7 @@ using df::global::world;
command_result tubefill(DFHack::Core * c, std::vector<std::string> & params);
DFhackCExport const char * plugin_name ( void )
{
return "tubefill";
}
DFHACK_PLUGIN("tubefill");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -23,10 +23,7 @@ command_result expdig (Core * c, vector <string> & parameters);
command_result digcircle (Core *c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "vdig";
}
DFHACK_PLUGIN("vdig");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -29,10 +29,7 @@ DFTileSurface* tiles[10];
char* file = "Cooz_curses_square_16x16.png";
Gui* gui;
DFhackCExport const char * plugin_name ( void )
{
return "versionosd";
}
DFHACK_PLUGIN("versionosd");
DFTileSurface* createTile(int x, int y)
{

@ -15,10 +15,7 @@ unsigned char locked_data[25];
command_result weather (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "weather";
}
DFHACK_PLUGIN("weather");
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{

@ -55,10 +55,7 @@ static command_result workflow_cmd(Core *c, vector <string> & parameters);
static void init_state(Core *c);
static void cleanup_state(Core *c);
DFhackCExport const char * plugin_name ( void )
{
return "workflow";
}
DFHACK_PLUGIN("workflow");
DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> &commands)
{