Permalink
Browse files

PlayerJoined from FullUpdate fix

  • Loading branch information...
1 parent 9db7fdd commit 216d6f46fad36f88099f2fd2d3b8767d52d7eec0 Calle Lejdbrandt committed Jun 5, 2012
Showing with 5 additions and 3 deletions.
  1. +1 −1 src/cnt/network/ConnectionNetworking.java
  2. +4 −2 src/cnt/network/GameNetworking.java
@@ -322,7 +322,7 @@ void startJoin(final String playerName, final String foreignHost, final int port
this.foreignID = answer.server;
PacketFactory.setID(this.localID = answer.client);
FullUpdate update = (FullUpdate)(input.readObject());
- Blackboard.broadcastMessage(update);
+ this.gameNetworking.receive(PacketFactory.createBroadcast(update, true));
}
catch (Exception err)
{ if (this.isServer)
@@ -121,13 +121,14 @@ else if (packet.getMessage() instanceof Whisper)
Blackboard.BlackboardMessage blackboardMessage = (Blackboard.BlackboardMessage)message.getMessage();
if(blackboardMessage.checkIntegrity() == Boolean.FALSE)
return;
-
+ System.err.println("\033[1;33mGameNetworking: Correct type: " + (blackboardMessage instanceof FullUpdate ? "\033[1;32mOK\033[0m" : "\033[1;31mNO: " + blackboardMessage.getClass() + "\033[0m"));
if (blackboardMessage instanceof FullUpdate)
{
- final FullUpdate update = (FullUpdate)object;
+ final FullUpdate update = (FullUpdate)blackboardMessage;
if (update.isGathering() == false)
{
for (final Player player : (Iterable<Player>)(update.data.get(PlayerRing.class)))
+ System.err.println("\033[1;33mGameNetworking: Sending PlayerJoineds\033[0m");
this.blackboardNetworking.receiveAndBroadcast(new PlayerJoined(player));
}
}
@@ -136,6 +137,7 @@ else if (packet.getMessage() instanceof Whisper)
}
catch (Exception err)
{
+ System.err.println("\033[1;33mGameNetworking recived EXCEPTION!\033[0m");
return;
}
}

0 comments on commit 216d6f4

Please sign in to comment.