use of soc.game.SOCGame in project JSettlers2 by jdmonin.
the class SOCGameList method deleteGame.
/**
* Remove the game from the list
* and call {@link SOCGame#destroyGame()}.
* Set its mutex's {@link GameInfo#gameDestroyed} flag.
*
* @param gaName the name of the game; should not be marked with any prefix.
*/
public synchronized void deleteGame(final String gaName) {
D.ebugPrintln("SOCGameList : deleteGame(" + gaName + ")");
SOCGame game = gameData.get(gaName);
if (game != null) {
game.destroyGame();
gameData.remove(gaName);
}
GameInfo info = gameInfo.get(gaName);
info.gameDestroyed = true;
gameInfo.remove(gaName);
synchronized (info.mutex) {
info.mutex.notifyAll();
}
info.dispose();
}
use of soc.game.SOCGame in project JSettlers2 by jdmonin.
the class SOCDisplaylessPlayerClient method handleRESOURCECOUNT.
/**
* handle "resource count" message
* @param mes the message
*/
protected void handleRESOURCECOUNT(SOCResourceCount mes) {
final SOCGame ga = games.get(mes.getGame());
if (ga == null)
return;
handlePLAYERELEMENT_simple(ga, null, mes.getPlayerNumber(), SOCPlayerElement.SET, SOCPlayerElement.RESOURCE_COUNT, mes.getCount(), nickname);
}
use of soc.game.SOCGame in project JSettlers2 by jdmonin.
the class SOCDisplaylessPlayerClient method handlePIECEVALUE.
/**
* Update a village piece's value on the board (cloth remaining) in _SC_CLVI,
* or a pirate fortress's strength in _SC_PIRI.
* @since 2.0.00
*/
protected void handlePIECEVALUE(final SOCPieceValue mes) {
final String gaName = mes.getGame();
SOCGame ga = games.get(gaName);
if (ga == null)
// Not one of our games
return;
if (!ga.hasSeaBoard)
// should not happen
return;
final int coord = mes.getParam1();
final int pv = mes.getParam2();
if (ga.isGameOptionSet(SOCGameOption.K_SC_CLVI)) {
SOCVillage vi = ((SOCBoardLarge) (ga.getBoard())).getVillageAtNode(coord);
if (vi != null)
vi.setCloth(pv);
} else if (ga.isGameOptionSet(SOCGameOption.K_SC_PIRI)) {
SOCFortress fort = ga.getFortress(coord);
if (fort != null)
fort.setStrength(pv);
}
}
use of soc.game.SOCGame in project JSettlers2 by jdmonin.
the class SOCDisplaylessPlayerClient method handleREVEALFOGHEX.
/**
* Reveal a hidden hex on the board.
* @since 2.0.00
*/
protected void handleREVEALFOGHEX(final SOCRevealFogHex mes) {
final String gaName = mes.getGame();
SOCGame ga = games.get(gaName);
if (ga == null)
// Not one of our games
return;
if (!ga.hasSeaBoard)
// should not happen
return;
ga.revealFogHiddenHex(mes.getParam1(), mes.getParam2(), mes.getParam3());
}
use of soc.game.SOCGame in project JSettlers2 by jdmonin.
the class SOCDisplaylessPlayerClient method handleDICERESULTRESOURCES.
/**
* Handle all players' dice roll result resources. Looks up the game and calls
* {@link #handleDICERESULTRESOURCES(SOCDiceResultResources, SOCGame)}
* so the players gain resources.
* @since 2.0.00
*/
protected void handleDICERESULTRESOURCES(final SOCDiceResultResources mes) {
SOCGame ga = games.get(mes.getGame());
if (ga == null)
return;
handleDICERESULTRESOURCES(mes, ga, nickname, false);
}
Aggregations