zone: don't assign owned pets to a cage. the owner will release them, resulting into infinite hauling (df bug)

develop
Robert Heinrich 2012-04-15 23:21:36 +02:00
parent 7aefae17d1
commit 4b3c8d46c1
2 changed files with 14 additions and 16 deletions

@ -348,6 +348,9 @@ command_result changeitem_execute(
// changing a stone cabinet to wood is fine, though. as well as lots of other combinations. // changing a stone cabinet to wood is fine, though. as well as lots of other combinations.
// still, it's better to make the user activate 'force' if he really wants to. // still, it's better to make the user activate 'force' if he really wants to.
// fixme: changing material of cloth items needs more work...
// <_Q> cloth items have a "CLOTH" improvement which tells you about the cloth that was used to make it
if(force||(mat_old.subtype == mat_new.subtype && mat_old.mode==mat_new.mode)) if(force||(mat_old.subtype == mat_new.subtype && mat_old.mode==mat_new.mode))
{ {
item->setMaterial(mat_new.type); item->setMaterial(mat_new.type);

@ -1309,15 +1309,9 @@ command_result assignUnitToCage(color_ostream& out, df::unit* unit, df::building
return CR_WRONG_USAGE; return CR_WRONG_USAGE;
} }
// try to get a fresh civzone ref // don't assign owned pets to a cage. the owner will release them, resulting into infinite hauling (df bug)
//df::general_ref_building_civzone_assignedst * ref = createCivzoneRef(); if(unit->relations.pet_owner_id != -1)
//if(!ref) return CR_OK;
//{
// 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;
//}
// check if unit is already pastured or caged, remove refs where necessary // check if unit is already pastured or caged, remove refs where necessary
bool cleared_old = unassignUnitFromBuilding(unit); 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 // 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_not_trained)
//if(find_trained && find_untrained) {
//{ find_trained=false;
// find_trained=false; find_not_trained=false;
// find_female=false; }
//}
// search for grazer and nograzer is exclusive, so drop the flags if both are specified // search for grazer and nograzer is exclusive, so drop the flags if both are specified
if(find_grazer && find_not_grazer) if(find_grazer && find_not_grazer)
@ -1969,6 +1962,8 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
find_not_grazer=false; 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 // try to cope with user dumbness
if(target_agemin > target_agemax) if(target_agemin > target_agemax)
{ {