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

Method create

ogsr_engine/xrGame/alife_simulator_base.cpp:129–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129CSE_Abstract* CALifeSimulatorBase::create(CSE_ALifeGroupAbstract* tpALifeGroupAbstract, CSE_ALifeDynamicObject* j)
130{
131 NET_Packet tNetPacket;
132 LPCSTR S = pSettings->r_string(tpALifeGroupAbstract->base()->s_name, "monster_section");
133 CSE_Abstract* l_tpAbstract = F_entity_Create(S);
134 R_ASSERT2(l_tpAbstract, "Can't create entity.");
135 CSE_ALifeDynamicObject* k = smart_cast<CSE_ALifeDynamicObject*>(l_tpAbstract);
136 R_ASSERT2(k, "Non-ALife object in the 'game.spawn'");
137
138 j->Spawn_Write(tNetPacket, TRUE);
139 k->Spawn_Read(tNetPacket);
140 tNetPacket.w_begin(M_UPDATE);
141 j->UPDATE_Write(tNetPacket);
142 u16 id;
143 tNetPacket.r_begin(id);
144 k->UPDATE_Read(tNetPacket);
145 k->s_name = S;
146 k->m_tSpawnID = j->m_tSpawnID;
147 k->ID = server().PerformIDgen(0xffff);
148 k->m_bDirectControl = false;
149 k->m_bALifeControl = true;
150
151 string256 s_name_replace;
152 strcpy_s(s_name_replace, *k->s_name);
153 if (k->ID < 1000)
154 strcat_s(s_name_replace, "0");
155 if (k->ID < 100)
156 strcat_s(s_name_replace, "0");
157 if (k->ID < 10)
158 strcat_s(s_name_replace, "0");
159 string16 S1;
160 strcat_s(s_name_replace, _itoa(k->ID, S1, 10));
161 k->set_name_replace(s_name_replace);
162
163 register_object(k, true);
164 k->spawn_supplies();
165 k->on_spawn();
166 return (k);
167}
168
169void CALifeSimulatorBase::create(CSE_ALifeDynamicObject*& i, CSE_ALifeDynamicObject* j, const _SPAWN_ID& tSpawnID)
170{

Callers

nothing calls this directly

Calls 15

F_entity_CreateFunction · 0.85
Spawn_WriteMethod · 0.80
Spawn_ReadMethod · 0.80
w_beginMethod · 0.80
PerformIDgenMethod · 0.80
name_replaceMethod · 0.80
actorMethod · 0.80
u32Enum · 0.70
r_stringMethod · 0.45
baseMethod · 0.45
UPDATE_WriteMethod · 0.45
r_beginMethod · 0.45

Tested by

no test coverage detected