MCPcopy Create free account
hub / github.com/crownengine/crown / destroy

Function destroy

src/world/script_world.cpp:92–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 }
91
92 void destroy(ScriptWorld &sw, ScriptId inst)
93 {
94 const u32 last_i = array::size(sw._data) - 1;
95 const UnitId unit = sw._data[inst.i].unit;
96 const UnitId last = sw._data[last_i].unit;
97
98 sw._data[inst.i] = sw._data[last_i];
99 array::pop_back(sw._data);
100
101 hash_map::set(sw._map, last, inst.i);
102 hash_map::remove(sw._map, unit);
103 }
104
105 ScriptId instance(ScriptWorld &sw, UnitId unit)
106 {

Callers 1

unit_destroyed_callbackFunction · 0.70

Calls 3

setClass · 0.85
removeFunction · 0.70
sizeFunction · 0.50

Tested by

no test coverage detected