Skip to content

Commit

Permalink
Possible bugfix: users saying ships stay after sink
Browse files Browse the repository at this point in the history
  • Loading branch information
David52920 committed Mar 1, 2021
1 parent 035dff4 commit cecf9c3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.benberi.cadesim.client.packet.in;

import java.util.HashSet;

import com.benberi.cadesim.GameContext;
import com.benberi.cadesim.client.codec.util.Packet;
import com.benberi.cadesim.client.packet.ClientPacketExecutor;
Expand Down Expand Up @@ -28,6 +30,8 @@ public void execute(Packet p) {
getContext().getBattleScreen().initializePlayerCamera(v);
}
}
HashSet<Object> seen=new HashSet<>();
getContext().getEntities().vessels.removeIf(e->!seen.add(e.getName()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.benberi.cadesim.client.packet.in;

import java.util.HashSet;

import com.benberi.cadesim.GameContext;
import com.benberi.cadesim.client.codec.util.Packet;
import com.benberi.cadesim.client.packet.ClientPacketExecutor;
Expand Down Expand Up @@ -44,8 +46,9 @@ public void execute(Packet p) {
else {
p.getBuffer().readerIndex(p.getBuffer().readerIndex() + 16);
}

}
HashSet<Object> seen=new HashSet<>();
getContext().getEntities().vessels.removeIf(e->!seen.add(e.getName()));
getContext().getBattleScreen().setTurnExecute();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,14 @@ public boolean performActionCollision(Player player, Position target, int turn,
continue;
}
collide(p, player, turn, phase);
// collide(player, player, turn, phase);
// int playerTile = context.getMap().getTile(player.getX(), player.getY());
// int tile = context.getMap().getTile(p.getX(), p.getY());
// if(context.getMap().isWhirlpool(tile) && context.getMap().isWind(playerTile)) { //below needed to spin ship in place
// p.setFace(p.getFace().getNext());
// p.getAnimationStructure().getTurn(turn).setFace(p.getFace());
// p.getAnimationStructure().getTurn(turn).setSpinCollision(true);
// player.getAnimationStructure().getTurn(turn).setSpinCollision(false);
// }
int playerTile = context.getMap().getTile(player.getX(), player.getY());
int tile = context.getMap().getTile(p.getX(), p.getY());
if(context.getMap().isWhirlpool(tile) && context.getMap().isWind(playerTile)) { //below needed to spin ship in place
p.setFace(p.getFace().getNext());
p.getAnimationStructure().getTurn(turn).setFace(p.getFace());
p.getAnimationStructure().getTurn(turn).setSpinCollision(true);
player.getAnimationStructure().getTurn(turn).setSpinCollision(false);
}
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ else if (
playerManager.renewGame();
context.getTimeMachine().renewRound(); // bugfix - order matters
if(ServerConfiguration.getAISetting() != "off") {
playerManager.spawnAI();
playerManager.spawnAI();
for(Player other : playerManager.listBots()) {
other.performLogic();
}
}
for(Player other : playerManager.listBots()) {
other.performLogic();
}
playerManager.serverBroadcastMessage("Started new round: #" + (gamesCompleted + 1));
}

Expand Down

0 comments on commit cecf9c3

Please sign in to comment.