添加active_player_data优化
This commit is contained in:
parent
e898fdf1e0
commit
acc2812c24
@ -249,7 +249,8 @@ enum PropertyType_e
|
|||||||
kPropTankBulletNum = 6,
|
kPropTankBulletNum = 6,
|
||||||
kPropTankOil = 7,
|
kPropTankOil = 7,
|
||||||
kPropBulletNum = 8,
|
kPropBulletNum = 8,
|
||||||
kPropItem = 9
|
kPropItem = 9,
|
||||||
|
kPropWeaponAmmo = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MapObjectType_e
|
enum MapObjectType_e
|
||||||
|
@ -212,6 +212,21 @@ void FrameEvent::AddHpChg(Human* sender)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FrameEvent::AddWeaponAmmoChg(Human* hum)
|
||||||
|
{
|
||||||
|
if (hum->curr_weapon) {
|
||||||
|
chged_weapon_ammo_.push_back
|
||||||
|
(
|
||||||
|
std::make_tuple(hum,
|
||||||
|
hum->curr_weapon->weapon_idx,
|
||||||
|
hum->curr_weapon->ammo
|
||||||
|
)
|
||||||
|
);
|
||||||
|
int idx = chged_weapon_ammo_.size() - 1;
|
||||||
|
hum->chged_weapon_ammo_.push_back(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FrameEvent::AddBuff(Human* sender, Buff* buff)
|
void FrameEvent::AddBuff(Human* sender, Buff* buff)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -310,4 +325,7 @@ void FrameEvent::Clear()
|
|||||||
if (!chged_items_.empty()) {
|
if (!chged_items_.empty()) {
|
||||||
chged_items_.clear();
|
chged_items_.clear();
|
||||||
}
|
}
|
||||||
|
if (!chged_weapon_ammo_.empty()) {
|
||||||
|
chged_weapon_ammo_.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public:
|
|||||||
void AddTankOilValueChg(Human* hum);
|
void AddTankOilValueChg(Human* hum);
|
||||||
void AddTankOilMaxChg(Human* hum);
|
void AddTankOilMaxChg(Human* hum);
|
||||||
void AddHpChg(Human* hum);
|
void AddHpChg(Human* hum);
|
||||||
|
void AddWeaponAmmoChg(Human* hum);
|
||||||
void AddBuff(Human* hum, Buff* buff);
|
void AddBuff(Human* hum, Buff* buff);
|
||||||
void RemoveBuff(Human* hum, int buff_id);
|
void RemoveBuff(Human* hum, int buff_id);
|
||||||
void AddSkillCdChg(Human* hum);
|
void AddSkillCdChg(Human* hum);
|
||||||
@ -40,6 +41,7 @@ private:
|
|||||||
std::vector<Human*> chged_tank_bullet_nums_;
|
std::vector<Human*> chged_tank_bullet_nums_;
|
||||||
std::vector<Human*> chged_tank_oil_value_;
|
std::vector<Human*> chged_tank_oil_value_;
|
||||||
std::vector<Human*> chged_tank_oil_max_;
|
std::vector<Human*> chged_tank_oil_max_;
|
||||||
|
std::vector<std::tuple<Human*, int, int>> chged_weapon_ammo_;
|
||||||
std::vector<Human*> chged_hps_;
|
std::vector<Human*> chged_hps_;
|
||||||
std::vector<Human*> chged_skillcds_;
|
std::vector<Human*> chged_skillcds_;
|
||||||
|
|
||||||
|
@ -182,6 +182,18 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (size_t idx : hum->chged_weapon_ammo_) {
|
||||||
|
if (idx < room->frame_event.chged_weapon_ammo_.size()) {
|
||||||
|
auto& tuple = room->frame_event.chged_weapon_ammo_[idx];
|
||||||
|
{
|
||||||
|
auto p = msg->add_chged_property_list();
|
||||||
|
p->set_obj_id((std::get<0>(tuple))->GetEntityUniId());
|
||||||
|
p->set_property_type(kPropWeaponAmmo);
|
||||||
|
p->set_property_subtype(std::get<1>(tuple));
|
||||||
|
p->set_value(std::get<2>(tuple));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (room->frame_event.airdrops_.size() > 0) {
|
if (room->frame_event.airdrops_.size() > 0) {
|
||||||
*msg->mutable_airdrop() = room->frame_event.airdrops_.Get(0);
|
*msg->mutable_airdrop() = room->frame_event.airdrops_.Get(0);
|
||||||
}
|
}
|
||||||
|
@ -1908,6 +1908,9 @@ void Human::ClearFrameData()
|
|||||||
if (!chged_items_.empty()) {
|
if (!chged_items_.empty()) {
|
||||||
chged_items_.clear();
|
chged_items_.clear();
|
||||||
}
|
}
|
||||||
|
if (!chged_weapon_ammo_.empty()) {
|
||||||
|
chged_weapon_ammo_.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::GenBattleReportData(a8::MutableXObject* params)
|
void Human::GenBattleReportData(a8::MutableXObject* params)
|
||||||
|
@ -339,6 +339,7 @@ protected:
|
|||||||
std::vector<int> chged_hps_;
|
std::vector<int> chged_hps_;
|
||||||
std::vector<int> chged_skillcds_;
|
std::vector<int> chged_skillcds_;
|
||||||
std::vector<int> chged_items_;
|
std::vector<int> chged_items_;
|
||||||
|
std::vector<int> chged_weapon_ammo_;
|
||||||
Human* follow_target_ = nullptr;
|
Human* follow_target_ = nullptr;
|
||||||
bool follow_synced_active_player = false;
|
bool follow_synced_active_player = false;
|
||||||
HumanCar car_;
|
HumanCar car_;
|
||||||
|
@ -447,7 +447,9 @@ void Player::Shot()
|
|||||||
AutoLoadingBullet();
|
AutoLoadingBullet();
|
||||||
}
|
}
|
||||||
last_shot_frameno_ = room->GetFrameNo();
|
last_shot_frameno_ = room->GetFrameNo();
|
||||||
#if 0
|
#if 1
|
||||||
|
room->frame_event.AddWeaponAmmoChg(this);
|
||||||
|
#else
|
||||||
need_sync_active_player = true;
|
need_sync_active_player = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user