Fixes to new message dispatcher.
This commit is contained in:
parent
9947e41549
commit
ac733404e1
2 changed files with 10 additions and 2 deletions
|
|
@ -142,6 +142,13 @@ public:
|
||||||
int32 id (NetMsg msg) const {
|
int32 id (NetMsg msg) const {
|
||||||
return m_maps[msg];
|
return m_maps[msg];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void reset () {
|
||||||
|
m_current = NetMsg::None;
|
||||||
|
m_bot = nullptr;
|
||||||
|
m_broadcast = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static auto &msgs = MessageDispatcher::get ();
|
static auto &msgs = MessageDispatcher::get ();
|
||||||
|
|
@ -377,6 +377,7 @@ MessageDispatcher::MessageDispatcher () {
|
||||||
m_wanted[name] = id;
|
m_wanted[name] = id;
|
||||||
m_handlers[id] = handler;
|
m_handlers[id] = handler;
|
||||||
};
|
};
|
||||||
|
reset ();
|
||||||
|
|
||||||
// we want to handle next messages
|
// we want to handle next messages
|
||||||
pushWanted ("TextMsg", NetMsg::TextMsg, &MessageDispatcher::netMsgTextMsg);
|
pushWanted ("TextMsg", NetMsg::TextMsg, &MessageDispatcher::netMsgTextMsg);
|
||||||
|
|
@ -454,7 +455,7 @@ void MessageDispatcher::registerMessage (const String &name, int32 id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageDispatcher::start (edict_t *ent, int32 dest, int32 type) {
|
void MessageDispatcher::start (edict_t *ent, int32 dest, int32 type) {
|
||||||
m_current = NetMsg::None;
|
reset ();
|
||||||
|
|
||||||
// search if we need to handle this message
|
// search if we need to handle this message
|
||||||
for (const auto &msg : m_maps) {
|
for (const auto &msg : m_maps) {
|
||||||
|
|
@ -475,7 +476,7 @@ void MessageDispatcher::start (edict_t *ent, int32 dest, int32 type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// message for bot bot?
|
// message for bot bot?
|
||||||
if (ent && (ent->v.flags & FL_FAKECLIENT)) {
|
if (ent && (ent->v.flags & FL_FAKECLIENT) && !(ent->v.flags & FL_DORMANT)) {
|
||||||
m_bot = bots[ent];
|
m_bot = bots[ent];
|
||||||
|
|
||||||
if (!m_bot) {
|
if (!m_bot) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue