From 871e44508fe87e816350c9824aec8cc02b4c9b2a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 2 Apr 2021 16:31:45 +0800 Subject: [PATCH] 1 --- server/gameserver/constant.h | 9 ++++++--- server/gameserver/creature.cc | 9 +++++++++ server/gameserver/human.cc | 8 -------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index 62a77b3..605c404 100755 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -89,8 +89,6 @@ enum InventorySlot_e IS_SMOKE = 6, IS_HEALTHKIT = 7, //医疗包 IS_PAIN_KILLER = 8, //止痛药 - IS_POSION_GAS_BOMB = 9, - IS_MOLOTOR_COCKTAIL = 10, IS_1XSCOPE = 12, IS_2XSCOPE = 13, @@ -98,6 +96,11 @@ enum InventorySlot_e IS_8XSCOPE = 15, IS_15XSCOPE = 16, + IS_POSION_GAS_BOMB = 17, //毒气弹 + IS_MOLOTOR_COCKTAIL = 18, //燃烧瓶 + IS_TRAP = 19, //陷井 + IS_MINE = 20, //地雷 + IS_END }; @@ -368,7 +371,7 @@ const int SERVER_FRAME_RATE = 20; const int SYNC_FRAME_RATE = 10; const float FRAME_RATE_MS = 1000.0f / SERVER_FRAME_RATE; -const int MAX_WEAPON_NUM = 5; +const int MAX_WEAPON_NUM = 9; const int MAX_SKIN_LV = 9; const int GUN_SLOT1 = 1; diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index d602317..a905d17 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -76,6 +76,15 @@ void InternalShot(Creature* c, Creature::Creature():MoveableEntity() { + weapons.reserve(MAX_WEAPON_NUM); + for (size_t i = 0; i < MAX_WEAPON_NUM; ++i) { + auto& weapon = a8::FastAppend(weapons); + weapon.weapon_idx = i; + weapon.weapon_id = 0; + weapon.weapon_lv = 0; + weapon.ammo = 0; + } + weak_ptr_chunk_.Set(this); inventory_[IS_1XSCOPE] = 1; diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 19a7954..e08c745 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -43,14 +43,6 @@ Human::Human():Creature() default_weapon.ammo = 1; default_weapon.meta = MetaMgr::Instance()->GetEquip(default_weapon.weapon_id); default_weapon.Recalc(); - weapons.reserve(MAX_WEAPON_NUM); - for (size_t i = 0; i < MAX_WEAPON_NUM; ++i) { - auto& weapon = a8::FastAppend(weapons); - weapon.weapon_idx = i; - weapon.weapon_id = 0; - weapon.weapon_lv = 0; - weapon.ammo = 0; - } for (int i = 0; i < kSkinNum; ++i) { Skin& skin = a8::FastAppend(skins); skin.skin_id = 0;