Forbid stuff from bins in siege-engine, if forbid ammo standing order set.

develop
Alexander Gavrilov 2012-09-27 10:43:42 +04:00
parent 2e5f3c4620
commit 164c61b638
2 changed files with 8 additions and 0 deletions

@ -707,6 +707,9 @@ namespace DFHack {
// Global object pointers // Global object pointers
#include "df/global_objects.h" #include "df/global_objects.h"
#define DF_GLOBAL_VALUE(name,defval) (df::global::name ? *df::global::name : defval)
#define DF_GLOBAL_FIELD(name,fname,defval) (df::global::name ? df::global::name->fname : defval)
// A couple of headers that have to be included at once // A couple of headers that have to be included at once
#include "df/coord2d.h" #include "df/coord2d.h"
#include "df/coord.h" #include "df/coord.h"

@ -1573,6 +1573,8 @@ struct projectile_hook : df::proj_itemst {
if (next_pos.z == cur_pos.z && !isPassableTile(next_pos)) if (next_pos.z == cur_pos.z && !isPassableTile(next_pos))
start_z = 49000; start_z = 49000;
bool forbid_ammo = DF_GLOBAL_VALUE(standing_orders_forbid_used_ammo, false);
MapExtras::MapCache mc; MapExtras::MapCache mc;
std::vector<df::item*> contents; std::vector<df::item*> contents;
Items::getContainedItems(item, &contents); Items::getContainedItems(item, &contents);
@ -1581,6 +1583,9 @@ struct projectile_hook : df::proj_itemst {
{ {
auto child = contents[i]; auto child = contents[i];
if (forbid_ammo)
child->flags.bits.forbid = true;
// Liquids are vaporized so that they cover nearby units // Liquids are vaporized so that they cover nearby units
if (child->isLiquid()) if (child->isLiquid())
{ {