MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / validateHeadquarterBuilding

Function validateHeadquarterBuilding

src/OpenLoco/src/EditorController.cpp:273–297  ·  view source on GitHub ↗

0x004747D4

Source from the content-addressed store, hash-verified

271
272 // 0x004747D4
273 static StringId validateHeadquarterBuilding()
274 {
275 size_t numHeadquarterTypes = 0;
276 for (LoadedObjectId id = 0; id < ObjectManager::getMaxObjects(ObjectType::building); ++id)
277 {
278 auto* buildingObj = ObjectManager::get<BuildingObject>(id);
279 if (buildingObj == nullptr)
280 {
281 continue;
282 }
283 if (buildingObj->hasFlags(BuildingObjectFlags::isHeadquarters))
284 {
285 numHeadquarterTypes++;
286 }
287 }
288 if (numHeadquarterTypes == 0)
289 {
290 return StringIds::company_headquarter_building_type_must_be_selected;
291 }
292 else if (numHeadquarterTypes > 1)
293 {
294 return StringIds::only_one_company_headquarter_building_type_must_be_selected;
295 }
296 return StringIds::null;
297 }
298
299 // 0x0046F910
300 static void setupMultiplayerData()

Callers 1

goToNextStepFunction · 0.85

Calls 2

getMaxObjectsFunction · 0.85
hasFlagsMethod · 0.45

Tested by

no test coverage detected