SYNC_ACC CMOD_ACC GLOBALS

This commit is contained in:
MarcEricMartel
2023-12-13 14:27:11 -05:00
parent 2dbaf84844
commit fd1fe66d13
4 changed files with 23 additions and 22 deletions

View File

@@ -242,9 +242,9 @@ void Server::Run() {
if (last == 0)
last = tstamp;
sync_acc += tstamp - last;
if (sync_acc >= 1000) {
while (sync_acc >= 1000)
sync_acc -= 1000;
if (sync_acc >= SYNC_ACC) {
while (sync_acc >= SYNC_ACC)
sync_acc -= SYNC_ACC;
--timer;
std::string str = "Timer: ";
Log(str.append(std::to_string(timer)), false, false);
@@ -304,7 +304,6 @@ void Server::Run() {
for (auto& bull : conn->Bullets) {
bullets.emplace_back(bull);
//Log("POW!", false, false);
BulletAdd* nbul = new BulletAdd();
nbul->pos = bull->getPos();
nbul->dir = bull->getVel();
@@ -315,12 +314,11 @@ void Server::Run() {
}
conn->Bullets.clear();
}
/* Out */
conn->sendPacks(m_sock_udp, m_conns, timer);
}
if ((deadplayers == players - 1 && deadplayers != 0) || timer <= 0)
/* Out */
conn->sendPacks(m_sock_udp, m_conns, timer);
if ((deadplayers == players - 1 && deadplayers != 0) || timer < 0)
endgame = true;
}