This commit is contained in:
MarcEricMartel 2023-12-07 13:05:52 -05:00
parent 5696e20452
commit f6c5379a8c
2 changed files with 11 additions and 6 deletions

View File

@ -224,6 +224,14 @@ void Server::Run() {
std::vector<Bullet*> bullets, outbox_bullets; std::vector<Bullet*> bullets, outbox_bullets;
std::vector<BulletAdd*> netbull; std::vector<BulletAdd*> netbull;
Chat* startchat;
startchat->src_id = 0;
char startmess[] = "How would YOU like to die today, motherfuckers?";
strcpy(startchat->mess, 140, startmess);
chatlog.emplace_back(startchat);
while (!endgame) { while (!endgame) {
using namespace std::chrono; using namespace std::chrono;
Timestamp tstamp = duration_cast<milliseconds>(high_resolution_clock::now() - start).count(); Timestamp tstamp = duration_cast<milliseconds>(high_resolution_clock::now() - start).count();
@ -330,10 +338,6 @@ void Server::Run() {
} }
} }
//for (auto& bull : outbox_bullets)
// delete bull;
//outbox_bullets.clear();
for (auto& chat : chatlog) { for (auto& chat : chatlog) {
Log(chat->mess, false, false); Log(chat->mess, false, false);
for (auto& [key, conn] : m_conns) for (auto& [key, conn] : m_conns)
@ -354,7 +358,7 @@ void Server::Run() {
Chat end; Chat end;
end.src_id = 0; end.src_id = 0;
char endmess[] = "Game over, mothereffers."; char endmess[] = "Game over, man. Game over.";
strcpy(end.mess, 140, endmess); strcpy(end.mess, 140, endmess);
@ -362,7 +366,7 @@ void Server::Run() {
sendPackTo<Chat>(m_sock_udp, &end, &m_buf, conn->getAddr()); sendPackTo<Chat>(m_sock_udp, &end, &m_buf, conn->getAddr());
// TODO: Gérer les 2-3 secondes post-game avant le billboard pour pas avoir un whiplash à la fin de la game. // TODO: Gérer les 2-3 secondes post-game avant le billboard pour pas avoir un whiplash à la fin de la game.
system("pause");
} }
inline std::string Server::LogTimestamp() { inline std::string Server::LogTimestamp() {

View File

@ -1,6 +1,7 @@
#ifndef SERVER_H__ #ifndef SERVER_H__
#define SERVER_H__ #define SERVER_H__
#include <cstdlib>
#include <fstream> #include <fstream>
#include <vector> #include <vector>
#include <set> #include <set>