DFhackCExport is only needed on the plugin_* functions

develop
Quietust 2012-02-13 22:54:08 -06:00
parent 2fd2e3dce2
commit 091bf62aa8
38 changed files with 211 additions and 211 deletions

@ -28,8 +28,8 @@ static tthread::mutex* mymutex=0;
static tthread::thread* thread_dfusion=0;
uint64_t timeLast=0;
DFhackCExport command_result dfusion (Core * c, vector <string> & parameters);
DFhackCExport command_result lua_run (Core * c, vector <string> & parameters);
command_result dfusion (Core * c, vector <string> & parameters);
command_result lua_run (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -126,7 +126,7 @@ void InterpreterLoop(Core* c)
}
s.settop(0);
}
DFhackCExport command_result lua_run (Core * c, vector <string> & parameters)
command_result lua_run (Core * c, vector <string> & parameters)
{
Console &con=c->con;
mymutex->lock();
@ -172,7 +172,7 @@ void RunDfusion(void *p)
s.settop(0);// clean up
mymutex->unlock();
}
DFhackCExport command_result dfusion (Core * c, vector <string> & parameters)
command_result dfusion (Core * c, vector <string> & parameters)
{
if(parameters[0]=="init")
{

@ -32,9 +32,9 @@ using MapExtras::Block;
using MapExtras::MapCache;
using df::global::world;
DFhackCExport command_result df_autodump(Core * c, vector <string> & parameters);
DFhackCExport command_result df_autodump_destroy_here(Core * c, vector <string> & parameters);
DFhackCExport command_result df_autodump_destroy_item(Core * c, vector <string> & parameters);
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 )
{
@ -283,14 +283,14 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport command_result df_autodump(Core * c, vector <string> & parameters)
command_result df_autodump(Core * c, vector <string> & parameters)
{
CoreSuspender suspend(c);
return autodump_main(c, parameters);
}
DFhackCExport command_result df_autodump_destroy_here(Core * c, vector <string> & parameters)
command_result df_autodump_destroy_here(Core * c, vector <string> & parameters)
{
// HOTKEY COMMAND; CORE ALREADY SUSPENDED
if (!parameters.empty())
@ -305,7 +305,7 @@ DFhackCExport command_result df_autodump_destroy_here(Core * c, vector <string>
static map<int, df::item_flags> pending_destroy;
static int last_frame = 0;
DFhackCExport command_result df_autodump_destroy_item(Core * c, vector <string> & parameters)
command_result df_autodump_destroy_item(Core * c, vector <string> & parameters)
{
// HOTKEY COMMAND; CORE ALREADY SUSPENDED
if (!parameters.empty())

@ -113,7 +113,7 @@ command_result cleanunits (Core * c)
return CR_OK;
}
DFhackCExport command_result spotclean (Core * c, vector <string> & parameters)
command_result spotclean (Core * c, vector <string> & parameters)
{
// HOTKEY COMMAND: CORE ALREADY SUSPENDED
if (cursor->x == -30000)
@ -145,7 +145,7 @@ DFhackCExport command_result spotclean (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport command_result clean (Core * c, vector <string> & parameters)
command_result clean (Core * c, vector <string> & parameters)
{
bool map = false;
bool snow = false;

@ -26,7 +26,7 @@ using namespace df::enums;
using df::global::world;
DFhackCExport command_result df_cleanowned (Core * c, vector <string> & parameters);
command_result df_cleanowned (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -61,7 +61,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result df_cleanowned (Core * c, vector <string> & parameters)
command_result df_cleanowned (Core * c, vector <string> & parameters)
{
bool dump_scattered = false;
bool confiscate_all = false;

@ -12,7 +12,7 @@ using std::string;
using namespace DFHack;
using namespace DFHack::Simple;
DFhackCExport command_result colonies (Core * c, vector <string> & parameters);
command_result colonies (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -42,7 +42,7 @@ void destroyColonies();
void convertColonies(Materials *Materials);
void showColonies(Core *c, Materials *Materials);
DFhackCExport command_result colonies (Core * c, vector <string> & parameters)
command_result colonies (Core * c, vector <string> & parameters)
{
bool destroy = false;
bool convert = false;

@ -17,7 +17,7 @@ using namespace df::enums;
using df::global::world;
DFhackCExport command_result df_deramp (Core * c, vector <string> & parameters)
command_result df_deramp (Core * c, vector <string> & parameters)
{
if (!parameters.empty())
return CR_WRONG_USAGE;

@ -18,15 +18,15 @@ using std::string;
using std::stack;
using namespace DFHack;
DFhackCExport DFHack::command_result readFlag (Core * c, vector <string> & parameters);
DFhackCExport DFHack::command_result writeFlag (Core * c, vector <string> & parameters);
command_result readFlag (Core * c, vector <string> & parameters);
command_result writeFlag (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "buildprobe";
}
DFhackCExport DFHack::command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("bshow","Output building occupancy value",readFlag));
@ -34,16 +34,16 @@ DFhackCExport DFHack::command_result plugin_init ( Core * c, std::vector <Plugin
return CR_OK;
}
DFhackCExport DFHack::command_result plugin_shutdown ( Core * c )
DFhackCExport command_result plugin_shutdown ( Core * c )
{
return CR_OK;
}
DFhackCExport DFHack::command_result readFlag (Core * c, vector <string> & parameters)
command_result readFlag (Core * c, vector <string> & parameters)
{
c->Suspend();
c->Suspend();
DFHack::Gui * Gui = c->getGui();
Gui * Gui = c->getGui();
// init the map
if(!Maps::IsValid())
{
@ -52,7 +52,7 @@ DFhackCExport DFHack::command_result readFlag (Core * c, vector <string> & param
return CR_FAILURE;
}
int32_t cx, cy, cz;
int32_t cx, cy, cz;
Gui->getCursorCoords(cx,cy,cz);
while(cx == -30000)
{
@ -61,56 +61,56 @@ DFhackCExport DFHack::command_result readFlag (Core * c, vector <string> & param
return CR_FAILURE;
}
DFHack::DFCoord cursor = DFHack::DFCoord(cx,cy,cz);
DFCoord cursor = DFCoord(cx,cy,cz);
MapExtras::MapCache * MCache = new MapExtras::MapCache();
DFHack::t_occupancy oc = MCache->occupancyAt(cursor);
MapExtras::MapCache * MCache = new MapExtras::MapCache();
t_occupancy oc = MCache->occupancyAt(cursor);
c->con.print("Current Value: %d\n", oc.bits.building);
c->con.print("Current Value: %d\n", oc.bits.building);
c->Resume();
return CR_OK;
c->Resume();
return CR_OK;
}
DFhackCExport DFHack::command_result writeFlag (Core * c, vector <string> & parameters)
command_result writeFlag (Core * c, vector <string> & parameters)
{
if (parameters.size() == 0)
{
c->con.print("No value specified\n");
return CR_FAILURE;
}
if (parameters[0] == "help" || parameters[0] == "?")
{
c->con.print("Set the building occupancy flag.\n"
"Value must be between 0 and 7, inclusive.\n");
return CR_OK;
}
char value;
switch (parameters[0][0])
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
value = parameters[0][0] - '0';
break;
default:
c->con.print("Invalid value specified\n");
return CR_FAILURE;
break; //Redundant.
}
c->Suspend();
DFHack::Gui * Gui = c->getGui();
if (parameters.size() == 0)
{
c->con.print("No value specified\n");
return CR_FAILURE;
}
if (parameters[0] == "help" || parameters[0] == "?")
{
c->con.print("Set the building occupancy flag.\n"
"Value must be between 0 and 7, inclusive.\n");
return CR_OK;
}
char value;
switch (parameters[0][0])
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
value = parameters[0][0] - '0';
break;
default:
c->con.print("Invalid value specified\n");
return CR_FAILURE;
break; //Redundant.
}
c->Suspend();
Gui * Gui = c->getGui();
// init the map
if(!Maps::IsValid())
{
@ -119,7 +119,7 @@ DFhackCExport DFHack::command_result writeFlag (Core * c, vector <string> & para
return CR_FAILURE;
}
int32_t cx, cy, cz;
int32_t cx, cy, cz;
Gui->getCursorCoords(cx,cy,cz);
while(cx == -30000)
{
@ -128,15 +128,15 @@ DFhackCExport DFHack::command_result writeFlag (Core * c, vector <string> & para
return CR_FAILURE;
}
DFHack::DFCoord cursor = DFHack::DFCoord(cx,cy,cz);
DFCoord cursor = DFCoord(cx,cy,cz);
MapExtras::MapCache * MCache = new MapExtras::MapCache();
DFHack::t_occupancy oc = MCache->occupancyAt(cursor);
MapExtras::MapCache * MCache = new MapExtras::MapCache();
t_occupancy oc = MCache->occupancyAt(cursor);
oc.bits.building = value;
MCache->setOccupancyAt(cursor, oc);
MCache->WriteAll();
oc.bits.building = value;
MCache->setOccupancyAt(cursor, oc);
MCache->WriteAll();
c->Resume();
return CR_OK;
c->Resume();
return CR_OK;
}

@ -145,7 +145,7 @@ protected:
// END item choosers
//////////////////////
DFhackCExport command_result df_dumpitems (Core * c, vector <string> & parameters);
command_result df_dumpitems (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -169,7 +169,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result df_dumpitems (Core * c, vector <string> & parameters)
command_result df_dumpitems (Core * c, vector <string> & parameters)
{
c->Suspend();
DFHack::Materials * Materials = c->getMaterials();

@ -27,11 +27,11 @@ int32_t last_mouse[2] = {-1, -1};
uint32_t last_menu = 0;
uint64_t timeLast = 0;
DFhackCExport command_result kittens (Core * c, vector <string> & parameters);
DFhackCExport command_result ktimer (Core * c, vector <string> & parameters);
DFhackCExport command_result trackmenu (Core * c, vector <string> & parameters);
DFhackCExport command_result trackpos (Core * c, vector <string> & parameters);
DFhackCExport command_result colormods (Core * c, vector <string> & parameters);
command_result kittens (Core * c, vector <string> & parameters);
command_result ktimer (Core * c, vector <string> & parameters);
command_result trackmenu (Core * c, vector <string> & parameters);
command_result trackpos (Core * c, vector <string> & parameters);
command_result colormods (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -104,7 +104,7 @@ DFhackCExport command_result plugin_onupdate ( Core * c )
return CR_OK;
}
DFhackCExport command_result trackmenu (Core * c, vector <string> & parameters)
command_result trackmenu (Core * c, vector <string> & parameters)
{
if(trackmenu_flg)
{
@ -128,13 +128,13 @@ DFhackCExport command_result trackmenu (Core * c, vector <string> & parameters)
}
}
}
DFhackCExport command_result trackpos (Core * c, vector <string> & parameters)
command_result trackpos (Core * c, vector <string> & parameters)
{
trackpos_flg = !trackpos_flg;
return CR_OK;
}
DFhackCExport command_result colormods (Core * c, vector <string> & parameters)
command_result colormods (Core * c, vector <string> & parameters)
{
c->Suspend();
auto & vec = df::global::world->raws.creatures.alphabetic;
@ -152,7 +152,7 @@ DFhackCExport command_result colormods (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport command_result ktimer (Core * c, vector <string> & parameters)
command_result ktimer (Core * c, vector <string> & parameters)
{
if(timering)
{
@ -170,7 +170,7 @@ DFhackCExport command_result ktimer (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport command_result kittens (Core * c, vector <string> & parameters)
command_result kittens (Core * c, vector <string> & parameters)
{
final_flag = false;
Console & con = c->con;

@ -28,7 +28,7 @@ enum HEXVIEW_STATES
{
STATE_OFF,STATE_ON
};
DFhackCExport command_result memview (Core * c, vector <string> & parameters);
command_result memview (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -139,7 +139,7 @@ DFhackCExport command_result plugin_onupdate ( Core * c )
return CR_OK;
}
DFhackCExport command_result memview (Core * c, vector <string> & parameters)
command_result memview (Core * c, vector <string> & parameters)
{
mymutex->lock();
c->p->getMemRanges(memdata.ranges);

@ -10,7 +10,7 @@ using std::vector;
using std::string;
using namespace DFHack;
DFhackCExport command_result df_notes (Core * c, vector <string> & parameters);
command_result df_notes (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -31,7 +31,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result df_notes (Core * c, vector <string> & parameters)
command_result df_notes (Core * c, vector <string> & parameters)
{
Console & con = c->con;
c->Suspend();

@ -16,8 +16,8 @@ bool final_flag = true;
bool timering = false;
uint64_t timeLast = 0;
DFhackCExport command_result rawdump_i (Core * c, vector <string> & parameters);
DFhackCExport command_result rawdump_p (Core * c, vector <string> & parameters);
command_result rawdump_i (Core * c, vector <string> & parameters);
command_result rawdump_p (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -37,7 +37,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result rawdump_i (Core * c, vector <string> & parameters)
command_result rawdump_i (Core * c, vector <string> & parameters)
{
int index = -1;
Console & con = c->con;
@ -81,7 +81,7 @@ DFhackCExport command_result rawdump_i (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport command_result rawdump_p (Core * c, vector <string> & parameters)
command_result rawdump_p (Core * c, vector <string> & parameters)
{
int index = -1;
Console & con = c->con;

@ -162,8 +162,8 @@ public:
};
};
DFhackCExport command_result df_tiles (Core * c, vector <string> & parameters);
DFhackCExport command_result df_paint (Core * c, vector <string> & parameters);
command_result df_tiles (Core * c, vector <string> & parameters);
command_result df_paint (Core * c, vector <string> & parameters);
struct Settings
{
@ -217,7 +217,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result df_tiles (Core * c, vector <string> & parameters)
command_result df_tiles (Core * c, vector <string> & parameters)
{
int32_t x,y,z;
uint32_t x_max,y_max,z_max;

@ -24,9 +24,9 @@ struct t_vecTriplet
void * alloc_end;
};
DFhackCExport command_result df_vectors (Core * c,
command_result df_vectors (Core * c,
vector <string> & parameters);
DFhackCExport command_result df_clearvec (Core * c,
command_result df_clearvec (Core * c,
vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
@ -148,7 +148,7 @@ static void printVec(Console &con, const char* msg, t_vecTriplet *vec,
msg, offset, pos, vec->start, length);
}
DFhackCExport command_result df_vectors (Core * c, vector <string> & parameters)
command_result df_vectors (Core * c, vector <string> & parameters)
{
Console & con = c->con;
@ -270,7 +270,7 @@ static void clearUsage(Console &con)
<< std::endl;
}
DFhackCExport command_result df_clearvec (Core * c, vector <string> & parameters)
command_result df_clearvec (Core * c, vector <string> & parameters)
{
Console & con = c->con;

@ -17,7 +17,7 @@ using namespace df::enums;
using df::global::world;
DFhackCExport command_result df_drybuckets (Core * c, vector <string> & parameters)
command_result df_drybuckets (Core * c, vector <string> & parameters)
{
if (!parameters.empty())
return CR_WRONG_USAGE;

@ -33,7 +33,7 @@ using df::global::world;
// Here go all the command declarations...
// mostly to allow having the mandatory stuff on top of the file and commands on the bottom
DFhackCExport command_result export_dwarves (Core * c, std::vector <std::string> & parameters);
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 )
@ -155,7 +155,7 @@ static void export_dwarf(Core* c, df::unit* cre, ostream& out) {
out << " </Creature>" << endl;
}
DFhackCExport command_result export_dwarves (Core * c, std::vector <std::string> & parameters)
command_result export_dwarves (Core * c, std::vector <std::string> & parameters)
{
string filename;
if (parameters.size() == 1) {

@ -18,21 +18,21 @@ using namespace DFHack;
using namespace df::enums;
//Function pointer type for whole-map tile checks.
typedef void (*checkTile)(DFHack::DFCoord, MapExtras::MapCache &);
typedef void (*checkTile)(DFCoord, MapExtras::MapCache &);
//Forward Declarations for Commands
DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::string> & params);
DFhackCExport command_result alltraffic(DFHack::Core * c, std::vector<std::string> & params);
command_result filltraffic(Core * c, std::vector<std::string> & params);
command_result alltraffic(Core * c, std::vector<std::string> & params);
//Forward Declarations for Utility Functions
DFhackCExport command_result setAllMatching(DFHack::Core * c, checkTile checkProc,
DFHack::DFCoord minCoord = DFHack::DFCoord(0, 0, 0),
DFHack::DFCoord maxCoord = DFHack::DFCoord(0xFFFF, 0xFFFF, 0xFFFF));
command_result setAllMatching(Core * c, checkTile checkProc,
DFCoord minCoord = DFCoord(0, 0, 0),
DFCoord maxCoord = DFCoord(0xFFFF, 0xFFFF, 0xFFFF));
void allHigh(DFHack::DFCoord coord, MapExtras::MapCache & map);
void allNormal(DFHack::DFCoord coord, MapExtras::MapCache & map);
void allLow(DFHack::DFCoord coord, MapExtras::MapCache & map);
void allRestricted(DFHack::DFCoord coord, MapExtras::MapCache & map);
void allHigh(DFCoord coord, MapExtras::MapCache & map);
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 )
{
@ -78,7 +78,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::string> & params)
command_result filltraffic(Core * c, std::vector<std::string> & params)
{
// HOTKEY COMMAND; CORE ALREADY SUSPENDED
@ -119,7 +119,7 @@ DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::stri
}
}
DFHack::Gui * Gui = c->getGui();
Gui * Gui = c->getGui();
if (!Maps::IsValid())
{
c->con.printerr("Map is not available!\n");
@ -137,7 +137,7 @@ DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::stri
return CR_FAILURE;
}
DFHack::DFCoord xy ((uint32_t)cx,(uint32_t)cy,cz);
DFCoord xy ((uint32_t)cx,(uint32_t)cy,cz);
MapExtras::MapCache MCache;
df::tile_designation des = MCache.designationAt(xy);
@ -154,13 +154,13 @@ DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::stri
return CR_FAILURE;
}
if(DFHack::isWallTerrain(tt))
if(isWallTerrain(tt))
{
c->con.printerr("This tile is a wall. Please select a passable tile.\n");
return CR_FAILURE;
}
if(checkpit && DFHack::isOpenTerrain(tt))
if(checkpit && isOpenTerrain(tt))
{
c->con.printerr("This tile is a hole. Please select a passable tile.\n");
return CR_FAILURE;
@ -175,7 +175,7 @@ DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::stri
c->con.print("%d/%d/%d ... FILLING!\n", cx,cy,cz);
//Naive four-way or six-way flood fill with possible tiles on a stack.
stack <DFHack::DFCoord> flood;
stack <DFCoord> flood;
flood.push(xy);
while(!flood.empty())
@ -188,8 +188,8 @@ DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::stri
tt = MCache.tiletypeAt(xy);
if(DFHack::isWallTerrain(tt)) continue;
if(checkpit && DFHack::isOpenTerrain(tt)) continue;
if(isWallTerrain(tt)) continue;
if(checkpit && isOpenTerrain(tt)) continue;
if (checkbuilding)
{
@ -205,30 +205,30 @@ DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::stri
if (xy.x > 0)
{
flood.push(DFHack::DFCoord(xy.x - 1, xy.y, xy.z));
flood.push(DFCoord(xy.x - 1, xy.y, xy.z));
}
if (xy.x < tx_max - 1)
{
flood.push(DFHack::DFCoord(xy.x + 1, xy.y, xy.z));
flood.push(DFCoord(xy.x + 1, xy.y, xy.z));
}
if (xy.y > 0)
{
flood.push(DFHack::DFCoord(xy.x, xy.y - 1, xy.z));
flood.push(DFCoord(xy.x, xy.y - 1, xy.z));
}
if (xy.y < ty_max - 1)
{
flood.push(DFHack::DFCoord(xy.x, xy.y + 1, xy.z));
flood.push(DFCoord(xy.x, xy.y + 1, xy.z));
}
if (updown)
{
if (xy.z > 0 && DFHack::LowPassable(tt))
if (xy.z > 0 && LowPassable(tt))
{
flood.push(DFHack::DFCoord(xy.x, xy.y, xy.z - 1));
flood.push(DFCoord(xy.x, xy.y, xy.z - 1));
}
if (xy.z < z_max && DFHack::HighPassable(tt))
if (xy.z < z_max && HighPassable(tt))
{
flood.push(DFHack::DFCoord(xy.x, xy.y, xy.z + 1));
flood.push(DFCoord(xy.x, xy.y, xy.z + 1));
}
}
@ -241,9 +241,9 @@ DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::stri
enum e_checktype {no_check, check_equal, check_nequal};
DFhackCExport command_result alltraffic(DFHack::Core * c, std::vector<std::string> & params)
command_result alltraffic(Core * c, std::vector<std::string> & params)
{
void (*proc)(DFHack::DFCoord, MapExtras::MapCache &) = allNormal;
void (*proc)(DFCoord, MapExtras::MapCache &) = allNormal;
//Loop through parameters
for(size_t i = 0; i < params.size();i++)
@ -274,13 +274,13 @@ DFhackCExport command_result alltraffic(DFHack::Core * c, std::vector<std::strin
//newTraffic is the traffic designation to set.
//check takes a coordinate and the map cache as arguments, and returns true if the criteria is met.
//minCoord and maxCoord can be used to specify a bounding cube.
DFhackCExport command_result setAllMatching(DFHack::Core * c, checkTile checkProc,
DFHack::DFCoord minCoord, DFHack::DFCoord maxCoord)
command_result setAllMatching(Core * c, checkTile checkProc,
DFCoord minCoord, DFCoord maxCoord)
{
//Initialization.
CoreSuspender suspend(c);
DFHack::Gui * Gui = c->getGui();
Gui * Gui = c->getGui();
if (!Maps::IsValid())
{
c->con.printerr("Map is not available!\n");
@ -326,7 +326,7 @@ DFhackCExport command_result setAllMatching(DFHack::Core * c, checkTile checkPro
{
for(uint32_t z = minCoord.z; z <= maxCoord.z; z++)
{
DFHack::DFCoord tile = DFHack::DFCoord(x, y, z);
DFCoord tile = DFCoord(x, y, z);
checkProc(tile, MCache);
}
}
@ -338,25 +338,25 @@ DFhackCExport command_result setAllMatching(DFHack::Core * c, checkTile checkPro
}
//Unconditionally set map to target traffic type
void allHigh(DFHack::DFCoord coord, MapExtras::MapCache &map)
void allHigh(DFCoord coord, MapExtras::MapCache &map)
{
df::tile_designation des = map.designationAt(coord);
des.bits.traffic = tile_traffic::High;
map.setDesignationAt(coord, des);
}
void allNormal(DFHack::DFCoord coord, MapExtras::MapCache &map)
void allNormal(DFCoord coord, MapExtras::MapCache &map)
{
df::tile_designation des = map.designationAt(coord);
des.bits.traffic = tile_traffic::Normal;
map.setDesignationAt(coord, des);
}
void allLow(DFHack::DFCoord coord, MapExtras::MapCache &map)
void allLow(DFCoord coord, MapExtras::MapCache &map)
{
df::tile_designation des = map.designationAt(coord);
des.bits.traffic = tile_traffic::Low;
map.setDesignationAt(coord, des);
}
void allRestricted(DFHack::DFCoord coord, MapExtras::MapCache &map)
void allRestricted(DFCoord coord, MapExtras::MapCache &map)
{
df::tile_designation des = map.designationAt(coord);
des.bits.traffic = tile_traffic::Restricted;

@ -35,7 +35,7 @@ bool setTileMaterial(df::tiletype &tile, const df::tiletype_material mat)
return false;
}
DFhackCExport command_result df_fixveins (Core * c, vector <string> & parameters)
command_result df_fixveins (Core * c, vector <string> & parameters)
{
if (parameters.size())
return CR_WRONG_USAGE;

@ -17,7 +17,7 @@ using namespace df::enums;
using df::global::world;
DFhackCExport command_result df_flows (Core * c, vector <string> & parameters)
command_result df_flows (Core * c, vector <string> & parameters)
{
CoreSuspender suspend(c);

@ -23,7 +23,7 @@ using namespace df::enums;
using df::global::world;
DFhackCExport command_result df_getplants (Core * c, vector <string> & parameters)
command_result df_getplants (Core * c, vector <string> & parameters)
{
string plantMatStr = "";
set<int> plantIDs;

@ -14,8 +14,8 @@ using namespace df::enums;
using df::global::d_init;
DFhackCExport command_result twaterlvl(Core * c, vector <string> & parameters);
DFhackCExport command_result tidlers(Core * c, vector <string> & parameters);
command_result twaterlvl(Core * c, vector <string> & parameters);
command_result tidlers(Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -40,7 +40,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result twaterlvl(Core * c, vector <string> & parameters)
command_result twaterlvl(Core * c, vector <string> & parameters)
{
// HOTKEY COMMAND: CORE ALREADY SUSPENDED
d_init->flags1.toggle(d_init_flags1::SHOW_FLOW_AMOUNTS);
@ -48,7 +48,7 @@ DFhackCExport command_result twaterlvl(Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport command_result tidlers(Core * c, vector <string> & parameters)
command_result tidlers(Core * c, vector <string> & parameters)
{
// HOTKEY COMMAND: CORE ALREADY SUSPENDED
d_init->idlers = ENUM_NEXT_ITEM(d_init_idlers, d_init->idlers);

@ -202,7 +202,7 @@ private:
CommandHistory liquids_hist;
DFhackCExport command_result df_liquids (Core * c, vector <string> & parameters);
command_result df_liquids (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -223,7 +223,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result df_liquids (Core * c, vector <string> & parameters)
command_result df_liquids (Core * c, vector <string> & parameters)
{
int32_t x,y,z;

@ -23,7 +23,7 @@ using df::global::world;
typedef std::vector<df::plant *> PlantList;
DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & parameters);
command_result mapexport (Core * c, std::vector <std::string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -44,7 +44,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & parameters)
command_result mapexport (Core * c, std::vector <std::string> & parameters)
{
bool showHidden = false;

@ -12,7 +12,7 @@ using namespace std;
using namespace DFHack;
DFhackCExport command_result mode (Core * c, vector <string> & parameters);
command_result mode (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -91,7 +91,7 @@ void printCurrentModes(t_gamemodes gm, Console & con)
}
}
DFhackCExport command_result mode (Core * c, vector <string> & parameters)
command_result mode (Core * c, vector <string> & parameters)
{
string command = "";
bool set = false;

@ -20,9 +20,9 @@ using std::string;
using namespace DFHack;
using df::global::world;
DFhackCExport command_result df_grow (Core * c, vector <string> & parameters);
DFhackCExport command_result df_immolate (Core * c, vector <string> & parameters);
DFhackCExport command_result df_extirpate (Core * c, vector <string> & parameters);
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 )
{
@ -162,7 +162,7 @@ static command_result immolations (Core * c, do_what what, bool shrubs, bool tre
return CR_OK;
}
DFhackCExport command_result df_immolate (Core * c, vector <string> & parameters)
command_result df_immolate (Core * c, vector <string> & parameters)
{
bool shrubs = false, trees = false, help = false;
if(getoptions(parameters,shrubs,trees,help))
@ -176,7 +176,7 @@ DFhackCExport command_result df_immolate (Core * c, vector <string> & parameters
}
}
DFhackCExport command_result df_extirpate (Core * c, vector <string> & parameters)
command_result df_extirpate (Core * c, vector <string> & parameters)
{
bool shrubs = false, trees = false, help = false;
if(getoptions(parameters,shrubs,trees, help))
@ -190,7 +190,7 @@ DFhackCExport command_result df_extirpate (Core * c, vector <string> & parameter
}
}
DFhackCExport command_result df_grow (Core * c, vector <string> & parameters)
command_result df_grow (Core * c, vector <string> & parameters)
{
for(size_t i = 0; i < parameters.size();i++)
{

@ -31,8 +31,8 @@ using namespace DFHack::Simple;
using namespace df::enums;
using df::global::world;
DFhackCExport command_result df_probe (Core * c, vector <string> & parameters);
DFhackCExport command_result df_cprobe (Core * c, vector <string> & parameters);
command_result df_probe (Core * c, vector <string> & parameters);
command_result df_cprobe (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -56,7 +56,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result df_cprobe (Core * c, vector <string> & parameters)
command_result df_cprobe (Core * c, vector <string> & parameters)
{
Console & con = c->con;
CoreSuspender suspend(c);
@ -82,7 +82,7 @@ DFhackCExport command_result df_cprobe (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport command_result df_probe (Core * c, vector <string> & parameters)
command_result df_probe (Core * c, vector <string> & parameters)
{
//bool showBlock, showDesig, showOccup, showTile, showMisc;
Console & con = c->con;

@ -177,7 +177,7 @@ void printVeins(DFHack::Console & con, MatMap &mat_map,
printMats(con, rest, world->raws.inorganics, show_value);
}
DFhackCExport command_result prospector (Core * c, vector <string> & parameters);
command_result prospector (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -345,7 +345,7 @@ static command_result embark_prospector(DFHack::Core *c, df::viewscreen_choose_s
return CR_OK;
}
DFhackCExport command_result prospector (DFHack::Core * c, vector <string> & parameters)
command_result prospector (DFHack::Core * c, vector <string> & parameters)
{
bool showHidden = false;
bool showPlants = true;

@ -23,7 +23,7 @@ static tthread::mutex * instance_mutex = 0;
static bool running = false;
static tthread::thread * QTThread;
DFhackCExport command_result runqt (Core * c, vector <string> & parameters);
command_result runqt (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -43,7 +43,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_FAILURE;
}
DFhackCExport command_result runqt (Core * c, vector <string> & parameters)
command_result runqt (Core * c, vector <string> & parameters)
{
instance_mutex->lock();
if(!running)

@ -17,7 +17,7 @@ using namespace DFHack;
using df::global::world;
DFhackCExport command_result df_regrass (Core * c, vector <string> & parameters)
command_result df_regrass (Core * c, vector <string> & parameters)
{
if (!parameters.empty())
return CR_WRONG_USAGE;

@ -58,11 +58,11 @@ enum revealstate
revealstate revealed = NOT_REVEALED;
DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> & params);
DFhackCExport command_result unreveal(DFHack::Core * c, std::vector<std::string> & params);
DFhackCExport command_result revtoggle(DFHack::Core * c, std::vector<std::string> & params);
DFhackCExport command_result revflood(DFHack::Core * c, std::vector<std::string> & params);
DFhackCExport command_result nopause(DFHack::Core * c, std::vector<std::string> & params);
command_result reveal(DFHack::Core * c, std::vector<std::string> & params);
command_result unreveal(DFHack::Core * c, std::vector<std::string> & params);
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 )
{
@ -124,7 +124,7 @@ command_result nopause (Core * c, std::vector <std::string> & parameters)
}
DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> & params)
command_result reveal(DFHack::Core * c, std::vector<std::string> & params)
{
bool no_hell = true;
bool pause = true;
@ -215,7 +215,7 @@ DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> &
return CR_OK;
}
DFhackCExport command_result unreveal(DFHack::Core * c, std::vector<std::string> & params)
command_result unreveal(DFHack::Core * c, std::vector<std::string> & params)
{
Console & con = c->con;
for(size_t i = 0; i < params.size();i++)
@ -272,7 +272,7 @@ DFhackCExport command_result unreveal(DFHack::Core * c, std::vector<std::string>
return CR_OK;
}
DFhackCExport command_result revtoggle (DFHack::Core * c, std::vector<std::string> & params)
command_result revtoggle (DFHack::Core * c, std::vector<std::string> & params)
{
for(size_t i = 0; i < params.size();i++)
{
@ -292,7 +292,7 @@ DFhackCExport command_result revtoggle (DFHack::Core * c, std::vector<std::strin
}
}
DFhackCExport command_result revflood(DFHack::Core * c, std::vector<std::string> & params)
command_result revflood(DFHack::Core * c, std::vector<std::string> & params)
{
for(size_t i = 0; i < params.size();i++)
{

@ -97,7 +97,7 @@ string searchAbbreviations(string in)
}
};
DFhackCExport command_result df_seedwatch(Core* pCore, vector<string>& parameters)
command_result df_seedwatch(Core* pCore, vector<string>& parameters)
{
Core& core = *pCore;
if(!core.isValid())

@ -10,7 +10,7 @@ using namespace DFHack;
// Here go all the command declarations...
// mostly to allow having the mandatory stuff on top of the file and commands on the bottom
DFhackCExport command_result server (Core * c, std::vector <std::string> & parameters);
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 )
@ -39,7 +39,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
}
// This is WRONG and STUPID. Never use this as an example!
DFhackCExport command_result server (Core * c, std::vector <std::string> & parameters)
command_result server (Core * c, std::vector <std::string> & parameters)
{
// It's nice to provide a 'help' option for your command.
// It's also nice to print the same help if you get invalid options from the user instead of just acting strange

@ -27,7 +27,7 @@ using namespace df::enums;
using df::global::world;
DFhackCExport command_result df_showmood (Core * c, vector <string> & parameters)
command_result df_showmood (Core * c, vector <string> & parameters)
{
if (!parameters.empty())
return CR_WRONG_USAGE;

@ -633,7 +633,7 @@ public:
CommandHistory tiletypes_hist;
DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameters);
command_result df_tiletypes (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -654,7 +654,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameters)
command_result df_tiletypes (Core * c, vector <string> & parameters)
{
uint32_t x_max = 0, y_max = 0, z_max = 0;
int32_t x = 0, y = 0, z = 0;

@ -18,7 +18,7 @@ using namespace DFHack::Simple;
using namespace df::enums;
using df::global::world;
DFhackCExport command_result tubefill(DFHack::Core * c, std::vector<std::string> & params);
command_result tubefill(DFHack::Core * c, std::vector<std::string> & params);
DFhackCExport const char * plugin_name ( void )
{
@ -37,7 +37,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result tubefill(DFHack::Core * c, std::vector<std::string> & params)
command_result tubefill(DFHack::Core * c, std::vector<std::string> & params)
{
uint64_t count = 0;

@ -16,11 +16,11 @@ using std::stack;
using namespace DFHack;
using namespace df::enums;
DFhackCExport command_result vdig (Core * c, vector <string> & parameters);
DFhackCExport command_result vdigx (Core * c, vector <string> & parameters);
DFhackCExport command_result autodig (Core * c, vector <string> & parameters);
DFhackCExport command_result expdig (Core * c, vector <string> & parameters);
DFhackCExport command_result digcircle (Core *c, vector <string> & parameters);
command_result vdig (Core * c, vector <string> & parameters);
command_result vdigx (Core * c, vector <string> & parameters);
command_result autodig (Core * c, vector <string> & parameters);
command_result expdig (Core * c, vector <string> & parameters);
command_result digcircle (Core *c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
@ -180,7 +180,7 @@ bool lineY (MapExtras::MapCache & MCache,
return true;
};
DFhackCExport command_result digcircle (Core * c, vector <string> & parameters)
command_result digcircle (Core * c, vector <string> & parameters)
{
static bool filled = false;
static circle_what what = circle_set;
@ -777,7 +777,7 @@ bool stamp_pattern (uint32_t bx, uint32_t by, int z_level,
return true;
};
DFhackCExport command_result expdig (Core * c, vector <string> & parameters)
command_result expdig (Core * c, vector <string> & parameters)
{
bool force_help = false;
static explo_how how = EXPLO_NOTHING;
@ -954,7 +954,7 @@ DFhackCExport command_result expdig (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport command_result vdigx (Core * c, vector <string> & parameters)
command_result vdigx (Core * c, vector <string> & parameters)
{
// HOTKEY COMMAND: CORE ALREADY SUSPENDED
vector <string> lol;
@ -962,7 +962,7 @@ DFhackCExport command_result vdigx (Core * c, vector <string> & parameters)
return vdig(c,lol);
}
DFhackCExport command_result vdig (Core * c, vector <string> & parameters)
command_result vdig (Core * c, vector <string> & parameters)
{
// HOTKEY COMMAND: CORE ALREADY SUSPENDED
uint32_t x_max,y_max,z_max;
@ -1120,7 +1120,7 @@ DFhackCExport command_result vdig (Core * c, vector <string> & parameters)
return CR_OK;
}
DFhackCExport command_result autodig (Core * c, vector <string> & parameters)
command_result autodig (Core * c, vector <string> & parameters)
{
return CR_NOT_IMPLEMENTED;
}

@ -15,7 +15,7 @@ using namespace std;
#include "modules/Gui.h"
using namespace DFHack;
DFhackCExport command_result df_versionosd (Core * c, vector <string> & parameters);
command_result df_versionosd (Core * c, vector <string> & parameters);
static DFSDL_Surface* (*_IMG_LoadPNG_RW)(void* src) = 0;
static vPtr (*_SDL_RWFromFile)(const char* file, const char *mode) = 0;
static int (*_SDL_SetAlpha)(vPtr surface, uint32_t flag, uint8_t alpha) = 0;
@ -117,7 +117,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result df_versionosd (Core * c, vector <string> & parameters)
command_result df_versionosd (Core * c, vector <string> & parameters)
{
On = !On;
c->Suspend();

@ -13,7 +13,7 @@ using namespace DFHack;
bool locked = false;
unsigned char locked_data[25];
DFhackCExport command_result weather (Core * c, vector <string> & parameters);
command_result weather (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -40,7 +40,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
DFhackCExport command_result weather (Core * c, vector <string> & parameters)
command_result weather (Core * c, vector <string> & parameters)
{
Console & con = c->con;
bool lock = false;