MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / register_object

Method register_object

ogsr_engine/xrGame/alife_simulator_base2.cpp:23–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21using namespace ALife;
22
23void CALifeSimulatorBase::register_object(CSE_ALifeDynamicObject* object, bool add_object)
24{
25 object->on_before_register();
26
27 if (add_object)
28 objects().add(object);
29
30 graph().update(object);
31 scheduled().add(object);
32 story_objects().add(object->m_story_id, object);
33 smart_terrains().add(object);
34 groups().add(object);
35
36 setup_simulator(object);
37
38 CSE_ALifeInventoryItem* item = smart_cast<CSE_ALifeInventoryItem*>(object);
39 if (item && item->attached())
40 {
41 CSE_ALifeDynamicObject* II = objects().object(item->base()->ID_Parent);
42
43#ifdef DEBUG
44 if (std::find(II->children.begin(), II->children.end(), item->base()->ID) != II->children.end())
45 {
46 Msg("[LSS] Specified item [%s][%d] is already attached to the specified object [%s][%d]", item->base()->name_replace(), item->base()->ID, II->name_replace(), II->ID);
47 FATAL("[LSS] Cannot recover from the previous error!");
48 }
49#endif
50
51 II->children.push_back(item->base()->ID);
52 II->attach(item, true, false);
53 }
54
55 if (can_register_objects())
56 object->on_register();
57}
58
59void CALifeSimulatorBase::unregister_object(CSE_ALifeDynamicObject* object, bool alife_query)
60{

Callers 1

try_switch_offlineMethod · 0.80

Calls 14

MsgFunction · 0.85
attachedMethod · 0.80
name_replaceMethod · 0.80
findFunction · 0.50
on_before_registerMethod · 0.45
addMethod · 0.45
updateMethod · 0.45
objectMethod · 0.45
baseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected