|
|
@ -1,33 +1,34 @@
|
|
|
|
// Quick Dumper : Moves items marked as "dump" to cursor
|
|
|
|
// Quick Dumper : Moves items marked as "dump" to cursor
|
|
|
|
// FIXME: local item cache in map blocks needs to be fixed after teleporting items
|
|
|
|
// FIXME: local item cache in map blocks needs to be fixed after teleporting items
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <climits>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Core.h"
|
|
|
|
#include "Core.h"
|
|
|
|
#include "Console.h"
|
|
|
|
#include "Console.h"
|
|
|
|
|
|
|
|
#include "DataDefs.h"
|
|
|
|
#include "Export.h"
|
|
|
|
#include "Export.h"
|
|
|
|
#include "PluginManager.h"
|
|
|
|
#include "PluginManager.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "modules/Maps.h"
|
|
|
|
#include "modules/Maps.h"
|
|
|
|
#include "modules/Gui.h"
|
|
|
|
#include "modules/Gui.h"
|
|
|
|
#include "modules/Items.h"
|
|
|
|
#include "modules/Items.h"
|
|
|
|
#include "modules/Materials.h"
|
|
|
|
#include "modules/Materials.h"
|
|
|
|
#include "modules/MapCache.h"
|
|
|
|
#include "modules/MapCache.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "DataDefs.h"
|
|
|
|
|
|
|
|
#include "df/item.h"
|
|
|
|
#include "df/item.h"
|
|
|
|
#include "df/world.h"
|
|
|
|
#include "df/world.h"
|
|
|
|
#include "df/general_ref.h"
|
|
|
|
#include "df/general_ref.h"
|
|
|
|
#include "df/viewscreen_dwarfmodest.h"
|
|
|
|
#include "df/viewscreen_dwarfmodest.h"
|
|
|
|
#include "df/building_stockpilest.h"
|
|
|
|
#include "df/building_stockpilest.h"
|
|
|
|
#include "uicommon.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <climits>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace DFHack;
|
|
|
|
using namespace DFHack;
|
|
|
|
using namespace df::enums;
|
|
|
|
using namespace df::enums;
|
|
|
|
|
|
|
|
|
|
|
@ -40,6 +41,7 @@ DFHACK_PLUGIN("autodump");
|
|
|
|
REQUIRE_GLOBAL(gps);
|
|
|
|
REQUIRE_GLOBAL(gps);
|
|
|
|
REQUIRE_GLOBAL(world);
|
|
|
|
REQUIRE_GLOBAL(world);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* TODO: merge with stockpiles plugin
|
|
|
|
// Stockpile interface START
|
|
|
|
// Stockpile interface START
|
|
|
|
static const string PERSISTENCE_KEY = "autodump/stockpiles";
|
|
|
|
static const string PERSISTENCE_KEY = "autodump/stockpiles";
|
|
|
|
|
|
|
|
|
|
|
@ -267,6 +269,7 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Stockpile interface END
|
|
|
|
// Stockpile interface END
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
command_result df_autodump(color_ostream &out, vector <string> & parameters);
|
|
|
|
command_result df_autodump(color_ostream &out, vector <string> & parameters);
|
|
|
|
command_result df_autodump_destroy_here(color_ostream &out, vector <string> & parameters);
|
|
|
|
command_result df_autodump_destroy_here(color_ostream &out, vector <string> & parameters);
|
|
|
@ -276,18 +279,21 @@ DFhackCExport command_result plugin_init ( color_ostream &out, vector <PluginCom
|
|
|
|
{
|
|
|
|
{
|
|
|
|
commands.push_back(PluginCommand(
|
|
|
|
commands.push_back(PluginCommand(
|
|
|
|
"autodump",
|
|
|
|
"autodump",
|
|
|
|
"Teleport items marked for dumping to the cursor.",
|
|
|
|
"Teleport items marked for dumping to the keyboard cursor.",
|
|
|
|
df_autodump));
|
|
|
|
df_autodump,
|
|
|
|
|
|
|
|
Gui::dwarfmode_hotkey));
|
|
|
|
commands.push_back(PluginCommand(
|
|
|
|
commands.push_back(PluginCommand(
|
|
|
|
"autodump-destroy-here",
|
|
|
|
"autodump-destroy-here",
|
|
|
|
"Destroy items marked for dumping under cursor.",
|
|
|
|
"Destroy items marked for dumping under the keyboard cursor.",
|
|
|
|
df_autodump_destroy_here,
|
|
|
|
df_autodump_destroy_here,
|
|
|
|
Gui::cursor_hotkey));
|
|
|
|
Gui::dwarfmode_hotkey));
|
|
|
|
|
|
|
|
/* you can no longer select items
|
|
|
|
commands.push_back(PluginCommand(
|
|
|
|
commands.push_back(PluginCommand(
|
|
|
|
"autodump-destroy-item",
|
|
|
|
"autodump-destroy-item",
|
|
|
|
"Destroy the selected item.",
|
|
|
|
"Destroy the selected item.",
|
|
|
|
df_autodump_destroy_item,
|
|
|
|
df_autodump_destroy_item,
|
|
|
|
Gui::any_item_hotkey));
|
|
|
|
Gui::any_item_hotkey));
|
|
|
|
|
|
|
|
*/
|
|
|
|
return CR_OK;
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -340,16 +346,14 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame
|
|
|
|
MapCache MC;
|
|
|
|
MapCache MC;
|
|
|
|
int dumped_total = 0;
|
|
|
|
int dumped_total = 0;
|
|
|
|
|
|
|
|
|
|
|
|
int cx, cy, cz;
|
|
|
|
|
|
|
|
DFCoord pos_cursor;
|
|
|
|
DFCoord pos_cursor;
|
|
|
|
if(!destroy || here)
|
|
|
|
if(!destroy || here)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!Gui::getCursorCoords(cx,cy,cz))
|
|
|
|
pos_cursor = Gui::getMousePos();
|
|
|
|
{
|
|
|
|
if (!pos_cursor.isValid()) {
|
|
|
|
out.printerr("Cursor position not found. Please enable the cursor.\n");
|
|
|
|
out.printerr("Mouse cursor must be over a suitable map tile.\n");
|
|
|
|
return CR_FAILURE;
|
|
|
|
return CR_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pos_cursor = DFCoord(cx,cy,cz);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!destroy)
|
|
|
|
if (!destroy)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -441,13 +445,14 @@ command_result df_autodump(color_ostream &out, vector <string> & parameters)
|
|
|
|
|
|
|
|
|
|
|
|
command_result df_autodump_destroy_here(color_ostream &out, vector <string> & parameters)
|
|
|
|
command_result df_autodump_destroy_here(color_ostream &out, vector <string> & parameters)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// HOTKEY COMMAND; CORE ALREADY SUSPENDED
|
|
|
|
|
|
|
|
if (!parameters.empty())
|
|
|
|
if (!parameters.empty())
|
|
|
|
return CR_WRONG_USAGE;
|
|
|
|
return CR_WRONG_USAGE;
|
|
|
|
|
|
|
|
|
|
|
|
vector<string> args;
|
|
|
|
vector<string> args;
|
|
|
|
args.push_back("destroy-here");
|
|
|
|
args.push_back("destroy-here");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CoreSuspender suspend;
|
|
|
|
|
|
|
|
|
|
|
|
return autodump_main(out, args);
|
|
|
|
return autodump_main(out, args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|