From db03d2a5122bd4314d8c0bd60a11f9cd9e016b26 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 3 Jul 2019 15:19:59 +0800 Subject: [PATCH] 1 --- server/gameserver/constant.h | 1 + server/gameserver/playermgr.cc | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index 194f8da..4c1c596 100755 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -176,6 +176,7 @@ const float FRAME_RATE_MS = 1000.0f / SERVER_FRAME_RATE; const int MAX_WEAPON_NUM = 5; const int MAX_SKIN_LV = 9; +const int GUN_SLOT0 = 0; const int GUN_SLOT1 = 1; const int GUN_SLOT2 = 2; diff --git a/server/gameserver/playermgr.cc b/server/gameserver/playermgr.cc index c106094..f41c676 100644 --- a/server/gameserver/playermgr.cc +++ b/server/gameserver/playermgr.cc @@ -68,13 +68,13 @@ Player* PlayerMgr::CreatePlayerByCMJoin(long ip_saddr, int socket, const cs::CMJ if (msg.weapon().weapon_id() != 0) { MetaData::Equip* weapon_meta = MetaMgr::Instance()->GetEquip(msg.weapon().weapon_id()); if (weapon_meta) { - hum->weapons[GUN_SLOT1].weapon_idx = GUN_SLOT1; - hum->weapons[GUN_SLOT1].weapon_id = msg.weapon().weapon_id(); - hum->weapons[GUN_SLOT1].weapon_lv = msg.weapon().weapon_lv(); - hum->weapons[GUN_SLOT1].ammo = 0; - hum->weapons[GUN_SLOT1].meta = weapon_meta; - hum->weapons[GUN_SLOT1].Recalc(); - hum->curr_weapon = &hum->weapons[GUN_SLOT1]; + hum->weapons[GUN_SLOT0].weapon_idx = GUN_SLOT0; + hum->weapons[GUN_SLOT0].weapon_id = msg.weapon().weapon_id(); + hum->weapons[GUN_SLOT0].weapon_lv = msg.weapon().weapon_lv(); + hum->weapons[GUN_SLOT0].ammo = 0; + hum->weapons[GUN_SLOT0].meta = weapon_meta; + hum->weapons[GUN_SLOT0].Recalc(); + hum->curr_weapon = &hum->weapons[GUN_SLOT0]; } } hum->SetSkinInfo(msg.baseskin());