1
This commit is contained in:
parent
91963cc96e
commit
b46497c81a
@ -28,6 +28,16 @@ static int GetIntMap(std::map<int, int>& int_map, int key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int GetInt64Map(std::map<int, long long>& int_map, int key)
|
||||||
|
{
|
||||||
|
auto itr = int_map.find(key);
|
||||||
|
if (itr != int_map.end()) {
|
||||||
|
return itr->second;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InGameVoice::InGameVoice(Room* room)
|
InGameVoice::InGameVoice(Room* room)
|
||||||
{
|
{
|
||||||
room_ = room;
|
room_ = room;
|
||||||
@ -60,10 +70,11 @@ void InGameVoice::OnHumanBeKill(int killer_id, Human* deader)
|
|||||||
}
|
}
|
||||||
++global_kills_;
|
++global_kills_;
|
||||||
if (global_kills_ > 0) {
|
if (global_kills_ > 0) {
|
||||||
if (room_->GetFrameNo() - killer->stats->last_kill_frameno >
|
if (room_->GetFrameNo() - GetInt64Map(personal_last_kill_frameno_, killer_id) >
|
||||||
SERVER_FRAME_RATE * mt::InGameVoice::s_series_kill_interval) {
|
SERVER_FRAME_RATE * mt::InGameVoice::s_series_kill_interval) {
|
||||||
personal_series_kills_.erase(killer_id);
|
personal_series_kills_.erase(killer_id);
|
||||||
}
|
}
|
||||||
|
personal_last_kill_frameno_[killer_id] = room_->GetFrameNo();
|
||||||
IncIntMap(personal_kills_, killer_id);
|
IncIntMap(personal_kills_, killer_id);
|
||||||
IncIntMap(personal_series_kills_, killer_id);
|
IncIntMap(personal_series_kills_, killer_id);
|
||||||
if (!killer->dead) {
|
if (!killer->dead) {
|
||||||
|
@ -34,5 +34,6 @@ private:
|
|||||||
std::map<int, int> personal_kills_;
|
std::map<int, int> personal_kills_;
|
||||||
std::map<int, int> personal_series_kills_;
|
std::map<int, int> personal_series_kills_;
|
||||||
std::map<int, int> personal_nodead_series_kills_;
|
std::map<int, int> personal_nodead_series_kills_;
|
||||||
|
std::map<int, long long> personal_last_kill_frameno_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user