Merge remote-tracking branch 'cdombroski/dfhack-484' into develop

Conflicts:
	NEWS
develop
expwnent 2015-01-31 20:22:17 -05:00
commit 1d8fd55a4a
3 changed files with 23 additions and 1 deletions

@ -6,6 +6,7 @@ DFHack Future
dfhack.run_script should correctly find save-specific scripts now. dfhack.run_script should correctly find save-specific scripts now.
Updated add-thought to properly affect stress. Updated add-thought to properly affect stress.
hfs-pit should work now hfs-pit should work now
Autobutcher takes gelding into account
New Plugins New Plugins
New Scripts New Scripts
New Tweaks New Tweaks

@ -1888,6 +1888,9 @@ Creatures trained for war or hunting will be ignored as well.
Creatures assigned to cages will be ignored if the cage is defined as a room Creatures assigned to cages will be ignored if the cage is defined as a room
(to avoid butchering unnamed zoo animals). (to avoid butchering unnamed zoo animals).
Creatures who will not reproduce (because they're not interested in the opposite
sex or have been gelded) have first priority for butchering.
Once you have too much adults, the oldest will be butchered first. Once you have too much adults, the oldest will be butchered first.
Once you have too much kids, the youngest will be butchered first. Once you have too much kids, the youngest will be butchered first.
If you don't set any target count the following default will be used: If you don't set any target count the following default will be used:

@ -68,6 +68,7 @@ using namespace std;
#include <df/creature_raw.h> #include <df/creature_raw.h>
#include <df/caste_raw.h> #include <df/caste_raw.h>
#include "df/unit_soul.h" #include "df/unit_soul.h"
#include "df/unit_wound.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "modules/Translation.h" #include "modules/Translation.h"
@ -347,6 +348,7 @@ bool isOwnCiv(df::unit* unit);
bool isMerchant(df::unit* unit); bool isMerchant(df::unit* unit);
bool isForest(df::unit* unit); bool isForest(df::unit* unit);
bool isGay(df::unit* unit); bool isGay(df::unit* unit);
bool isGelded(df::unit* unit);
bool isActivityZone(df::building * building); bool isActivityZone(df::building * building);
bool isPenPasture(df::building * building); bool isPenPasture(df::building * building);
@ -714,6 +716,21 @@ bool isGay(df::unit* unit)
|| ! isFemale(unit) && ! (orientation.whole & (orientation.mask_marry_female | orientation.mask_romance_female)); || ! isFemale(unit) && ! (orientation.whole & (orientation.mask_marry_female | orientation.mask_romance_female));
} }
bool isGelded(df::unit* unit)
{
auto wounds = unit->body.wounds;
for(auto wound = wounds.begin(); wound != wounds.end(); ++wound)
{
auto parts = (*wound)->parts;
for (auto part = parts.begin(); part != parts.end(); ++part)
{
if ((*part)->flags2.bits.gelded)
return true;
}
}
return false;
}
// dump some unit info // dump some unit info
void unitInfo(color_ostream & out, df::unit* unit, bool verbose = false) void unitInfo(color_ostream & out, df::unit* unit, bool verbose = false)
{ {
@ -3481,7 +3498,8 @@ command_result autoButcher( color_ostream &out, bool verbose = false )
|| isAvailableForAdoption(unit) || isAvailableForAdoption(unit)
|| unit->name.has_name ) || unit->name.has_name )
w->PushProtectedUnit(unit); w->PushProtectedUnit(unit);
else if (isGay(unit)) else if ( isGay(unit)
|| isGelded(unit))
w->PushPriorityUnit(unit); w->PushPriorityUnit(unit);
else else
w->PushUnit(unit); w->PushUnit(unit);