|
|
|
@@ -218,7 +218,7 @@ void Server::Run() {
|
|
|
|
|
int timer = m_game.countdown, sync_acc = 0, deadplayers = 0;
|
|
|
|
|
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
|
|
|
|
|
Timestamp last = 0;
|
|
|
|
|
std::vector<Chat> chatlog;
|
|
|
|
|
std::vector<Chat*> chatlog;
|
|
|
|
|
std::vector<ChunkMod*> chunkdiffs;
|
|
|
|
|
std::vector<Bullet*> bullets, outbox_bullets;
|
|
|
|
|
std::vector<BulletAdd*> netbull;
|
|
|
|
@@ -237,6 +237,7 @@ void Server::Run() {
|
|
|
|
|
std::string str = "Timer: ";
|
|
|
|
|
Log(str.append(std::to_string(timer).append(" SyncAcc: ").append(std::to_string(sync_acc))), false, false);
|
|
|
|
|
}
|
|
|
|
|
last = tstamp;
|
|
|
|
|
|
|
|
|
|
for (auto& [key, conn] : m_conns) {
|
|
|
|
|
|
|
|
|
@@ -258,8 +259,8 @@ void Server::Run() {
|
|
|
|
|
if (Deserialize(&sync, pck, &bsize)) {}
|
|
|
|
|
break;
|
|
|
|
|
case CHAT:
|
|
|
|
|
if (Deserialize(&chat, pck, &bsize))
|
|
|
|
|
chatlog.push_back(chat);
|
|
|
|
|
//if (Deserialize(&chat, pck, &bsize))
|
|
|
|
|
//chatlog.push_back(chat);
|
|
|
|
|
break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
@@ -272,17 +273,17 @@ void Server::Run() {
|
|
|
|
|
Timestamp tstamp = conn->Run(m_world);
|
|
|
|
|
|
|
|
|
|
if (conn->player->AmIDead() && tstamp) {
|
|
|
|
|
Chat chat;
|
|
|
|
|
chat.dest_id = chat.dest_team_id = chat.src_id = 0;
|
|
|
|
|
Chat* chat = new Chat();
|
|
|
|
|
chat->dest_id = chat->dest_team_id = chat->src_id = 0;
|
|
|
|
|
|
|
|
|
|
std::string killer = m_conns.at(key)->player->GetUsername();
|
|
|
|
|
|
|
|
|
|
std::string mess = getDeathMessage(conn->player->GetUsername(), killer);
|
|
|
|
|
|
|
|
|
|
strcpy(chat.mess, 140, mess.c_str());
|
|
|
|
|
Log("You is dead", false, false);
|
|
|
|
|
strcpy(chat->mess, 140, mess.c_str());
|
|
|
|
|
Log(mess, false, false);
|
|
|
|
|
|
|
|
|
|
m_chatlog[tstamp] = chat;
|
|
|
|
|
chatlog.emplace_back(chat);
|
|
|
|
|
++deadplayers;
|
|
|
|
|
conn->m_nsync == false;
|
|
|
|
|
}
|
|
|
|
@@ -329,9 +330,10 @@ void Server::Run() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto& chat : chatlog) {
|
|
|
|
|
Log(chat.mess, false, false);
|
|
|
|
|
Log(chat->mess, false, false);
|
|
|
|
|
for (auto& [key, conn] : m_conns)
|
|
|
|
|
sendPackTo<Chat>(m_sock_udp, &chat, &m_buf, conn->getAddr());
|
|
|
|
|
sendPackTo<Chat>(m_sock_udp, chat, &m_buf, conn->getAddr());
|
|
|
|
|
delete chat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto& chmo : chunkdiffs) {
|
|
|
|
|