This commit is contained in:
aozhiwei 2019-04-02 17:44:46 +08:00
parent da73768204
commit d442c60cf4
2 changed files with 5 additions and 5 deletions

View File

@ -26,6 +26,10 @@ Human::Human()
} }
weapons[0] = default_weapon; weapons[0] = default_weapon;
curr_weapon = &weapons[0]; curr_weapon = &weapons[0];
inventory.reserve(MAX_INVENTORY_NUM);
for (size_t i = 0; i < MAX_INVENTORY_NUM; ++i) {
inventory.push_back(0);
}
} }
Human::~Human() Human::~Human()

View File

@ -57,10 +57,6 @@ void Player::Initialize()
helmet_meta = MetaMgr::Instance()->GetEquip(helmet); helmet_meta = MetaMgr::Instance()->GetEquip(helmet);
chest_meta = MetaMgr::Instance()->GetEquip(chest); chest_meta = MetaMgr::Instance()->GetEquip(chest);
RecalcSelfCollider(); RecalcSelfCollider();
inventory.reserve(MAX_INVENTORY_NUM);
for (size_t i = 0; i < inventory.size(); ++i) {
inventory[i] = 0;
}
} }
void Player::Update(int delta_time) void Player::Update(int delta_time)
@ -532,7 +528,7 @@ void Player::MakeUpdateMsg()
if (updated_times == 0 || need_sync_active_player) { if (updated_times == 0 || need_sync_active_player) {
update_msg->set_active_player_id(entity_uniid); update_msg->set_active_player_id(entity_uniid);
FillMFActivePlayerData(update_msg->mutable_active_player_data()); FillMFActivePlayerData(update_msg->mutable_active_player_data());
need_sync_active_player = true; need_sync_active_player = false;
} }
if (updated_times == 0 || last_sync_gas_frameno < room->gas_data.gas_start_frameno) { if (updated_times == 0 || last_sync_gas_frameno < room->gas_data.gas_start_frameno) {
last_sync_gas_frameno = room->gas_data.gas_start_frameno; last_sync_gas_frameno = room->gas_data.gas_start_frameno;