From b39be1b6a345b768ecc1dadb7cac832eba67fe21 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 30 May 2020 22:41:24 +0800 Subject: [PATCH] remove useless entity_uniid --- server/gameserver/human.cc | 14 +++++++------- server/gameserver/room.cc | 30 +++++++++++++++--------------- server/gameserver/room.h | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 8bfc227..3c6438e 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1159,8 +1159,8 @@ void Human::DoSkill() void Human::DoGetDown() { if (car_.car_id != 0) { - int entity_uniid = room->CreateLoot(car_.car_id, GetPos(), 1, 1); - Entity* loot_entity = room->GetEntityByUniId(entity_uniid); + int loot_uniid = room->CreateLoot(car_.car_id, GetPos(), 1, 1); + Entity* loot_entity = room->GetEntityByUniId(loot_uniid); if (loot_entity && loot_entity->IsEntityType(ET_Loot)) { ((Loot*)loot_entity)->bullet_num = 0; ((Loot*)loot_entity)->param1 = 0; @@ -1169,7 +1169,7 @@ void Human::DoGetDown() loot_entity->GetEntityUniId(), loot_entity->GetPos()); } - room->TakeOffCarObject(entity_uniid, GetPos()); + room->TakeOffCarObject(loot_uniid, GetPos()); if (car_.meta->i->buffid()) { RemoveBuffById(car_.meta->i->buffid()); } @@ -2141,8 +2141,8 @@ void Human::ProcLootOldSkin(Loot* entity, MetaData::Equip* item_meta) if (item_meta->i->is_luck()) { if (item_meta->i->is_luck() == 2) { if (skin_tank.skin_id != 0) { - int entity_uniid = room->CreateLoot(skin_tank.skin_id, GetPos(), 1, 1); - Entity* loot_entity = room->GetEntityByUniId(entity_uniid); + int loot_uniid = room->CreateLoot(skin_tank.skin_id, GetPos(), 1, 1); + Entity* loot_entity = room->GetEntityByUniId(loot_uniid); if (loot_entity && loot_entity->IsEntityType(ET_Loot)) { ((Loot*)loot_entity)->bullet_num = tank_weapon.ammo; ((Loot*)loot_entity)->param1 = tank_oil_value; @@ -2259,8 +2259,8 @@ void Human::ProcLootCar(Loot* entity, MetaData::Equip* item_meta) return; } if (car_.car_id != 0) { - int entity_uniid = room->CreateLoot(car_.car_id, GetPos(), 1, 1); - Entity* loot_entity = room->GetEntityByUniId(entity_uniid); + int loot_uniid = room->CreateLoot(car_.car_id, GetPos(), 1, 1); + Entity* loot_entity = room->GetEntityByUniId(loot_uniid); if (loot_entity && loot_entity->IsEntityType(ET_Loot)) { ((Loot*)loot_entity)->bullet_num = 0; ((Loot*)loot_entity)->param1 = 0; diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 4cee5e0..a25db4a 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -1442,18 +1442,18 @@ void Room::CreateLoots() int thing_id = thing_tpl->RandThing(); MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(thing_id); if (equip_meta) { - int entity_uniid = CreateLoot( - equip_meta->i->id(), - a8::Vec2 - ( - thing_tpl->i->x(), - thing_tpl->i->y() - ), - 1, - 1 - ); - if (entity_uniid && equip_meta->i->equip_type() == EQUIP_TYPE_CAR) { - Entity* loot_entity = GetEntityByUniId(entity_uniid); + int loot_uniid = CreateLoot( + equip_meta->i->id(), + a8::Vec2 + ( + thing_tpl->i->x(), + thing_tpl->i->y() + ), + 1, + 1 + ); + if (loot_uniid && equip_meta->i->equip_type() == EQUIP_TYPE_CAR) { + Entity* loot_entity = GetEntityByUniId(loot_uniid); if (loot_entity && loot_entity->IsEntityType(ET_Loot)) { ((Loot*)loot_entity)->bullet_num = equip_meta->i->clip_volume(); ((Loot*)loot_entity)->param1 = MetaMgr::Instance()->max_oil; @@ -1597,10 +1597,10 @@ void Room::InitObstacleDatas() memset(&obstacle_datas_[0], 0, sizeof(ObstacleData) * FIXED_OBJECT_MAXID); } -ObstacleData* Room::GetPermanentObstacleData(int entity_uniid) +ObstacleData* Room::GetPermanentObstacleData(int obstacle_uniid) { - if (entity_uniid >= 0 && entity_uniid < (int)obstacle_datas_.size()) { - return &obstacle_datas_[entity_uniid]; + if (obstacle_uniid >= 0 && obstacle_uniid < (int)obstacle_datas_.size()) { + return &obstacle_datas_[obstacle_uniid]; } else { return nullptr; } diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 1357ee6..a0022b7 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -108,7 +108,7 @@ public: void TakeOffCarObject(int car_uniid, a8::Vec2 pos); int CreateAndTakeonCar(int car_id, a8::Vec2 pos); bool HaveMyTeam(const std::string& team_uuid); - ObstacleData* GetPermanentObstacleData(int entity_uniid); + ObstacleData* GetPermanentObstacleData(int obstacle_uniid); long long GetGasInactiveTime(); void ShuaGuideAndroid(Human* target); void InitAirDrop();