MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / UpdateField

Method UpdateField

engine/Poseidon/AI/AICenterImplPreview.cpp:340–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340void AICenter::UpdateField(int x, int z)
341{
342 float changeEnemy = 0;
343 float changeUnknown = 0;
344 BYTE& dirty = _map->_dirty(x, z);
345 if (dirty & DIRTY_ENEMY)
346 {
347 changeEnemy = RecalculateExposure(x, z, _map->_exposureEnemy(x, z), ::IsEnemy);
348 }
349 if (dirty & DIRTY_UNKNOWN)
350 {
351 changeUnknown = RecalculateExposure(x, z, _map->_exposureUnknown(x, z), ::IsUnknown);
352 }
353
354 dirty = 0;
355
356 if (changeEnemy > 0.5 || changeUnknown > 0.5)
357 {
358 int g;
359 for (g = 0; g < NGroups(); g++)
360 {
361 AIGroup* grp = GetGroup(g);
362 if (!grp)
363 {
364 continue;
365 }
366 for (int sg = 0; sg < grp->NSubgroups(); sg++)
367 {
368 AISubgroup* subgrp = grp->GetSubgroup(sg);
369 if (!subgrp)
370 {
371 continue;
372 }
373 subgrp->ExposureChanged(x, z, changeEnemy, changeEnemy + changeUnknown);
374 }
375 }
376 }
377}
378
379void AICenter::UpdateMap()
380{

Callers

nothing calls this directly

Calls 4

GetGroupFunction · 0.85
NSubgroupsMethod · 0.80
GetSubgroupMethod · 0.45
ExposureChangedMethod · 0.45

Tested by

no test coverage detected