|
|
@ -19,10 +19,12 @@ using namespace std;
|
|
|
|
#include "modules/Gui.h"
|
|
|
|
#include "modules/Gui.h"
|
|
|
|
#include "modules/Materials.h"
|
|
|
|
#include "modules/Materials.h"
|
|
|
|
#include "modules/MapCache.h"
|
|
|
|
#include "modules/MapCache.h"
|
|
|
|
|
|
|
|
#include "modules/Buildings.h"
|
|
|
|
#include "MiscUtils.h"
|
|
|
|
#include "MiscUtils.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "df/world.h"
|
|
|
|
#include "df/world.h"
|
|
|
|
|
|
|
|
#include "df/world_raws.h"
|
|
|
|
|
|
|
|
#include "df/building_def.h"
|
|
|
|
|
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
using std::vector;
|
|
|
|
using std::string;
|
|
|
|
using std::string;
|
|
|
@ -30,9 +32,11 @@ using namespace DFHack;
|
|
|
|
using namespace DFHack::Simple;
|
|
|
|
using namespace DFHack::Simple;
|
|
|
|
using namespace df::enums;
|
|
|
|
using namespace df::enums;
|
|
|
|
using df::global::world;
|
|
|
|
using df::global::world;
|
|
|
|
|
|
|
|
using df::global::cursor;
|
|
|
|
|
|
|
|
|
|
|
|
command_result df_probe (Core * c, vector <string> & parameters);
|
|
|
|
command_result df_probe (Core * c, vector <string> & parameters);
|
|
|
|
command_result df_cprobe (Core * c, vector <string> & parameters);
|
|
|
|
command_result df_cprobe (Core * c, vector <string> & parameters);
|
|
|
|
|
|
|
|
command_result df_bprobe (Core * c, vector <string> & parameters);
|
|
|
|
|
|
|
|
|
|
|
|
DFHACK_PLUGIN("probe");
|
|
|
|
DFHACK_PLUGIN("probe");
|
|
|
|
|
|
|
|
|
|
|
@ -45,6 +49,9 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
|
|
|
|
commands.push_back(PluginCommand("cprobe",
|
|
|
|
commands.push_back(PluginCommand("cprobe",
|
|
|
|
"A creature probe",
|
|
|
|
"A creature probe",
|
|
|
|
df_cprobe));
|
|
|
|
df_cprobe));
|
|
|
|
|
|
|
|
commands.push_back(PluginCommand("bprobe",
|
|
|
|
|
|
|
|
"A simple building probe",
|
|
|
|
|
|
|
|
df_bprobe));
|
|
|
|
return CR_OK;
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -273,3 +280,61 @@ command_result df_probe (Core * c, vector <string> & parameters)
|
|
|
|
con << std::endl;
|
|
|
|
con << std::endl;
|
|
|
|
return CR_OK;
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
command_result df_bprobe (Core * c, vector <string> & parameters)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CoreSuspender suspend(c);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(cursor->x == -30000)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
c->con.printerr("No cursor; place cursor over tile to probe.\n");
|
|
|
|
|
|
|
|
return CR_FAILURE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < world->buildings.all.size(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Buildings::t_building building;
|
|
|
|
|
|
|
|
if (!Buildings::Read(i, building))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!(building.x1 <= cursor->x && cursor->x <= building.x2 &&
|
|
|
|
|
|
|
|
building.y1 <= cursor->y && cursor->y <= building.y2 &&
|
|
|
|
|
|
|
|
building.z == cursor->z))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
string name;
|
|
|
|
|
|
|
|
building.origin->getName(&name);
|
|
|
|
|
|
|
|
c->con.print("Building %i - \"%s\" - type %s", building.origin->id, name.c_str(), ENUM_KEY_STR(building_type, building.type));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (building.type)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case building_type::Furnace:
|
|
|
|
|
|
|
|
c->con.print(", subtype %s", ENUM_KEY_STR(furnace_type, building.furnace_type));
|
|
|
|
|
|
|
|
if (building.furnace_type == furnace_type::Custom)
|
|
|
|
|
|
|
|
c->con.print(", custom type %i (%s)", building.custom_type, world->raws.buildings.all[building.custom_type]->code.c_str());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case building_type::Workshop:
|
|
|
|
|
|
|
|
c->con.print(", subtype %s", ENUM_KEY_STR(workshop_type, building.workshop_type));
|
|
|
|
|
|
|
|
if (building.workshop_type == workshop_type::Custom)
|
|
|
|
|
|
|
|
c->con.print(", custom type %i (%s)", building.custom_type, world->raws.buildings.all[building.custom_type]->code.c_str());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case building_type::Construction:
|
|
|
|
|
|
|
|
c->con.print(", subtype %s", ENUM_KEY_STR(construction_type, building.construction_type));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case building_type::Shop:
|
|
|
|
|
|
|
|
c->con.print(", subtype %s", ENUM_KEY_STR(shop_type, building.shop_type));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case building_type::SiegeEngine:
|
|
|
|
|
|
|
|
c->con.print(", subtype %s", ENUM_KEY_STR(siegeengine_type, building.siegeengine_type));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case building_type::Trap:
|
|
|
|
|
|
|
|
c->con.print(", subtype %s", ENUM_KEY_STR(trap_type, building.trap_type));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
if (building.subtype != -1)
|
|
|
|
|
|
|
|
c->con.print(", subtype %i", building.subtype);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
c->con.print("\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return CR_OK;
|
|
|
|
|
|
|
|
}
|
|
|
|