home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / enxle1f6 / src / games / battle / shared / sys / symbols.java < prev   
Encoding:
Java Source  |  1996-08-14  |  6.2 KB  |  249 lines

  1. /*
  2.  * @(#)Symbols.java
  3.  */
  4. package games.Battle.shared.sys;
  5.  
  6. /**
  7.  * Symbols is a collection of constants that are used throughout the source.
  8.  *
  9.  * @version 1.00
  10.  * @author Jay Steele
  11.  * @author Alex Nicolaou
  12.  */
  13.  
  14. public class Symbols {
  15.     /**
  16.      * The maximum number of players allowed in a single game.
  17.      */
  18.     public static final int MAX_PLAYERS = 5;
  19.     /**
  20.      * The number of terrain levels
  21.      */
  22.     public static final int NUM_TERRAIN_LEVELS = 8;
  23.     /**
  24.      * The most troops that can be in a cell on the server side. The server
  25.      * stores the number of troops in a cell at a greater precision than the
  26.      * client to help keep transmission costs down.
  27.      */
  28.     public static final int MAX_SERVER_TROOPS = 100;
  29.     /**
  30.      * The most troops that can be in a cell on the client side.
  31.      */
  32.     public static final int MAX_CLIENT_TROOPS = 31;
  33.     /**
  34.      * The width of the board in pixels
  35.      */
  36.     public static final int BOARD_W = 512;
  37.     /**
  38.      * The height of the board in pixels
  39.      */
  40.     public static final int BOARD_H = 512;
  41.  
  42.     /**
  43.      * NORTH, the north direction for a pipe
  44.      */
  45.     public static final int NORTH     = 0;
  46.     /**
  47.      * EAST, the east direction for a pipe
  48.      */
  49.     public static final int    EAST     = 1;
  50.     /**
  51.      * SOUTH, the south direction for a pipe
  52.      */
  53.     public static final int    SOUTH     = 2;
  54.     /**
  55.      * WEST, the west direction for a pipe
  56.      */
  57.     public static final int    WEST     = 3;
  58.  
  59.     /**
  60.      * NORTHEAST indicates both a north and an east pipe
  61.      */
  62.     public static final int NORTHEAST     = 4;
  63.     /**
  64.      * SOUTHEAST indicates both a south and an east pipe
  65.      */
  66.     public static final int SOUTHEAST     = 5;
  67.     /**
  68.      * SOUTHWEST indicates both a south and a west pipe
  69.      */
  70.     public static final int SOUTHWEST    = 6;
  71.     /**
  72.      * NORTHWEST indicates both a north and a west pipe
  73.      */
  74.     public static final int NORTHWEST    = 7;
  75.  
  76.     /**
  77.      * a mask for extracting pipes from a packed byte
  78.      */
  79.     public static final int[] PIPE_MASK = { 0x01, 0x02, 0x04, 0x08 };
  80.  
  81.     /**
  82.      * occupancy defines for the various players
  83.      */
  84.     public static final int PLAYER0         = 0x0000;
  85.     public static final int PLAYER1         = 0x0001;
  86.     public static final int PLAYER2         = 0x0002;
  87.     public static final int PLAYER3         = 0x0003;
  88.     public static final int PLAYER4         = 0x0004;
  89.     /**
  90.      * an array of player symbols for the various players
  91.      */
  92.     public static final int PLAYER_SYMBOL[] = { 
  93.         Symbols.PLAYER0, 
  94.         Symbols.PLAYER1, 
  95.         Symbols.PLAYER2,
  96.         Symbols.PLAYER3,
  97.         Symbols.PLAYER4
  98.     };
  99.     /**
  100.      * the value of an unoccupied cell
  101.      */
  102.     public static final int UNOCCUPIED         = 0x0005;
  103.     /**
  104.      * the value of an invisible cell
  105.      */
  106.     public static final int INVISIBLE         = 0x0006;
  107.     /**
  108.      * the value of an unmodified cell
  109.      */
  110.     public static final int UNMODIFIED         = 0x0007;
  111.  
  112.     /**
  113.      * strings used for debugging printouts, arranged so that
  114.      * the index matches the occupancy value
  115.      */
  116.     public static String[] occupancyString = {
  117.         "Player0",
  118.         "Player1",
  119.         "Player2",
  120.         "Player3",
  121.         "Player4",
  122.  
  123.         "Unoccupied",
  124.         "Invisible",
  125.         "Unmodified"
  126.     };
  127.  
  128.     /**
  129.      * command to connect a pipe, sent from client to server.
  130.      */
  131.     public static final short NORTH_PIPE     = (short)0x0000;
  132.     /**
  133.      * command to connect a pipe, sent from client to server.
  134.      */
  135.     public static final short EAST_PIPE     = (short)0x0001;
  136.     /**
  137.      * command to connect a pipe, sent from client to server.
  138.      */
  139.     public static final short SOUTH_PIPE    = (short)0x0002;
  140.     /**
  141.      * command to connect a pipe, sent from client to server.
  142.      */
  143.     public static final short WEST_PIPE     = (short)0x0003;
  144.     /**
  145.      * command to connect a pipe, sent from client to server.
  146.      */
  147.     public static final short X_NORTH_PIPE     = (short)0x0004;
  148.     /**
  149.      * command to connect a pipe, sent from client to server.
  150.      */
  151.     public static final short X_EAST_PIPE     = (short)0x0005;
  152.     /**
  153.      * command to connect a pipe, sent from client to server.
  154.      */
  155.     public static final short X_SOUTH_PIPE    = (short)0x0006;
  156.     /**
  157.      * command to connect a pipe, sent from client to server.
  158.      */
  159.     public static final short X_WEST_PIPE     = (short)0x0007;
  160.     /**
  161.      * command to connect a pipe, sent from client to server.
  162.      */
  163.     public static final short CLEAR_PIPES    = (short)0x0008;
  164.     /**
  165.      * command to build a city (not implemented)
  166.      */
  167.     public static final short BUILD         = (short)0x0009;
  168.     /**
  169.      * command to scuttle a city (not implemented)
  170.      */
  171.     public static final short SCUTTLE         = (short)0x000a;
  172.     /**
  173.      * command to dig land (not implemented)
  174.      */
  175.     public static final short DIG             = (short)0x000b;
  176.     /**
  177.      * command to fill land (not implemented)
  178.      */
  179.     public static final short FILL             = (short)0x000c;
  180.     /**
  181.      * command to paratroop into a square
  182.      */
  183.     public static final short PARATROOP     = (short)0x000d;
  184.     /**
  185.      * command to gun a square
  186.      */
  187.     public static final short GUN            = (short)0x000e;
  188.     /**
  189.      * command to set reserves (not used yet)
  190.      */
  191.     public static final short RESERVES         = (short)0x000f;
  192.     /**
  193.      * command to surrender
  194.      */
  195.     public static final short SURRENDER     = (short)0x0010;
  196.     /**
  197.      * command to signal an error, sent from client to server
  198.      */
  199.     public static final short ERROR            = (short)0xffff;
  200.  
  201.     /**
  202.      * strings for debugging client->server messages, 
  203.      * arranged so that index matches value
  204.      */
  205.     public static String[] commandString = {
  206.         "North_Pipe",
  207.         "East_Pipe",
  208.         "South_Pipe",
  209.         "West_Pipe",
  210.         "Build",
  211.         "Scuttle",
  212.         "Dig",
  213.         "Fill",
  214.         "Gun",
  215.         "Paratroop",
  216.         "Reserves",
  217.         "Surrender",
  218.         "Error"
  219.     };
  220.  
  221.     /**
  222.      * indicate a game init packet by the server (not yet used)
  223.      */
  224.     public static final short GAME_INIT            = (short)0x0000;
  225.     /**
  226.      * indicate a terrain init packet by the server (not yet used)
  227.      */
  228.     public static final short TERRAIN_INIT        = (short)0x0001;
  229.     /**
  230.      * indicate a board diff packet by the server (not yet used)
  231.      */
  232.     public static final short BOARD_DIFF        = (short)0x0002;
  233.     /**
  234.      * indicate a player surrender packet by the server (not yet used)
  235.      */
  236.     public static final short PLAYER_SURRENDER    = (short)0x0003;
  237.  
  238.     /**
  239.      * for debugging server messages, indexes arranged to match value
  240.      * of constants.
  241.      */
  242.     public static String[] tagString = {
  243.         "Game_Init",
  244.         "Terrain_Init",
  245.         "Board_Diff",
  246.         "Player_Surrender"
  247.     };
  248. }
  249.