diff options
| author | oy <Tom_Adams@web.de> | 2011-01-19 18:27:50 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-01-19 18:27:50 +0100 |
| commit | 19a9462fe88b2573ab9f24a2890d4affb2bdcf47 (patch) | |
| tree | 699ea43000384716ef42843b2f2a7f33010f9a67 /src/game/server/entities | |
| parent | 7ca7c95bc0d29aca731838d9c404c038cbc15599 (diff) | |
| download | zcatch-19a9462fe88b2573ab9f24a2890d4affb2bdcf47.tar.gz zcatch-19a9462fe88b2573ab9f24a2890d4affb2bdcf47.zip | |
removed double entity list in gameworld and cleaned up connected stuff
Diffstat (limited to 'src/game/server/entities')
| -rw-r--r-- | src/game/server/entities/character.cpp | 10 | ||||
| -rw-r--r-- | src/game/server/entities/flag.cpp | 2 | ||||
| -rw-r--r-- | src/game/server/entities/laser.cpp | 2 | ||||
| -rw-r--r-- | src/game/server/entities/pickup.cpp | 9 | ||||
| -rw-r--r-- | src/game/server/entities/projectile.cpp | 2 |
5 files changed, 11 insertions, 14 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 0a3dd87b..53c75e3d 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -40,7 +40,7 @@ MACRO_ALLOC_POOL_ID_IMPL(CCharacter, MAX_CLIENTS) // Character, "physical" player's part CCharacter::CCharacter(CGameWorld *pWorld) -: CEntity(pWorld, NETOBJTYPE_CHARACTER) +: CEntity(pWorld, CGameWorld::ENTTYPE_CHARACTER) { m_ProximityRadius = ms_PhysSize; m_Health = 0; @@ -153,11 +153,11 @@ void CCharacter::HandleNinja() // check if we Hit anything along the way { - CCharacter *aEnts[64]; + CCharacter *aEnts[MAX_CLIENTS]; vec2 Dir = m_Pos - OldPos; float Radius = m_ProximityRadius * 2.0f; vec2 Center = OldPos + Dir * 0.5f; - int Num = GameServer()->m_World.FindEntities(Center, Radius, (CEntity**)aEnts, 64, NETOBJTYPE_CHARACTER); + int Num = GameServer()->m_World.FindEntities(Center, Radius, (CEntity**)aEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER); for (int i = 0; i < Num; ++i) { @@ -289,10 +289,10 @@ void CCharacter::FireWeapon() m_NumObjectsHit = 0; GameServer()->CreateSound(m_Pos, SOUND_HAMMER_FIRE); - CCharacter *apEnts[64]; + CCharacter *apEnts[MAX_CLIENTS]; int Hits = 0; int Num = GameServer()->m_World.FindEntities(ProjStartPos, m_ProximityRadius*0.5f, (CEntity**)apEnts, - 64, NETOBJTYPE_CHARACTER); + MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER); for (int i = 0; i < Num; ++i) { diff --git a/src/game/server/entities/flag.cpp b/src/game/server/entities/flag.cpp index 4d034214..13109b07 100644 --- a/src/game/server/entities/flag.cpp +++ b/src/game/server/entities/flag.cpp @@ -4,7 +4,7 @@ #include "flag.h" CFlag::CFlag(CGameWorld *pGameWorld, int Team) -: CEntity(pGameWorld, NETOBJTYPE_FLAG) +: CEntity(pGameWorld, CGameWorld::ENTTYPE_FLAG) { m_Team = Team; m_ProximityRadius = ms_PhysSize; diff --git a/src/game/server/entities/laser.cpp b/src/game/server/entities/laser.cpp index 17eb4332..2f6568fa 100644 --- a/src/game/server/entities/laser.cpp +++ b/src/game/server/entities/laser.cpp @@ -5,7 +5,7 @@ #include "laser.h" CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEnergy, int Owner) -: CEntity(pGameWorld, NETOBJTYPE_LASER) +: CEntity(pGameWorld, CGameWorld::ENTTYPE_LASER) { m_Pos = Pos; m_Owner = Owner; diff --git a/src/game/server/entities/pickup.cpp b/src/game/server/entities/pickup.cpp index a2c6f650..136e3efe 100644 --- a/src/game/server/entities/pickup.cpp +++ b/src/game/server/entities/pickup.cpp @@ -5,7 +5,7 @@ #include "pickup.h" CPickup::CPickup(CGameWorld *pGameWorld, int Type, int SubType) -: CEntity(pGameWorld, NETOBJTYPE_PICKUP) +: CEntity(pGameWorld, CGameWorld::ENTTYPE_PICKUP) { m_Type = Type; m_Subtype = SubType; @@ -91,12 +91,9 @@ void CPickup::Tick() RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime; // loop through all players, setting their emotes - CEntity *apEnts[64]; - int Num = GameServer()->m_World.FindEntities(vec2(0, 0), 1000000, apEnts, 64, NETOBJTYPE_CHARACTER); - - for (int i = 0; i < Num; ++i) + CCharacter *pC = static_cast<CCharacter *>(GameServer()->m_World.FindFirst(CGameWorld::ENTTYPE_CHARACTER)); + for(; pC; pC = (CCharacter *)pC->TypeNext()) { - CCharacter *pC = static_cast<CCharacter *>(apEnts[i]); if (pC != pChr) pC->SetEmote(EMOTE_SURPRISE, Server()->Tick() + Server()->TickSpeed()); } diff --git a/src/game/server/entities/projectile.cpp b/src/game/server/entities/projectile.cpp index f5c376a2..6e256e95 100644 --- a/src/game/server/entities/projectile.cpp +++ b/src/game/server/entities/projectile.cpp @@ -6,7 +6,7 @@ CProjectile::CProjectile(CGameWorld *pGameWorld, int Type, int Owner, vec2 Pos, vec2 Dir, int Span, int Damage, bool Explosive, float Force, int SoundImpact, int Weapon) -: CEntity(pGameWorld, NETOBJTYPE_PROJECTILE) +: CEntity(pGameWorld, CGameWorld::ENTTYPE_PROJECTILE) { m_Type = Type; m_Pos = Pos; |