forked from SantiSev/jazz-jackrabbit-2-remake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- modifico algunas cosas para seguir buenas practicas - falta mucho refactor TODO - funcionamiento sigue igual, de eso no toque nada
- Loading branch information
maxogod
committed
Jun 8, 2024
1 parent
5975522
commit 5ffc840
Showing
4 changed files
with
32 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,25 @@ | ||
#include "server.h" | ||
|
||
#include <iostream> | ||
#include <utility> | ||
|
||
#include "game_logic/matches_manager.h" | ||
#include "protocol/accepter.h" | ||
Server::Server(const std::string& port): accepter(new ServerAccepter(port)) {} | ||
|
||
void Server::run() { | ||
try { | ||
auto accepter = new ServerAccepter("8080"); | ||
accepter->start(); | ||
|
||
std::string serverInput; | ||
while (true) { | ||
std::cin >> serverInput; | ||
if (serverInput == "q") { | ||
if (serverInput == QUIT) { | ||
break; | ||
} | ||
} | ||
|
||
accepter->stop(); | ||
accepter->join(); | ||
delete accepter; | ||
} catch (const std::exception& err) { | ||
std::cerr << "An exception was caught in server_class: " << err.what() << "\n"; | ||
} | ||
} | ||
|
||
const std::string& Server::get_servname() { return portDir; } | ||
|
||
Server::Server(std::string port): portDir(std::move(port)) {} | ||
|
||
Server::~Server() = default; | ||
Server::~Server() { | ||
accepter->stop(); | ||
accepter->join(); | ||
delete accepter; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters