mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-01-22 08:30:06 +00:00
Dedicated bcast monitor event
This commit is contained in:
parent
36e0667ed2
commit
b4ed31d4fb
10
src/Chat.cpp
10
src/Chat.cpp
@ -9,6 +9,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
std::vector<std::string> Chat::dump;
|
std::vector<std::string> Chat::dump;
|
||||||
|
std::vector<std::string> Chat::bcasts;
|
||||||
|
|
||||||
using namespace Chat;
|
using namespace Chat;
|
||||||
|
|
||||||
@ -120,9 +121,12 @@ static void announcementHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string logLine = "[Bcast " + std::to_string(announcement->iAreaType) + "] " + PlayerManager::getPlayerName(plr, false) + ": " + AUTOU16TOU8(msg.szAnnounceMsg);
|
std::string logLine = std::to_string(announcement->iAreaType) + " "
|
||||||
std::cout << logLine << std::endl;
|
+ std::to_string(announcement->iAnnounceType) + " "
|
||||||
dump.push_back("**" + logLine + "**");
|
+ std::to_string(announcement->iDuringTime) + " "
|
||||||
|
+ PlayerManager::getPlayerName(plr, false) + ": " + AUTOU16TOU8(msg.szAnnounceMsg);
|
||||||
|
std::cout << "Broadcast " << logLine << std::endl;
|
||||||
|
bcasts.push_back(logLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Buddy freechatting
|
// Buddy freechatting
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
namespace Chat {
|
namespace Chat {
|
||||||
extern std::vector<std::string> dump;
|
extern std::vector<std::string> dump;
|
||||||
|
extern std::vector<std::string> bcasts;
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void sendServerMessage(CNSocket* sock, std::string msg); // uses MOTD
|
void sendServerMessage(CNSocket* sock, std::string msg); // uses MOTD
|
||||||
|
@ -106,6 +106,14 @@ outer:
|
|||||||
goto outer;
|
goto outer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// announcements
|
||||||
|
for (auto& str : Chat::bcasts) {
|
||||||
|
n = std::snprintf(buff, sizeof(buff), "bcast %s\n", str.c_str());
|
||||||
|
|
||||||
|
if (!transmit(it, buff, n))
|
||||||
|
goto outer;
|
||||||
|
}
|
||||||
|
|
||||||
// emails
|
// emails
|
||||||
for (auto& str : Email::dump) {
|
for (auto& str : Email::dump) {
|
||||||
n = process_email(buff, str);
|
n = process_email(buff, str);
|
||||||
@ -124,6 +132,7 @@ outer:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Chat::dump.clear();
|
Chat::dump.clear();
|
||||||
|
Chat::bcasts.clear();
|
||||||
Email::dump.clear();
|
Email::dump.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user