MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / startingBase

Method startingBase

game/state/city/base.cpp:211–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211void Base::startingBase(GameState &state)
212{
213 while (!tryToPlaceInitialFacilities(state, *this))
214 {
215 LogInfo("Failed to place facilities, trying again");
216 // Cleanup the partially-placed base
217 for (int y = 0; y < this->SIZE; y++)
218 {
219 for (int x = 0; x < this->SIZE; x++)
220 {
221 this->destroyFacility(state, {x, y});
222 }
223 }
224 // There always must be a single 'access lift' base module even if everything else has been
225 // removed
226 if (this->facilities.size() > 1)
227 {
228 LogError("Failed to cleanup facilities after unsuccessful random place");
229 }
230 if (this->facilities.empty())
231 {
232 LogError("No access lift after facility cleanup after unsuccessful random place");
233 }
234 if (this->facilities[0]->type->fixed != true)
235 {
236 LogError("Remaining facility after cleanup not an access lift?");
237 }
238 }
239}
240
241Base::BuildError Base::canBuildFacility(StateRef<FacilityType> type, Vec2<int> pos, bool free) const
242{

Callers 1

Calls 4

destroyFacilityMethod · 0.95
emptyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected