add: add current map and current time to graph editing overlay

fix: send client messages as unreliable to prevent reliable channel overflow (should solve problems when editing large number of waypoints on single location)
This commit is contained in:
dmitry 2022-01-16 01:14:11 +03:00
commit d402f38295
No known key found for this signature in database
GPG key ID: 8297CE728B7A7E37
5 changed files with 19 additions and 3 deletions

@ -1 +1 @@
Subproject commit 28b1cf23456d630b886150483d9b5d9f004f9451
Subproject commit 9375af6e408b5fcd195c2bce5f2565bc3fbd3160

View file

@ -112,6 +112,9 @@ public:
// checks if same model ommiting the models directory
bool isModel (const edict_t *ent, StringRef model);
// get the current date and time as string
String getCurrentDateTime ();
public:
// re-show welcome after changelevel ?

View file

@ -473,7 +473,7 @@ void Game::sendClientMessage (bool console, edict_t *ent, StringRef message) {
// used to split messages
auto sendTextMsg = [&console, &ent] (StringRef text) {
MessageWriter (MSG_ONE, msgs.id (NetMsg::TextMsg), nullptr, ent)
MessageWriter (MSG_ONE_UNRELIABLE, msgs.id (NetMsg::TextMsg), nullptr, ent)
.writeByte (console ? HUD_PRINTCONSOLE : HUD_PRINTCENTER)
.writeString (text.chars ());
};

View file

@ -2399,9 +2399,10 @@ void BotGraph::frame () {
// show the information about that point
graphMessage.assignf ("\n\n\n\n Graph Information:\n\n"
" Map: %s @ %s\n"
" Node %d of %d, Radius: %.1f, Light: %.1f\n"
" Flags: %s\n"
" Origin: %s\n\n", nearestIndex, m_paths.length () - 1, path.radius, path.light, getFlagsAsStr (nearestIndex), pathOriginStr (nearestIndex));
" Origin: %s\n\n", game.getMapName (), util.getCurrentDateTime (), nearestIndex, m_paths.length () - 1, path.radius, path.light, getFlagsAsStr (nearestIndex), pathOriginStr (nearestIndex));
// if node is not changed display experience also
if (!m_hasChanged) {

View file

@ -681,6 +681,18 @@ bool BotSupport::isModel (const edict_t *ent, StringRef model) {
return model.startsWith (ent->v.model.chars (9));
}
String BotSupport::getCurrentDateTime () {
time_t ticks = time (&ticks);
tm timeinfo {};
plat.loctime (&timeinfo, &ticks);
auto timebuf = strings.chars ();
strftime (timebuf, StringBuffer::StaticBufferSize, "%d-%m-%Y %H:%M:%S", &timeinfo);
return String (timebuf);
}
int32 BotSupport::sendTo (int socket, const void *message, size_t length, int flags, const sockaddr *dest, int destLength) {
const auto send = [&] (const Twin <const uint8 *, size_t> &msg) -> int32 {
return Socket::sendto (socket, msg.first, msg.second, flags, dest, destLength);