[Jais-checkins] jaisteam/src/jais JaisTeam.java,1.15,1.16 Jais.java,1.28,1.29
Status: Beta
Brought to you by:
maestrodd
|
From: <mae...@us...> - 2002-07-14 22:56:43
|
Update of /cvsroot/jais/jaisteam/src/jais In directory usw-pr-cvs1:/tmp/cvs-serv30379 Modified Files: JaisTeam.java Jais.java Log Message: viewmodes added & more checkgoalkick new progged by bombenleger ... many bugs.... Index: JaisTeam.java =================================================================== RCS file: /cvsroot/jais/jaisteam/src/jais/JaisTeam.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** JaisTeam.java 13 Jul 2002 16:21:50 -0000 1.15 --- JaisTeam.java 14 Jul 2002 22:56:40 -0000 1.16 *************** *** 8,11 **** --- 8,12 ---- import jais.utils.*; import jais.world.WorldModel; + import java.io.*; /** *************** *** 22,26 **** private boolean m_commandLineReading = true; // indicate when we have to stop, or not start to read from commandline private static Logger logger; // logger from the apache project ! /** * Constructor starts up f_numberOfPlayers and begins reading from commandline --- 23,27 ---- private boolean m_commandLineReading = true; // indicate when we have to stop, or not start to read from commandline private static Logger logger; // logger from the apache project ! private BufferedReader m_input; /** * Constructor starts up f_numberOfPlayers and begins reading from commandline *************** *** 43,52 **** if (m_numberOfPlayers>1)//if we should connect more than one player, we connect a goalie as first player { ! m_playerList.add(new Jais(f_teamName,f_serverName,f_serverPort,true,1,false)); l_connectedPlayers++; } for (int i=l_connectedPlayers; i<m_numberOfPlayers; i++) { // create the rest of the team here ! m_playerList.add(new Jais(f_teamName,f_serverName,f_serverPort,false,i+1,false)); } } --- 44,53 ---- if (m_numberOfPlayers>1)//if we should connect more than one player, we connect a goalie as first player { ! m_playerList.add(new Jais(this, f_teamName,f_serverName,f_serverPort,true,1,false)); l_connectedPlayers++; } for (int i=l_connectedPlayers; i<m_numberOfPlayers; i++) { // create the rest of the team here ! m_playerList.add(new Jais(this, f_teamName,f_serverName,f_serverPort,false,i+1,false)); } } *************** *** 154,157 **** --- 155,171 ---- /** + * This method is called by the communication if it thinks, there is no more server present + * @param f_timesWaited how many times it retried to receive stuff + */ + public void informClientDisconnected() + { + m_numberOfPlayers--; + if (m_numberOfPlayers==0) + { + m_commandLineReading=false; + System.out.println("All Players disconnected ... hit RETURN to quit"); + } + } + /** * This method reads all commandline parameters which are typed in while the game * is running and passes them to the corresponding player *************** *** 160,164 **** private void readFromCommandline() { ! BufferedReader l_input = new BufferedReader(new InputStreamReader(System.in)); String l_message= new String(); String l_tempString= new String(); --- 174,178 ---- private void readFromCommandline() { ! m_input = new BufferedReader(new InputStreamReader(System.in)); String l_message= new String(); String l_tempString= new String(); *************** *** 168,172 **** System.out.print("\nType help for help \n>"); try ! { l_message=l_input.readLine(); } catch (Exception ex) { --- 182,186 ---- System.out.print("\nType help for help \n>"); try ! { l_message=m_input.readLine(); } catch (Exception ex) { Index: Jais.java =================================================================== RCS file: /cvsroot/jais/jaisteam/src/jais/Jais.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Jais.java 13 Jul 2002 16:21:50 -0000 1.28 --- Jais.java 14 Jul 2002 22:56:40 -0000 1.29 *************** *** 27,30 **** --- 27,31 ---- static Logger logger=Logger.getLogger("jais"); + JaisTeam m_jaisTeam; //reference on our creator if present WorldModel m_worldModel; Visualization m_visualization; *************** *** 40,44 **** boolean m_commandLineReading=true; boolean m_singleMode=false; ! /** * @param f_teamName name of our team --- 41,45 ---- boolean m_commandLineReading=true; boolean m_singleMode=false; ! BufferedReader m_inputReader; //needed for reading from commandline if in singlemode /** * @param f_teamName name of our team *************** *** 52,57 **** * @roseuid 3CE6898C0366 */ ! public Jais(String f_teamName, String f_serverName, int f_serverPort, boolean f_isGoalie,int f_playerNumber, boolean f_singleMode) throws xJais { this.setName("Jais"+f_playerNumber); m_teamName=f_teamName; //store our Teamname --- 53,59 ---- * @roseuid 3CE6898C0366 */ ! public Jais(JaisTeam f_jaisTeam, String f_teamName, String f_serverName, int f_serverPort, boolean f_isGoalie,int f_playerNumber, boolean f_singleMode) throws xJais { + m_jaisTeam=f_jaisTeam; this.setName("Jais"+f_playerNumber); m_teamName=f_teamName; //store our Teamname *************** *** 113,116 **** --- 115,124 ---- { logger.fatal("Jais #"+m_playerNumber +" says bye...lost conn to server"); + if (!m_singleMode) + m_jaisTeam.informClientDisconnected(); + else + { + System.out.println("... hit RETURN to quit"); + } this.quit(); } *************** *** 123,132 **** public static void main(String[] args) { ! FileAppender fa = new FileAppender(); ! fa.setFile("jais.txt"); ! fa.setLayout(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN)); ! fa.setAppend(false); ! fa.activateOptions(); ! logger.addAppender(fa); BasicConfigurator.configure(); --- 131,140 ---- public static void main(String[] args) { ! FileAppender l_fa = new FileAppender(); ! l_fa.setFile("jais.txt"); ! l_fa.setLayout(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN)); ! l_fa.setAppend(false); ! l_fa.activateOptions(); ! logger.addAppender(l_fa); BasicConfigurator.configure(); *************** *** 144,154 **** try { ! player=new Jais((String)l_args.get("Teamname"), (String)l_args.get("Servername"), Integer.parseInt((String)l_args.get("Serverport")), ((Boolean)l_args.get("g")).booleanValue(), 0, ! true ! ); } catch(xJais ex) { --- 152,161 ---- try { ! player=new Jais(null, (String)l_args.get("Teamname"), (String)l_args.get("Servername"), Integer.parseInt((String)l_args.get("Serverport")), ((Boolean)l_args.get("g")).booleanValue(), 0, ! true); } catch(xJais ex) { *************** *** 481,485 **** private void readFromCommandline() { ! BufferedReader l_input = new BufferedReader(new InputStreamReader(System.in)); String l_message= new String(); while(m_commandLineReading) --- 488,492 ---- private void readFromCommandline() { ! m_inputReader = new BufferedReader(new InputStreamReader(System.in)); String l_message= new String(); while(m_commandLineReading) *************** *** 488,492 **** try { ! l_message=l_input.readLine(); } --- 495,499 ---- try { ! l_message=m_inputReader.readLine(); } |