Merge pull request #2834 from TealSeer/zonecheckfixes

Fix logic for zone type checks and re-enables autonestbox
develop
Myk 2023-02-06 16:21:17 -08:00 committed by GitHub
commit 26e57a9780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 23 deletions

@ -275,7 +275,6 @@ DFHACK_EXPORT bool isActivityZone(df::building * building);
DFHACK_EXPORT bool isPenPasture(df::building * building); DFHACK_EXPORT bool isPenPasture(df::building * building);
DFHACK_EXPORT bool isPitPond(df::building * building); DFHACK_EXPORT bool isPitPond(df::building * building);
DFHACK_EXPORT bool isActive(df::building * building); DFHACK_EXPORT bool isActive(df::building * building);
DFHACK_EXPORT bool isHospital(df::building * building);
DFHACK_EXPORT bool isAnimalTraining(df::building * building); DFHACK_EXPORT bool isAnimalTraining(df::building * building);
DFHACK_EXPORT df::building* findPenPitAt(df::coord coord); DFHACK_EXPORT df::building* findPenPitAt(df::coord coord);

@ -1589,45 +1589,31 @@ bool Buildings::isPenPasture(df::building * building)
if (!isActivityZone(building)) if (!isActivityZone(building))
return false; return false;
/* TODO: understand how this changes for v50 return ((df::building_civzonest*)building)->type == civzone_type::Pen;
return ((df::building_civzonest*) building)->zone_flags.bits.pen_pasture != 0;
*/ return false;
} }
bool Buildings::isPitPond(df::building * building) bool Buildings::isPitPond(df::building * building)
{ {
if (!isActivityZone(building)) if (!isActivityZone(building))
return false; return false;
/* TODO: understand how this changes for v50
return ((df::building_civzonest*) building)->zone_flags.bits.pit_pond != 0; return ((df::building_civzonest*)building)->type == civzone_type::Pond;
*/ return false;
} }
bool Buildings::isActive(df::building * building) bool Buildings::isActive(df::building * building)
{ {
if (!isActivityZone(building)) if (!isActivityZone(building))
return false; return false;
/* TODO: understand how this changes for v50 // 8 is the value obtained by reverse engineering
return ((df::building_civzonest*) building)->zone_flags.bits.active != 0; return ((df::building_civzonest*)building)->is_active == 8;
*/ return false;
} }
bool Buildings::isHospital(df::building * building)
{
if (!isActivityZone(building))
return false;
/* TODO: understand how this changes for v50
return ((df::building_civzonest*) building)->zone_flags.bits.hospital != 0;
*/ return false;
}
bool Buildings::isAnimalTraining(df::building * building) bool Buildings::isAnimalTraining(df::building * building)
{ {
if (!isActivityZone(building)) if (!isActivityZone(building))
return false; return false;
/* TODO: understand how this changes for v50
return ((df::building_civzonest*) building)->zone_flags.bits.animal_training != 0; return ((df::building_civzonest*)building)->type == civzone_type::AnimalTraining;
*/ return false;
} }
// returns building of pen/pit at cursor position (NULL if nothing found) // returns building of pen/pit at cursor position (NULL if nothing found)

@ -84,7 +84,7 @@ dfhack_plugin(autofarm autofarm.cpp)
add_subdirectory(autolabor) add_subdirectory(autolabor)
#dfhack_plugin(automaterial automaterial.cpp LINK_LIBRARIES lua) #dfhack_plugin(automaterial automaterial.cpp LINK_LIBRARIES lua)
dfhack_plugin(automelt automelt.cpp LINK_LIBRARIES lua) dfhack_plugin(automelt automelt.cpp LINK_LIBRARIES lua)
#dfhack_plugin(autonestbox autonestbox.cpp LINK_LIBRARIES lua) dfhack_plugin(autonestbox autonestbox.cpp LINK_LIBRARIES lua)
#dfhack_plugin(autotrade autotrade.cpp) #dfhack_plugin(autotrade autotrade.cpp)
dfhack_plugin(blueprint blueprint.cpp LINK_LIBRARIES lua) dfhack_plugin(blueprint blueprint.cpp LINK_LIBRARIES lua)
#dfhack_plugin(burrows burrows.cpp LINK_LIBRARIES lua) #dfhack_plugin(burrows burrows.cpp LINK_LIBRARIES lua)