Merge remote-tracking branch 'q-github/master'

develop
Alexander Gavrilov 2012-01-16 19:55:47 +04:00
commit 89cb12add1
31 changed files with 276 additions and 266 deletions

@ -50,6 +50,18 @@ namespace DFHack
if(bits) if(bits)
memset(bits, 0, size); memset(bits, 0, size);
} }
void extend (T index)
{
uint32_t newsize = (index / 8) + 1;
if (newsize <= size)
return;
uint8_t *newbits = new uint8_t[newsize];
memset(newbits, 0, newsize);
memcpy(newbits, bits, size);
delete[] bits;
bits = newbits;
size = newsize;
}
void set (T index, bool value = true) void set (T index, bool value = true)
{ {
if(!value) if(!value)
@ -58,7 +70,8 @@ namespace DFHack
return; return;
} }
uint32_t byte = index / 8; uint32_t byte = index / 8;
if(byte < size) extend(index);
//if(byte < size)
{ {
uint8_t bit = 1 << (index % 8); uint8_t bit = 1 << (index % 8);
bits[byte] |= bit; bits[byte] |= bit;
@ -76,7 +89,8 @@ namespace DFHack
void toggle (T index) void toggle (T index)
{ {
uint32_t byte = index / 8; uint32_t byte = index / 8;
if(byte < size) extend(index);
//if(byte < size)
{ {
uint8_t bit = 1 << (index % 8); uint8_t bit = 1 << (index % 8);
bits[byte] ^= bit; bits[byte] ^= bit;

@ -1,4 +1,4 @@
/* /*
https://github.com/peterix/dfhack https://github.com/peterix/dfhack
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com) Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
@ -40,14 +40,14 @@ using namespace std;
#include "modules/Items.h" #include "modules/Items.h"
#include "DataDefs.h" #include "DataDefs.h"
#include <df/world.h> #include "df/world.h"
#include <df/ui.h> #include "df/ui.h"
#include <df/job.h> #include "df/job.h"
#include <df/job_item.h> #include "df/job_item.h"
#include <df/job_list_link.h> #include "df/job_list_link.h"
#include <df/general_ref.h> #include "df/general_ref.h"
#include <df/general_ref_unit_workerst.h> #include "df/general_ref_unit_workerst.h"
#include <df/general_ref_building_holderst.h> #include "df/general_ref_building_holderst.h"
using namespace DFHack; using namespace DFHack;
using namespace df::enums; using namespace df::enums;

@ -5,27 +5,25 @@
#include <sstream> #include <sstream>
#include <climits> #include <climits>
#include <vector> #include <vector>
#include <string>
#include <algorithm>
#include <set> #include <set>
using namespace std; using namespace std;
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <vector> #include "modules/Maps.h"
#include <string> #include "modules/Gui.h"
#include <algorithm> #include "modules/Items.h"
#include <modules/Maps.h> #include "modules/Materials.h"
#include "modules/MapCache.h"
#include <modules/Gui.h>
#include <modules/Items.h> #include "DataDefs.h"
#include <modules/Materials.h> #include "df/item.h"
#include <modules/MapCache.h> #include "df/world.h"
#include "df/general_ref.h"
#include <DataDefs.h>
#include <df/item.h>
#include <df/world.h>
#include <df/general_ref_unit_holderst.h>
using namespace DFHack; using namespace DFHack;
using MapExtras::Block; using MapExtras::Block;
@ -94,7 +92,7 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
return CR_OK; return CR_OK;
} }
} }
c->Suspend();
DFHack::VersionInfo *mem = c->vinfo; DFHack::VersionInfo *mem = c->vinfo;
DFHack::Gui * Gui = c->getGui(); DFHack::Gui * Gui = c->getGui();
DFHack::Items * Items = c->getItems(); DFHack::Items * Items = c->getItems();
@ -265,7 +263,7 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
// Is this necessary? Is "forbid" a dirtyable attribute like "dig" is? // Is this necessary? Is "forbid" a dirtyable attribute like "dig" is?
Maps->WriteDirtyBit(cx/16, cy/16, cz, true); Maps->WriteDirtyBit(cx/16, cy/16, cz, true);
} }
c->con.print("Done. %d items %s.\n", dumped_total, destroy ? "marked for desctruction" : "quickdumped"); c->con.print("Done. %d items %s.\n", dumped_total, destroy ? "marked for destruction" : "quickdumped");
return CR_OK; return CR_OK;
} }
@ -338,7 +336,7 @@ DFhackCExport command_result df_autodump_destroy_item(Core * c, vector <string>
for (unsigned i = 0; i < item->itemrefs.size(); i++) for (unsigned i = 0; i < item->itemrefs.size(); i++)
{ {
df::general_ref *ref = item->itemrefs[i]; df::general_ref *ref = item->itemrefs[i];
if (strict_virtual_cast<df::general_ref_unit_holderst>(ref)) if (ref->getType() == df::general_ref_type::unit_holder)
{ {
c->con.printerr("Choosing not to destroy items in unit inventory.\n"); c->con.printerr("Choosing not to destroy items in unit inventory.\n");
return CR_FAILURE; return CR_FAILURE;

@ -1,7 +1,7 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"

@ -9,16 +9,16 @@
using namespace std; using namespace std;
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <modules/Maps.h> #include "modules/Maps.h"
#include <modules/Items.h> #include "modules/Items.h"
#include <modules/Units.h> #include "modules/Units.h"
#include <modules/Materials.h> #include "modules/Materials.h"
#include <modules/Translation.h> #include "modules/Translation.h"
using namespace DFHack; using namespace DFHack;
DFhackCExport command_result df_cleanowned (Core * c, vector <string> & parameters); DFhackCExport command_result df_cleanowned (Core * c, vector <string> & parameters);

@ -1,16 +1,16 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <modules/Vermin.h> #include "modules/Vermin.h"
#include "modules/Materials.h"
using std::vector; using std::vector;
using std::string; using std::string;
using namespace DFHack; using namespace DFHack;
using namespace DFHack::Simple; using namespace DFHack::Simple;
#include <DFHack.h>
DFhackCExport command_result colonies (Core * c, vector <string> & parameters); DFhackCExport command_result colonies (Core * c, vector <string> & parameters);
@ -34,8 +34,8 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
} }
void destroyColonies(); void destroyColonies();
void convertColonies(DFHack::Materials *Materials); void convertColonies(Materials *Materials);
void showColonies(Core *c, DFHack::Materials *Materials); void showColonies(Core *c, Materials *Materials);
DFhackCExport command_result colonies (Core * c, vector <string> & parameters) DFhackCExport command_result colonies (Core * c, vector <string> & parameters)
{ {
@ -106,7 +106,7 @@ void destroyColonies()
} }
// Convert all colonies to honey bees. // Convert all colonies to honey bees.
void convertColonies(DFHack::Materials *Materials) void convertColonies(Materials *Materials)
{ {
int bee_idx = -1; int bee_idx = -1;
for (size_t i = 0; i < Materials->raceEx.size(); i++) for (size_t i = 0; i < Materials->raceEx.size(); i++)
@ -136,7 +136,7 @@ void convertColonies(DFHack::Materials *Materials)
} }
} }
void showColonies(Core *c, DFHack::Materials *Materials) void showColonies(Core *c, Materials *Materials)
{ {
uint32_t numSpawnPoints = Vermin::getNumVermin(); uint32_t numSpawnPoints = Vermin::getNumVermin();
int numColonies = 0; int numColonies = 0;

@ -1,15 +1,15 @@
// De-ramp. All ramps marked for removal are replaced with given tile (presently, normal floor). // De-ramp. All ramps marked for removal are replaced with given tile (presently, normal floor).
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/map_block.h" #include "df/map_block.h"
#include "df/tile_dig_designation.h" #include "df/tile_dig_designation.h"
#include <TileTypes.h> #include "TileTypes.h"
using std::vector; using std::vector;
using std::string; using std::string;

@ -1,11 +1,11 @@
// Dry Buckets : Remove all "water" objects from buckets scattered around the fortress // Dry Buckets : Remove all "water" objects from buckets scattered around the fortress
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <DataDefs.h> #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/item.h" #include "df/item.h"
#include "df/builtin_mats.h" #include "df/builtin_mats.h"

@ -1,9 +1,9 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <DataDefs.h> #include "DataDefs.h"
#include "df/ui.h" #include "df/ui.h"
#include "df/world.h" #include "df/world.h"
#include "df/unit.h" #include "df/unit.h"

@ -6,12 +6,12 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <modules/Maps.h> #include "modules/Maps.h"
#include <modules/MapCache.h> #include "modules/MapCache.h"
#include <modules/Gui.h> #include "modules/Gui.h"
using std::stack; using std::stack;
using MapExtras::MapCache; using MapExtras::MapCache;
using namespace DFHack; using namespace DFHack;

@ -1,11 +1,11 @@
// I'll fix his little red wagon... // I'll fix his little red wagon...
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <DataDefs.h> #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/historical_entity.h" #include "df/historical_entity.h"
#include "df/entity_raw.h" #include "df/entity_raw.h"

@ -1,11 +1,11 @@
// This tool counts static tiles and active flows of water and magma. // This tool counts static tiles and active flows of water and magma.
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <DataDefs.h> #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/map_block.h" #include "df/map_block.h"
#include "df/tile_liquid.h" #include "df/tile_liquid.h"

@ -1,12 +1,12 @@
// Designate all matching plants for gathering/cutting // Designate all matching plants for gathering/cutting
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <DataDefs.h> #include "DataDefs.h"
#include <TileTypes.h> #include "TileTypes.h"
#include "df/world.h" #include "df/world.h"
#include "df/map_block.h" #include "df/map_block.h"
#include "df/tile_dig_designation.h" #include "df/tile_dig_designation.h"

@ -1,10 +1,10 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <DataDefs.h> #include "DataDefs.h"
#include <df/d_init.h> #include "df/d_init.h"
using std::vector; using std::vector;
using std::string; using std::string;

@ -1,30 +1,29 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <MiscUtils.h> #include "MiscUtils.h"
#include <modules/Materials.h> #include "modules/Materials.h"
#include <modules/Items.h> #include "modules/Items.h"
#include <modules/Gui.h> #include "modules/Gui.h"
#include <modules/Job.h> #include "modules/Job.h"
#include <DataDefs.h> #include "DataDefs.h"
#include <df/world.h> #include "df/world.h"
#include <df/ui.h> #include "df/ui.h"
#include <df/ui_build_selector.h> #include "df/ui_build_selector.h"
#include <df/ui_build_item_req.h> #include "df/ui_build_item_req.h"
#include <df/build_req_choice_genst.h> #include "df/build_req_choice_genst.h"
#include <df/build_req_choice_specst.h> #include "df/build_req_choice_specst.h"
#include <df/building_workshopst.h> #include "df/building_workshopst.h"
#include <df/building_furnacest.h> #include "df/building_furnacest.h"
#include <df/job.h> #include "df/job.h"
#include <df/job_item.h> #include "df/job_item.h"
#include <df/job_list_link.h> #include "df/job_list_link.h"
#include <df/item.h> #include "df/item.h"
#include <df/tool_uses.h> #include "df/tool_uses.h"
#include <df/general_ref.h> #include "df/general_ref.h"
#include <df/general_ref_unit_workerst.h>
using std::vector; using std::vector;
using std::string; using std::string;

@ -10,14 +10,14 @@ using std::endl;
using std::set; using std::set;
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <modules/Vegetation.h> #include "modules/Vegetation.h"
#include <modules/Maps.h> #include "modules/Maps.h"
#include <modules/Gui.h> #include "modules/Gui.h"
#include <TileTypes.h> #include "TileTypes.h"
#include <modules/MapCache.h> #include "modules/MapCache.h"
using namespace MapExtras; using namespace MapExtras;
using namespace DFHack; using namespace DFHack;

@ -2,12 +2,12 @@
using namespace std; using namespace std;
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <modules/World.h> #include "modules/World.h"
#include <stdlib.h> #include <stdlib.h>
using namespace DFHack; using namespace DFHack;

@ -6,14 +6,14 @@
#include <string> #include <string>
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <modules/Vegetation.h> #include "modules/Vegetation.h"
#include <modules/Maps.h> #include "modules/Maps.h"
#include <modules/Gui.h> #include "modules/Gui.h"
#include <TileTypes.h> #include "TileTypes.h"
#include <modules/MapCache.h> #include "modules/MapCache.h"
using std::vector; using std::vector;
using std::string; using std::string;

@ -4,23 +4,22 @@
#include <iomanip> #include <iomanip>
#include <climits> #include <climits>
#include <vector> #include <vector>
#include <string>
#include <sstream> #include <sstream>
#include <ctime> #include <ctime>
#include <cstdio> #include <cstdio>
using namespace std; using namespace std;
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <vector> #include "modules/Units.h"
#include <string> #include "modules/Maps.h"
#include <modules/Units.h> #include "modules/Gui.h"
#include <modules/Maps.h> #include "modules/Materials.h"
#include <modules/Gui.h> #include "modules/MapCache.h"
#include <modules/Materials.h> #include "MiscUtils.h"
#include <modules/MapCache.h>
#include <MiscUtils.h>
using std::vector; using std::vector;
using std::string; using std::string;

@ -13,11 +13,11 @@
#include <vector> #include <vector>
using namespace std; using namespace std;
#include <DFHack.h>
#include <modules/MapCache.h>
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <PluginManager.h> #include "Export.h"
#include "PluginManager.h"
#include "modules/MapCache.h"
using namespace DFHack; using namespace DFHack;

@ -2,14 +2,14 @@
// Necessary for worlds generated prior to version 0.31.19 - otherwise, outdoor shrubs and trees no longer grow. // Necessary for worlds generated prior to version 0.31.19 - otherwise, outdoor shrubs and trees no longer grow.
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <DataDefs.h> #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/map_block.h" #include "df/map_block.h"
#include <TileTypes.h> #include "TileTypes.h"
using std::string; using std::string;
using std::vector; using std::vector;

@ -1,18 +1,18 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <modules/Gui.h> #include "modules/Gui.h"
#include <DataDefs.h> #include "DataDefs.h"
#include <df/ui.h> #include "df/ui.h"
#include <df/world.h> #include "df/world.h"
#include <df/squad.h> #include "df/squad.h"
#include <df/unit.h> #include "df/unit.h"
#include <df/unit_soul.h> #include "df/unit_soul.h"
#include <df/historical_figure.h> #include "df/historical_figure.h"
#include <df/language_name.h> #include "df/language_name.h"
#include <stdlib.h> #include <stdlib.h>

@ -3,13 +3,13 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <modules/Maps.h> #include "modules/Maps.h"
#include <modules/World.h> #include "modules/World.h"
#include <modules/MapCache.h> #include "modules/MapCache.h"
#include <modules/Gui.h> #include "modules/Gui.h"
using MapExtras::MapCache; using MapExtras::MapCache;
using namespace DFHack; using namespace DFHack;

@ -12,7 +12,7 @@
#include "modules/Items.h" #include "modules/Items.h"
#include "modules/World.h" #include "modules/World.h"
#include "modules/kitchen.h" #include "modules/kitchen.h"
#include <VersionInfo.h> #include "VersionInfo.h"
using DFHack::t_materialType; using DFHack::t_materialType;
using DFHack::t_materialIndex; using DFHack::t_materialIndex;

@ -1,14 +1,14 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <DataDefs.h> #include "DataDefs.h"
#include <df/world.h> #include "df/world.h"
#include <df/ui.h> #include "df/ui.h"
#include <df/building_stockpilest.h> #include "df/building_stockpilest.h"
#include <df/selection_rect.h> #include "df/selection_rect.h"
#include <df/viewscreen_dwarfmodest.h> #include "df/viewscreen_dwarfmodest.h"
using std::vector; using std::vector;
using std::string; using std::string;

@ -11,14 +11,14 @@ using std::endl;
using std::set; using std::set;
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <modules/Vegetation.h> #include "modules/Vegetation.h"
#include <modules/Maps.h> #include "modules/Maps.h"
#include <modules/Gui.h> #include "modules/Gui.h"
#include <TileTypes.h> #include "TileTypes.h"
#include <modules/MapCache.h> #include "modules/MapCache.h"
using namespace MapExtras; using namespace MapExtras;
using namespace DFHack; using namespace DFHack;

@ -5,13 +5,13 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <modules/Maps.h> #include "modules/Maps.h"
#include <modules/World.h> #include "modules/World.h"
#include <modules/MapCache.h> #include "modules/MapCache.h"
#include <modules/Gui.h> #include "modules/Gui.h"
using MapExtras::MapCache; using MapExtras::MapCache;
using namespace DFHack; using namespace DFHack;

@ -1,10 +1,10 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.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/MapCache.h> #include "modules/MapCache.h"
#include <vector> #include <vector>
#include <cstdio> #include <cstdio>
#include <stack> #include <stack>

@ -8,11 +8,11 @@
#include <string.h> #include <string.h>
using namespace std; using namespace std;
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <modules/Graphic.h> #include "modules/Graphic.h"
#include <modules/Gui.h> #include "modules/Gui.h"
using namespace DFHack; using namespace DFHack;
DFhackCExport command_result df_versionosd (Core * c, vector <string> & parameters); DFhackCExport command_result df_versionosd (Core * c, vector <string> & parameters);

@ -1,10 +1,10 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <modules/World.h> #include "modules/World.h"
using std::vector; using std::vector;
using std::string; using std::string;

@ -1,41 +1,41 @@
#include "Core.h" #include "Core.h"
#include <Console.h> #include "Console.h"
#include <Export.h> #include "Export.h"
#include <PluginManager.h> #include "PluginManager.h"
#include <MiscUtils.h> #include "MiscUtils.h"
#include <modules/Materials.h> #include "modules/Materials.h"
#include <modules/Items.h> #include "modules/Items.h"
#include <modules/Gui.h> #include "modules/Gui.h"
#include <modules/Job.h> #include "modules/Job.h"
#include <modules/World.h> #include "modules/World.h"
#include <DataDefs.h> #include "DataDefs.h"
#include <df/world.h> #include "df/world.h"
#include <df/ui.h> #include "df/ui.h"
#include <df/building_workshopst.h> #include "df/building_workshopst.h"
#include <df/building_furnacest.h> #include "df/building_furnacest.h"
#include <df/job.h> #include "df/job.h"
#include <df/job_item.h> #include "df/job_item.h"
#include <df/job_list_link.h> #include "df/job_list_link.h"
#include <df/dfhack_material_category.h> #include "df/dfhack_material_category.h"
#include <df/item.h> #include "df/item.h"
#include <df/items_other_id.h> #include "df/items_other_id.h"
#include <df/tool_uses.h> #include "df/tool_uses.h"
#include <df/general_ref.h> #include "df/general_ref.h"
#include <df/general_ref_unit_workerst.h> #include "df/general_ref_unit_workerst.h"
#include <df/general_ref_unit_holderst.h> #include "df/general_ref_unit_holderst.h"
#include <df/general_ref_building_holderst.h> #include "df/general_ref_building_holderst.h"
#include <df/general_ref_contains_itemst.h> #include "df/general_ref_contains_itemst.h"
#include <df/general_ref_contained_in_itemst.h> #include "df/general_ref_contained_in_itemst.h"
#include <df/general_ref_contains_unitst.h> #include "df/general_ref_contains_unitst.h"
#include <df/itemdef_foodst.h> #include "df/itemdef_foodst.h"
#include <df/reaction.h> #include "df/reaction.h"
#include <df/reaction_reagent_itemst.h> #include "df/reaction_reagent_itemst.h"
#include <df/reaction_product_itemst.h> #include "df/reaction_product_itemst.h"
#include <df/plant_raw.h> #include "df/plant_raw.h"
#include <df/inorganic_raw.h> #include "df/inorganic_raw.h"
#include <df/builtin_mats.h> #include "df/builtin_mats.h"
using std::vector; using std::vector;
using std::string; using std::string;
@ -984,7 +984,7 @@ static void dryBucket(df::item *item)
for (unsigned i = 0; i < item->itemrefs.size(); i++) for (unsigned i = 0; i < item->itemrefs.size(); i++)
{ {
df::general_ref *ref = item->itemrefs[i]; df::general_ref *ref = item->itemrefs[i];
if (strict_virtual_cast<df::general_ref_contains_itemst>(ref)) if (ref->getType() == df::general_ref_type::contains_item)
{ {
df::item *obj = ref->getItem(); df::item *obj = ref->getItem();
@ -1006,20 +1006,20 @@ static bool itemBusy(df::item *item)
for (unsigned i = 0; i < item->itemrefs.size(); i++) for (unsigned i = 0; i < item->itemrefs.size(); i++)
{ {
df::general_ref *ref = item->itemrefs[i]; df::general_ref *ref = item->itemrefs[i];
if (strict_virtual_cast<df::general_ref_contains_itemst>(ref)) if (ref->getType() == df::general_ref_type::contains_item)
{ {
df::item *obj = ref->getItem(); df::item *obj = ref->getItem();
if (obj && !obj->flags.bits.garbage_colect) if (obj && !obj->flags.bits.garbage_colect)
return true; return true;
} }
else if (strict_virtual_cast<df::general_ref_contains_unitst>(ref)) else if (ref->getType() == df::general_ref_type::contains_unit)
return true; return true;
else if (strict_virtual_cast<df::general_ref_unit_holderst>(ref)) else if (ref->getType() == df::general_ref_type::unit_holder)
{ {
if (!item->flags.bits.in_job) if (!item->flags.bits.in_job)
return true; return true;
} }
else if (strict_virtual_cast<df::general_ref_contained_in_itemst>(ref)) else if (ref->getType() == df::general_ref_type::contained_in_item)
{ {
df::item *obj = ref->getItem(); df::item *obj = ref->getItem();
if (!obj) if (!obj)