1
This commit is contained in:
parent
72c4d3a86f
commit
85f8371418
@ -17,6 +17,17 @@ static void IncIntMap(std::map<int, int>& int_map, int key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void DecIntMap(std::map<int, int>& int_map, int key)
|
||||||
|
{
|
||||||
|
auto itr = int_map.find(key);
|
||||||
|
if (itr == int_map.end()) {
|
||||||
|
--itr->second;
|
||||||
|
if (itr->second < 0) {
|
||||||
|
itr->second = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InGameVoice::InGameVoice(Room* room)
|
InGameVoice::InGameVoice(Room* room)
|
||||||
{
|
{
|
||||||
room_ = room;
|
room_ = room;
|
||||||
@ -66,50 +77,21 @@ void InGameVoice::OnHumanBeKill(int killer_id, Human* deader)
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
{
|
||||||
|
room_->xtimer.SetTimeoutWpEx
|
||||||
#if 0
|
(
|
||||||
void InGameVoice::IncPersonalSeriesKills(int killer_id)
|
SERVER_FRAME_RATE * 30,
|
||||||
{
|
[room = room_, killer_id] (int event, const a8::Args* args)
|
||||||
auto itr = personal_series_kills_.find(killer_id);
|
{
|
||||||
if (itr != personal_series_kills_.end()) {
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
++itr->second;
|
DecIntMap(room->GetInGameVoice()->personal_series_kills_, killer_id);
|
||||||
} else {
|
DecIntMap(room->GetInGameVoice()->personal_nodead_series_kills_, killer_id);
|
||||||
personal_series_kills_[killer_id] = 1;
|
}
|
||||||
|
},
|
||||||
|
&room_->xtimer_attacher_);
|
||||||
}
|
}
|
||||||
room_->xtimer.SetTimeoutWpEx
|
|
||||||
(
|
|
||||||
SERVER_FRAME_RATE * 30,
|
|
||||||
[room = room_, killer_id] (int event, const a8::Args* args)
|
|
||||||
{
|
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
|
||||||
room->GetInGameVoice()->personal_series_kills_.erase(killer_id);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
&room_->xtimer_attacher_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InGameVoice::IncPersonalNoDeadSeriesKills(int killer_id)
|
|
||||||
{
|
|
||||||
auto itr = personal_nodead_series_kills_.find(killer_id);
|
|
||||||
if (itr != personal_nodead_series_kills_.end()) {
|
|
||||||
++itr->second;
|
|
||||||
} else {
|
|
||||||
personal_nodead_series_kills_[killer_id] = 1;
|
|
||||||
}
|
|
||||||
room_->xtimer.SetTimeoutWpEx
|
|
||||||
(
|
|
||||||
SERVER_FRAME_RATE * 30,
|
|
||||||
[room = room_, killer_id] (int event, const a8::Args* args)
|
|
||||||
{
|
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
|
||||||
room->GetInGameVoice()->personal_nodead_series_kills_.erase(killer_id);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
&room_->xtimer_attacher_);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void InGameVoice::Notify(Human* killer, Human* deader, const mt::InGameVoice* meta)
|
void InGameVoice::Notify(Human* killer, Human* deader, const mt::InGameVoice* meta)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user