diff options
| author | Robert Heinrich | 2012-04-15 23:21:36 +0200 |
|---|---|---|
| committer | Robert Heinrich | 2012-04-15 23:21:36 +0200 |
| commit | 4b3c8d46c1315683e6d80605c130c64d65fd26cc (patch) | |
| tree | 110b866a27fb612a91f497011416b79120001f79 /plugins/zone.cpp | |
| parent | 7aefae17d1b0173df99e4c788e58b5f347ebfd39 (diff) | |
| download | dfhack-4b3c8d46c1315683e6d80605c130c64d65fd26cc.tar.gz dfhack-4b3c8d46c1315683e6d80605c130c64d65fd26cc.tar.bz2 dfhack-4b3c8d46c1315683e6d80605c130c64d65fd26cc.tar.xz | |
zone: don't assign owned pets to a cage. the owner will release them, resulting into infinite hauling (df bug)
Diffstat (limited to 'plugins/zone.cpp')
| -rw-r--r-- | plugins/zone.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/plugins/zone.cpp b/plugins/zone.cpp index f17f2946..1e117123 100644 --- a/plugins/zone.cpp +++ b/plugins/zone.cpp @@ -1309,15 +1309,9 @@ command_result assignUnitToCage(color_ostream& out, df::unit* unit, df::building return CR_WRONG_USAGE; } - // try to get a fresh civzone ref - //df::general_ref_building_civzone_assignedst * ref = createCivzoneRef(); - //if(!ref) - //{ - // out << "Could not find a clonable activity zone reference" << endl - // << "You need to pen/pasture/pit at least one creature" << endl - // << "before using 'assign' for the first time." << endl; - // return CR_WRONG_USAGE; - //} + // don't assign owned pets to a cage. the owner will release them, resulting into infinite hauling (df bug) + if(unit->relations.pet_owner_id != -1) + return CR_OK; // check if unit is already pastured or caged, remove refs where necessary bool cleared_old = unassignUnitFromBuilding(unit); @@ -1955,12 +1949,11 @@ command_result df_zone (color_ostream &out, vector <string> & parameters) } // search for trained and untrained is exclusive, so drop the flags if both are specified - // (there is no trained filter, since it doesn't make much sense to throw war and hunting pets together) - //if(find_trained && find_untrained) - //{ - // find_trained=false; - // find_female=false; - //} + if(find_trained && find_not_trained) + { + find_trained=false; + find_not_trained=false; + } // search for grazer and nograzer is exclusive, so drop the flags if both are specified if(find_grazer && find_not_grazer) @@ -1969,6 +1962,8 @@ command_result df_zone (color_ostream &out, vector <string> & parameters) find_not_grazer=false; } + // todo: maybe add this type of sanity check for all remaining bools, maybe not (lots of code just to avoid parsing dumb input) + // try to cope with user dumbness if(target_agemin > target_agemax) { @@ -2129,7 +2124,7 @@ command_result df_zone (color_ostream &out, vector <string> & parameters) unitInfo(out, unit, verbose); } else if(building_assign) - { + { command_result result = assignUnitToBuilding(out, unit, building, verbose); if(result != CR_OK) return result; |
