From f86371cfc3114dc08963cb3d0a521ca3660ac5ad Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 10 Nov 2012 18:06:41 +0400 Subject: [PATCH] Try blocking any use of stockpiles for squad stuff in fix-armory. --- plugins/fix-armory.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/plugins/fix-armory.cpp b/plugins/fix-armory.cpp index b937d40e8..99e5fd500 100644 --- a/plugins/fix-armory.cpp +++ b/plugins/fix-armory.cpp @@ -132,6 +132,9 @@ DFhackCExport command_result plugin_shutdown (color_ostream &out) * grace period during which the items can be instantly picked up again. */ +// Completely block the use of stockpiles +#define NO_STOCKPILES + // Check if the item is assigned to any use controlled by the military tab static bool is_assigned_item(df::item *item) { @@ -143,19 +146,6 @@ static bool is_assigned_item(df::item *item) if (idx < 0) return false; - // Exclude weapons used by miners, wood cutters etc - switch (type) { - case item_type::WEAPON: - // the game code also checks this for ammo, funnily enough - // maybe it's not just for weapons?.. - if (binsearch_index(ui->equipment.work_weapons, item->id) >= 0) - return false; - break; - - default: - break; - } - return true; } @@ -328,6 +318,16 @@ template struct armory_hook : Item { */ DEFINE_VMETHOD_INTERPOSE(bool, isCollected, ()) { +#ifdef NO_STOCKPILES + /* + * Completely block any items assigned to a squad from being stored + * in stockpiles. The reason is that I still observe haulers running + * around with bins to pick them up for some reason. There could be + * some unaccounted race conditions involved. + */ + if (is_assigned_item(this)) + return false; +#else // Block stockpiling of items in the armory. if (is_in_armory(this)) return false; @@ -354,6 +354,7 @@ template struct armory_hook : Item { return false; } } +#endif // Call the original vmethod return INTERPOSE_NEXT(isCollected)();