🔫
This commit is contained in:
@@ -217,7 +217,7 @@ void Server::Run() {
|
||||
sendPackTo<Sync>(m_sock_udp, &sync, &m_buf, conn->getAddr());
|
||||
}
|
||||
|
||||
int timer = m_game.countdown, sync_acc = 0, deadplayers = 0;
|
||||
int timer = m_game.countdown, timer_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;
|
||||
@@ -241,10 +241,10 @@ void Server::Run() {
|
||||
|
||||
if (last == 0)
|
||||
last = tstamp;
|
||||
sync_acc += tstamp - last;
|
||||
if (sync_acc >= SYNC_ACC) {
|
||||
while (sync_acc >= SYNC_ACC)
|
||||
sync_acc -= SYNC_ACC;
|
||||
timer_acc += tstamp - last;
|
||||
if (timer_acc >= 1000) {
|
||||
while (timer_acc >= 1000)
|
||||
timer_acc -= 1000;
|
||||
--timer;
|
||||
std::string str = "Timer: ";
|
||||
Log(str.append(std::to_string(timer)), false, false);
|
||||
@@ -280,22 +280,26 @@ void Server::Run() {
|
||||
/* Process */
|
||||
|
||||
if (conn->m_nsync) {
|
||||
if (conn->player->AmIDead())
|
||||
conn->m_nsync = false;
|
||||
|
||||
Timestamp tstamp = conn->Run(m_world);
|
||||
|
||||
if (conn->player->AmIDead()) {
|
||||
if (conn->player->AmIDead() && !conn->player->Eulogy) {
|
||||
Chat* chat = new Chat();
|
||||
chat->dest_id = chat->dest_team_id = chat->src_id = 0;
|
||||
|
||||
std::string killer = m_conns.at(conn->player->Killer)->player->GetUsername();
|
||||
Player* murderer = m_conns.at(conn->player->Killer)->player;
|
||||
|
||||
murderer->addPoint();
|
||||
|
||||
std::string killer = murderer->GetUsername();
|
||||
|
||||
std::string mess = getDeathMessage(conn->player->GetUsername(), killer);
|
||||
|
||||
strcpy(chat->mess, 140, mess.c_str());
|
||||
chatlog.emplace_back(chat);
|
||||
++deadplayers;
|
||||
|
||||
conn->player->Eulogy = true;
|
||||
}
|
||||
else {
|
||||
for (auto& chmo : conn->ChunkDiffs)
|
||||
@@ -367,8 +371,7 @@ void Server::Run() {
|
||||
|
||||
for (auto& [key, conn] : m_conns) {
|
||||
std::string str = conn->player->GetUsername();
|
||||
Log(str.append(" ").append(std::to_string(conn->player->GetHP())), false, false);
|
||||
|
||||
Log(str.append(" ").append(std::to_string(conn->player->getScore())), false, false);
|
||||
}
|
||||
|
||||
for (auto& [key, conn] : m_conns)
|
||||
|
Reference in New Issue
Block a user