energyTycoon
Class ServerGame

java.lang.Object
  extended by java.lang.Thread
      extended by energyTycoon.Game
          extended by energyTycoon.ServerGame
All Implemented Interfaces:
java.lang.Runnable

public class ServerGame
extends energyTycoon.Game

Game server class


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class energyTycoon.Game
communicationPhysicPlayer, updateBattery, updateCity, updateIndustry, updateNetworkDistantPlayer, updatePowerStation
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServerGame(int gameID, java.lang.String gameName, int scriptId, int money, int maxPlayer)
          ServerGame constructor
 
Method Summary
 energyTycoon.NetworkServerPlayer addPlayer(energyTycoon.server.ServerClient client)
          add a new player to the game
 void compute()
           
 void dealChatMessage(int playerId, java.lang.String message)
           
 void deletePlayer(int playerId)
          delete a player
 void run()
           
 boolean startGame()
           
 
Methods inherited from class energyTycoon.Game
dealNetworkMessage, getDay, getGameId, getGameName, getSeason, getTime, getWeather, getWind
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerGame

public ServerGame(int gameID,
                  java.lang.String gameName,
                  int scriptId,
                  int money,
                  int maxPlayer)
ServerGame constructor

Parameters:
gameID - game identifier
gameName - name of the game
scriptId - script identifier
money - money the player start with
maxPlayer - maximum number of player
Method Detail

addPlayer

public energyTycoon.NetworkServerPlayer addPlayer(energyTycoon.server.ServerClient client)
add a new player to the game

Parameters:
client - ServerClient that receive network message

deletePlayer

public void deletePlayer(int playerId)
delete a player

Parameters:
playerId - player identifier we want to remove from the game

compute

public void compute()
Specified by:
compute in class energyTycoon.Game

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class energyTycoon.Game

startGame

public boolean startGame()

dealChatMessage

public void dealChatMessage(int playerId,
                            java.lang.String message)