Début
This commit is contained in:
@@ -65,6 +65,31 @@ int Server::Init() {
|
||||
}
|
||||
|
||||
int Server::Ready() {
|
||||
int nbrjoueurs = 0,
|
||||
nbrconn = 0;
|
||||
#ifdef SRV_MANUAL_SETUP
|
||||
do {
|
||||
Log("Entrez la dur<75>e de la partie: ", false, false);
|
||||
std::cin >> m_game.countdown;
|
||||
std::cout << std::endl;
|
||||
} while (m_game.countdown < 1);
|
||||
do {
|
||||
Log("Entrez le seed de la partie: ", false, false);
|
||||
std::cin >> m_game.seed;
|
||||
std::cout << std::endl;
|
||||
} while (m_game.seed < 1);
|
||||
do {
|
||||
Log("Entrez le nombre de joueurs: ", false, false);
|
||||
std::cin >> nbrjoueurs;
|
||||
std::cout << std::endl;
|
||||
} while (nbrjoueurs > 0 && nbrjoueurs >= MAX_CONNECTIONS);
|
||||
#else // setup preconfigur<75>
|
||||
m_game.countdown = 360;
|
||||
m_game.seed = 9370707;
|
||||
nbrjoueurs = 1;
|
||||
#endif
|
||||
m_game.gameType = 1;
|
||||
|
||||
if (listen(m_sock_tcp, MAX_CONNECTIONS) < 0) {
|
||||
Log("<EFBFBD>coute sur le port TCP.", true, true);
|
||||
return 1;
|
||||
@@ -79,13 +104,17 @@ int Server::Ready() {
|
||||
|
||||
buildIdList(ID_LIST_SIZE);
|
||||
|
||||
m_game.countdown = 360;
|
||||
m_game.gameType = 1;
|
||||
m_game.seed = 9370707;
|
||||
|
||||
|
||||
while (!readystart) {
|
||||
sockaddr_in sockad;
|
||||
|
||||
#ifdef _WIN32
|
||||
int addrlen = sizeof(sockad);
|
||||
#else // maudit que c'est con, <20>a.
|
||||
unsigned int addrlen = sizeof(sockad);
|
||||
#endif
|
||||
|
||||
SOCKET sock = accept(m_sock_tcp, (sockaddr*)&sockad, &addrlen);
|
||||
|
||||
if (sock < 0)
|
||||
@@ -127,7 +156,8 @@ int Server::Ready() {
|
||||
Connection* conn = new Connection(sock, sockad, log, play);
|
||||
|
||||
m_players[log.sid] = conn;
|
||||
readystart = true;
|
||||
if (++nbrconn >= nbrjoueurs)
|
||||
readystart = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user