fixed observers to work properly
This commit is contained in:
parent
23ccede27b
commit
5f8ee768a1
3 changed files with 9 additions and 4 deletions
|
@ -108,12 +108,14 @@ public:
|
|||
config reply;
|
||||
const network::connection res = network::receive_data(reply);
|
||||
if(res) {
|
||||
std::cerr << "received data while waiting: " << reply.write() << "\n";
|
||||
if(reply.values["failed"] == "yes") {
|
||||
got_side = false;
|
||||
throw network::error("Side chosen is unavailable");
|
||||
} else if(reply.values["side_secured"].empty() == false) {
|
||||
got_side = true;
|
||||
} else if(reply.children["start_game"].empty() == false) {
|
||||
std::cerr << "received start_game message\n";
|
||||
//break out of dialog
|
||||
return START_GAME;
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "game.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
int game::id_num = 1;
|
||||
|
||||
|
|
|
@ -141,10 +141,11 @@ int main()
|
|||
}
|
||||
|
||||
lobby_players.remove_player(sock);
|
||||
it->add_player(sock);
|
||||
|
||||
//send them the game data
|
||||
network::send_data(it->level(),sock);
|
||||
|
||||
it->add_player(sock);
|
||||
}
|
||||
|
||||
//see if it's a message, in which case we add the name
|
||||
|
@ -169,6 +170,8 @@ int main()
|
|||
continue;
|
||||
}
|
||||
|
||||
std::cerr << "data to game: " << data.write() << "\n";
|
||||
|
||||
//if this is data describing the level for a game
|
||||
if(data.child("side") != NULL) {
|
||||
|
||||
|
@ -214,10 +217,9 @@ int main()
|
|||
}
|
||||
|
||||
if(data.child("start_game")) {
|
||||
std::cerr << "!! start_game: " << data.write() << "\n";
|
||||
g->start_game();
|
||||
}
|
||||
|
||||
if(data["side_secured"].empty() == false) {
|
||||
} else if(data["side_secured"].empty() == false) {
|
||||
continue;
|
||||
} else if(data["failed"].empty() == false) {
|
||||
std::cerr << "ERROR: failure to get side\n";
|
||||
|
|
Loading…
Add table
Reference in a new issue