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

Method updateLocation

game/ui/components/agentassignment.cpp:221–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221void AgentAssignment::updateLocation()
222{
223 agents.clear();
224 vehicles.clear();
225 buildings.clear();
226
227 // update agents, vehicles and buildings lists
228 if (building)
229 {
230 for (auto &a : state->agents)
231 {
232 if (a.second->owner == state->getPlayer() &&
233 a.second->type->role == AgentType::Role::Soldier &&
234 (a.second->currentBuilding == building ||
235 (a.second->currentVehicle &&
236 a.second->currentVehicle->currentBuilding == building)))
237 {
238 agents.emplace_back(a.second);
239 }
240 }
241 for (auto &v : state->vehicles)
242 {
243 if (v.second->owner == state->getPlayer() && v.second->currentBuilding == building)
244 {
245 vehicles.emplace_back(v.second);
246 }
247 }
248 buildings.emplace_back(building);
249 }
250 else if (vehicle)
251 {
252 for (auto &a : state->agents)
253 {
254 if (a.second->owner == state->getPlayer() &&
255 a.second->type->role == AgentType::Role::Soldier &&
256 a.second->currentVehicle == vehicle)
257 {
258 agents.emplace_back(a.second);
259 }
260 }
261 vehicles.emplace_back(vehicle);
262 }
263 else if (agent)
264 {
265 agents.emplace_back(agent);
266 }
267 else
268 {
269 for (auto &a : state->agents)
270 {
271 if (a.second->owner == state->getPlayer() &&
272 a.second->type->role == AgentType::Role::Soldier)
273 {
274 agents.emplace_back(a.second);
275 }
276 }
277 for (auto &v : state->vehicles)
278 {

Callers

nothing calls this directly

Calls 15

getPlayerMethod · 0.80
emptyMethod · 0.80
addCallbackMethod · 0.80
setDirtyMethod · 0.80
findControlMethod · 0.80
clearSelectionMethod · 0.80
setFuncIsVisibleItemMethod · 0.80
getParentMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected