| 8 | #endif |
| 9 | |
| 10 | CSE_Abstract* xrServer::Process_spawn(NET_Packet& P, ClientID sender, BOOL bSpawnWithClientsMainEntityAsParent, CSE_Abstract* tpExistedEntity) |
| 11 | { |
| 12 | // create server entity |
| 13 | xrClientData* CL = ID_to_client(sender); |
| 14 | CSE_Abstract* E = tpExistedEntity; |
| 15 | if (!E) |
| 16 | { |
| 17 | // read spawn information |
| 18 | string64 s_name; |
| 19 | P.r_stringZ(s_name); |
| 20 | // create entity |
| 21 | E = entity_Create(s_name); |
| 22 | R_ASSERT3(E, "Can't create entity.", s_name); |
| 23 | E->Spawn_Read(P); |
| 24 | if (!((game->Type() == E->s_gameid) || (GAME_ANY == E->s_gameid)) || !E->match_configuration() || !game->OnPreCreate(E)) |
| 25 | { |
| 26 | // Msg ("- SERVER: Entity [%s] incompatible with current game type.",*E->s_name); |
| 27 | F_entity_Destroy(E); |
| 28 | return NULL; |
| 29 | } |
| 30 | |
| 31 | // E->m_bALifeControl = false; |
| 32 | } |
| 33 | else |
| 34 | { |
| 35 | VERIFY(E->m_bALifeControl); |
| 36 | // E->owner = CL; |
| 37 | // if (CL != NULL) |
| 38 | // { |
| 39 | // int x=0; |
| 40 | // x=x; |
| 41 | // }; |
| 42 | // E->m_bALifeControl = true; |
| 43 | } |
| 44 | |
| 45 | CSE_Abstract* e_parent = 0; |
| 46 | if (E->ID_Parent != 0xffff) |
| 47 | { |
| 48 | e_parent = ID_to_entity(E->ID_Parent); |
| 49 | if (!e_parent) |
| 50 | { |
| 51 | R_ASSERT(!tpExistedEntity); |
| 52 | // VERIFY3 (smart_cast<CSE_ALifeItemBolt*>(E) || smart_cast<CSE_ALifeItemGrenade*>(E),*E->s_name,E->name_replace()); |
| 53 | F_entity_Destroy(E); |
| 54 | return NULL; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // check if we can assign entity to some client |
| 59 | if (0 == CL && !net_Players.empty()) |
| 60 | { |
| 61 | CL = SelectBestClientToMigrateTo(E); |
| 62 | } |
| 63 | |
| 64 | // check for respawn-capability and create phantom as needed |
| 65 | if (E->RespawnTime && (0xffff == E->ID_Phantom)) |
| 66 | { |
| 67 | // Create phantom |
no test coverage detected