MCPcopy Create free account
hub / github.com/DFHack/dfhack / constructAbstract

Method constructAbstract

library/modules/Buildings.cpp:1085–1124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1083}
1084
1085bool Buildings::constructAbstract(df::building *bld)
1086{
1087 CHECK_NULL_POINTER(bld);
1088 CHECK_INVALID_ARGUMENT(bld->id == -1);
1089 CHECK_INVALID_ARGUMENT(!bld->isActual());
1090
1091 if (!checkBuildingTiles(bld, true, true))
1092 return false;
1093
1094 switch (bld->getType())
1095 {
1096 case building_type::Stockpile:
1097
1098 if (auto stock = strict_virtual_cast<df::building_stockpilest>(bld))
1099 stock->stockpile_number = getMaxStockpileId() + 1;
1100 break;
1101
1102 case building_type::Civzone:
1103 if (auto zone = strict_virtual_cast<df::building_civzonest>(bld))
1104 {
1105 zone->zone_num = getMaxCivzoneId() + 1;
1106
1107 add_zone_to_all_buildings(zone);
1108 }
1109 break;
1110
1111 default:
1112 break;
1113 }
1114
1115 linkBuilding(bld);
1116
1117 if (!bld->flags.bits.exists)
1118 {
1119 bld->flags.bits.exists = true;
1120 bld->initFarmSeasons();
1121 }
1122
1123 return true;
1124}
1125
1126static bool linkForConstruct(df::job* &job, df::building *bld)
1127{

Callers

nothing calls this directly

Calls 6

checkBuildingTilesFunction · 0.85
getMaxStockpileIdFunction · 0.85
getMaxCivzoneIdFunction · 0.85
linkBuildingFunction · 0.85
getTypeMethod · 0.80

Tested by

no test coverage detected