diff --git a/library/include/Export.h b/library/include/Export.h index 8ae6fd623..1415826a1 100644 --- a/library/include/Export.h +++ b/library/include/Export.h @@ -44,6 +44,7 @@ distribution. // C export macros for faking SDL and plugin exports #ifdef LINUX_BUILD #define DFhackCExport extern "C" __attribute__ ((visibility("default"))) + #define DFhackDataExport __attribute__ ((visibility("default"))) #else #define DFhackCExport extern "C" __declspec(dllexport) #endif \ No newline at end of file diff --git a/library/include/PluginManager.h b/library/include/PluginManager.h index 75fb32315..e59a7f7b3 100644 --- a/library/include/PluginManager.h +++ b/library/include/PluginManager.h @@ -189,5 +189,5 @@ namespace DFHack }; /// 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; +#define DFHACK_PLUGIN(plugin_name) DFhackDataExport const char * version = DFHACK_VERSION;\ +DFhackDataExport const char * name = plugin_name; diff --git a/library/xml b/library/xml index 37844f572..d9aa36c98 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 37844f572bb738606672e14c537949418e683aef +Subproject commit d9aa36c9865798fa262ea51628189443d4a2d138 diff --git a/plugins/rename.cpp b/plugins/rename.cpp index 122671519..09d737be6 100644 --- a/plugins/rename.cpp +++ b/plugins/rename.cpp @@ -11,6 +11,7 @@ #include "df/squad.h" #include "df/unit.h" #include "df/unit_soul.h" +#include "df/historical_entity.h" #include "df/historical_figure.h" #include "df/historical_figure_info.h" #include "df/assumed_identity.h" @@ -66,6 +67,18 @@ static void set_nickname(df::language_name *name, std::string nick) name->nickname = nick; } +static df::squad *getSquadByIndex(unsigned idx) +{ + auto entity = df::historical_entity::find(ui->group_id); + if (!entity) + return NULL; + + if (idx >= entity->squads.size()) + return NULL; + + return df::squad::find(entity->squads[idx]); +} + static command_result rename(Core * c, vector ¶meters) { CoreSuspender suspend(c); @@ -79,15 +92,15 @@ static command_result rename(Core * c, vector ¶meters) if (parameters.size() != 3) return CR_WRONG_USAGE; - std::vector &squads = world->squads.all; - int id = atoi(parameters[1].c_str()); - if (id < 1 || id > squads.size()) { - c->con.printerr("Invalid squad index\n"); + df::squad *squad = getSquadByIndex(id-1); + + if (!squad) { + c->con.printerr("Couldn't find squad with index %d.\n", id); return CR_WRONG_USAGE; } - squads[id-1]->alias = parameters[2]; + squad->alias = parameters[2]; } else if (cmd == "hotkey") { diff --git a/plugins/stonesense b/plugins/stonesense index d6cb83efb..6a2241742 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit d6cb83efb16105e2c9e46df0989354d08309dd7f +Subproject commit 6a2241742561931aa6347c3d72529d976a82ee4d diff --git a/plugins/vdig.cpp b/plugins/vdig.cpp index dd839063b..d283f0357 100644 --- a/plugins/vdig.cpp +++ b/plugins/vdig.cpp @@ -40,7 +40,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector " Also follows the vein between z-levels with stairs, like 'vdig x' would.\n" )); commands.push_back(PluginCommand("expdig","Select or designate an exploratory pattern. Use 'expdig ?' for help.",expdig)); - commands.push_back(PluginCommand("digcircle","Dig desingate a circle (filled or hollow) with given radius.",digcircle)); + commands.push_back(PluginCommand("digcircle","Dig designate a circle (filled or hollow) with given radius.",digcircle)); //commands.push_back(PluginCommand("autodig","Mark a tile for continuous digging.",autodig)); return CR_OK; } @@ -826,7 +826,7 @@ command_result expdig (Core * c, vector & parameters) { c->con.print( "This command can be used for exploratory mining.\n" - "http://df.magmawiki.com/index.php/DF2010:Exploratory_mining\n" + "http://dwarffortresswiki.org/Exploratory_mining\n" "\n" "There are two variables that can be set: pattern and filter.\n" "Patterns:\n" diff --git a/plugins/weather.cpp b/plugins/weather.cpp index 6490bae17..d6d83cfa6 100644 --- a/plugins/weather.cpp +++ b/plugins/weather.cpp @@ -40,6 +40,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c ) command_result weather (Core * c, vector & parameters) { Console & con = c->con; + int val_override = -1; bool lock = false; bool unlock = false; bool snow = false; @@ -58,7 +59,11 @@ command_result weather (Core * c, vector & parameters) else if(parameters[i] == "unlock") unlock = true; else - return CR_WRONG_USAGE; + { + val_override = atoi(parameters[i].c_str()); + if(val_override == 0) + return CR_WRONG_USAGE; + } } if(lock && unlock) { @@ -74,7 +79,7 @@ command_result weather (Core * c, vector & parameters) con << "Rain, snow or clear sky? DECIDE!" << std::endl; return CR_FAILURE; } - bool something = lock || unlock || rain || snow || clear; + bool something = lock || unlock || rain || snow || clear || val_override != -1; CoreSuspender suspend(c); DFHack::World * w = c->getWorld(); @@ -128,6 +133,11 @@ command_result weather (Core * c, vector & parameters) con << "Suddenly, sunny weather!" << std::endl; w->SetCurrentWeather(CLEAR); } + if(val_override != -1) + { + con << "I have no damn idea what this is... " << val_override << std::endl; + w->SetCurrentWeather(val_override); + } // FIXME: weather lock needs map ID to work reliably... needs to be implemented. } return CR_OK;