Oh oh oh oh oh!!!

This commit is contained in:
MarcEricMartel
2023-12-06 14:31:05 -05:00
parent 42ea83d73e
commit 242250f251
5 changed files with 40 additions and 28 deletions

View File

@@ -276,16 +276,14 @@ void Server::Run() {
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 killer = m_conns.at(conn->player->Killer)->player->GetUsername();
std::string mess = getDeathMessage(conn->player->GetUsername(), killer);
strcpy(chat->mess, 140, mess.c_str());
Log(mess, false, false);
chatlog.emplace_back(chat);
++deadplayers;
conn->m_nsync == false;
conn->m_nsync = false;
}
else {
for (auto& chmo : conn->ChunkDiffs)
@@ -342,12 +340,6 @@ void Server::Run() {
delete chmo;
}
//for (auto& bull : outbox_bullets)
//delete bull;
//for (auto& bull : netbull)
//delete bull;
outbox_bullets.clear();
netbull.clear();
chunkdiffs.clear();
@@ -358,7 +350,7 @@ void Server::Run() {
end.src_id = 0;
char endmess[] = "Game over, mothereffers.";
strcpy(end.mess, endmess);
strcpy(end.mess, 140, endmess);
for (auto& [key, conn] : m_conns)
sendPackTo<Chat>(m_sock_udp, &end, &m_buf, conn->getAddr());
@@ -451,6 +443,7 @@ std::string Server::getDeathMessage(std::string username, std::string killer) co
mess.append(killer);
mess.append(temp.substr(indk + 1));
}
else mess.append(temp.substr(ind + 1));
}
else {
mess.append(temp.substr(0, indk));