View Javadoc

1   /*
2    * The ReWinder Project
3    * 
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU General Public License
6    * as published by the Free Software Foundation; either version 2
7    * of the License, or (at your option) any later version.
8   
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13  
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, write to the Free Software
16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17   */
18  package ch.twiddlefinger.inet.rewinder.model.entities;
19  
20  /***
21   * @author matthias.vonrohr
22   *
23   * To change the template for this generated type comment go to
24   * Window>Preferences>Java>Code Generation>Code and Comments
25   */
26  public class GameType {
27  
28  	private int type;
29  	
30  	/*** FFA or Singleplayer ladder game */
31  	public static final GameType LADDER_FFA = new GameType(0x01);
32  	/*** Custom game */
33  	public static final GameType CUSTOM = new GameType(0x09);
34  	/*** Singleplayer game */
35  	public static final GameType SINGLEPLAYER = new GameType(0x1D);
36  	/*** Team Ladder game (2on2/3on3/4on4 AT/RT) */
37  	public static final GameType LADDER_TEAM = new GameType(0x20);
38  	/*** unsupported game type */
39  	public static final GameType UNKNOWN = new GameType(0xFF);
40  
41  	public GameType(int type) {
42  		this.type = type;
43  	}
44  
45  	public String toString() {
46  		switch (type) {
47  			case 0x01 :
48  				return "Ladder 1on1 or FFA";
49  
50  			case 0x09 :
51  				return "Custom game";
52  
53  			case 0x1D :
54  				return "Singleplayer Game";
55  
56  			case 0x20 :
57  				return "Ladder Team game (AT/RT 2on2/3on3/4on4)";
58  
59  			default :
60  				return "unknown gametype";
61  		}
62  	}
63  	
64  	public boolean equals(Object o) {
65  		if(o instanceof GameType) {
66  			return ((GameType)o).type == this.type;
67  		} else {
68  			return false;
69  		}
70  	}
71  
72  }