From d131cd36bbe19f3a81b0f6be04fca7866971712d Mon Sep 17 00:00:00 2001 From: mdb Date: Thu, 12 Dec 2002 05:51:55 +0000 Subject: [PATCH] Le metric crapload of changes to bring things up to date with the latest Narya libraries and to finish the name change from Venison to Atlantissonne. git-svn-id: https://samskivert.googlecode.com/svn/trunk@969 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- projects/atlanti/.jde-project.el | 4 + projects/atlanti/build.xml | 8 +- projects/atlanti/lib/README | 21 +-- .../rsrc/config/atlanti/dbmap.properties | 4 +- .../rsrc/config/atlanti/server.properties | 4 +- .../rsrc/config/micasa/server.properties | 15 +- .../src/java/com/samskivert/atlanti/Log.java | 22 +-- .../samskivert/atlanti/TileGeometryTest.java | 22 +-- .../atlanti/client/AtlantiBoard.java | 80 +++++----- .../atlanti/client/AtlantiConfigurator.java | 54 +++++++ .../atlanti/client/AtlantiController.java | 39 +++-- .../atlanti/client/AtlantiPanel.java | 60 +++---- .../atlanti/client/PlayerInfoView.java | 50 +++--- .../samskivert/atlanti/client/TileLabel.java | 15 +- .../atlanti/client/TurnIndicatorView.java | 42 ++--- .../samskivert/atlanti/data/AtlantiCodes.java | 14 +- .../atlanti/data/AtlantiConfig.java | 40 +++-- .../atlanti/data/AtlantiObject.dobj | 22 ++- .../atlanti/data/AtlantiObject.java | 24 +-- .../samskivert/atlanti/data/AtlantiTile.java | 111 ++++++------- .../com/samskivert/atlanti/data/Feature.java | 28 ++-- .../com/samskivert/atlanti/data/Piecen.java | 10 +- .../samskivert/atlanti/data/TileCodes.java | 6 +- .../atlanti/server/AtlantiManager.java | 147 ++++++++++-------- .../server/AtlantiManagerDelegate.java | 18 ++- .../samskivert/atlanti/util/FeatureUtil.java | 7 +- .../samskivert/atlanti/util/PiecenUtil.java | 4 +- .../com/samskivert/atlanti/util/TileUtil.java | 112 ++++++------- 28 files changed, 556 insertions(+), 427 deletions(-) create mode 100644 projects/atlanti/.jde-project.el create mode 100644 projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiConfigurator.java diff --git a/projects/atlanti/.jde-project.el b/projects/atlanti/.jde-project.el new file mode 100644 index 00000000..ef6bdcac --- /dev/null +++ b/projects/atlanti/.jde-project.el @@ -0,0 +1,4 @@ +(jde-set-variables + '(jde-db-source-directories (quote ("/export/local/jdk1.4/src" "/home/mdb/projects/samskivert/src/java" "/home/mdb/work/narya/src/java" "/home/mdb/projects/atlanti/src/java"))) + '(jde-global-classpath (quote ("/home/mdb/projects/samskivert/dist/classes" "/home/mdb/work/narya/dist/classes" "/home/mdb/projects/atlanti/dist/classes"))) + ) diff --git a/projects/atlanti/build.xml b/projects/atlanti/build.xml index 7a70bfef..0d1099b0 100644 --- a/projects/atlanti/build.xml +++ b/projects/atlanti/build.xml @@ -1,10 +1,10 @@ - + - - - + + + diff --git a/projects/atlanti/lib/README b/projects/atlanti/lib/README index 35f65eb7..84671cf9 100644 --- a/projects/atlanti/lib/README +++ b/projects/atlanti/lib/README @@ -1,7 +1,7 @@ Required external libraries --------------------------- -The Venison code requires the following external Java libraries (JAR +The Atlantissonne code requires the following external Java libraries (JAR files) to be placed (or symlinked) here in the lib/ directory or in the shared library directory specified in the build.xml file (${java.libraries}). @@ -12,17 +12,9 @@ shared library directory specified in the build.xml file * The samskivert package: http://www.waywardgeeks.org/code/samskivert/ -* MM MySQL driver: +* A MySQL driver: http://mmmysql.sourceforge.net/ -* Matt Welsh's Non-blocking IO library: - http://www.cs.berkeley.edu/~mdw/proj/java-nbio/ - - (The native code shared library should be built and placed into - lib/i686-Linux where it will be automatically added to LD_LIBRARY_PATH - by the runjava script. Alternatively you can put it into your - LD_LIBRARY_PATH by hand.) - * The Java API for XML Processing (JAXP) 1.1 Reference Implementation: http://java.sun.com/xml/download.html @@ -32,15 +24,12 @@ shared library directory specified in the build.xml file * Megginson Technologies' XMLWriter 0.2 library: http://www.megginson.com/Software/xml-writer-0.2.zip -* The ? game development platform - http://www.threerings.net/code/?/ - -* The MiCasa game hosting service - http://www.threerings.net/code/micasa/ +* The Narya game development libraries + http://www.threerings.net/code/narya/ Once the jar files are in place (regardless of what they are named), the build system will automatically include them in the compile-time classpath. -- -$Id: README,v 1.1 2001/10/09 20:27:35 mdb Exp $ +$Id: README,v 1.2 2002/12/12 05:51:53 mdb Exp $ diff --git a/projects/atlanti/rsrc/config/atlanti/dbmap.properties b/projects/atlanti/rsrc/config/atlanti/dbmap.properties index c39d793c..13495243 100644 --- a/projects/atlanti/rsrc/config/atlanti/dbmap.properties +++ b/projects/atlanti/rsrc/config/atlanti/dbmap.properties @@ -1,8 +1,8 @@ # -# $Id: dbmap.properties,v 1.1 2001/10/09 20:27:35 mdb Exp $ +# $Id: dbmap.properties,v 1.2 2002/12/12 05:51:53 mdb Exp $ # # This provides information on the JDBC connections that are used by -# Venison server services. +# Atlantisonne server services. # # The database mapping for the user database. diff --git a/projects/atlanti/rsrc/config/atlanti/server.properties b/projects/atlanti/rsrc/config/atlanti/server.properties index d7e76de4..ad4dad8f 100644 --- a/projects/atlanti/rsrc/config/atlanti/server.properties +++ b/projects/atlanti/rsrc/config/atlanti/server.properties @@ -1,4 +1,4 @@ # -# $Id: server.properties,v 1.1 2001/10/09 20:27:35 mdb Exp $ +# $Id: server.properties,v 1.2 2002/12/12 05:51:53 mdb Exp $ # -# Configuration for the Venison server +# Configuration for the Atlantissonne server diff --git a/projects/atlanti/rsrc/config/micasa/server.properties b/projects/atlanti/rsrc/config/micasa/server.properties index d2de477a..1a0c839c 100644 --- a/projects/atlanti/rsrc/config/micasa/server.properties +++ b/projects/atlanti/rsrc/config/micasa/server.properties @@ -1,17 +1,20 @@ # -# $Id: server.properties,v 1.2 2001/10/24 03:25:11 mdb Exp $ +# $Id: server.properties,v 1.3 2002/12/12 05:51:53 mdb Exp $ # # Configuration for the MiCasa server +_package = atlanti.server +_overrides = micasa.server + # # The list of lobby identifiers to be loaded into this server. # -lobby_ids = venison +lobby_ids = atlanti # # The cofiguration for the test lobby. # -venison.config = com.threerings.micasa.lobby.table.TableLobbyConfig -venison.ugi = venison,board,tile,strategy -venison.name = Venison Lobby -venison.game_config = com.threerings.venison.VenisonConfig +atlanti.config = com.threerings.micasa.lobby.table.TableLobbyConfig +atlanti.ugi = atlanti,board,tile,strategy +atlanti.name = Atlanti Lobby +atlanti.game_config = com.samskivert.atlanti.data.AtlantiConfig diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/Log.java b/projects/atlanti/src/java/com/samskivert/atlanti/Log.java index 9fd1c93e..906e53cb 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/Log.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/Log.java @@ -1,20 +1,20 @@ // -// $Id: Log.java,v 1.2 2001/10/09 20:27:35 mdb Exp $ +// $Id: Log.java,v 1.3 2002/12/12 05:51:53 mdb Exp $ -package com.threerings.venison; +package com.samskivert.atlanti; /** * A placeholder class that contains a reference to the log object used by - * the Venison package. This is a useful pattern to use when using the - * samskivert logging facilities. One creates a top-level class like this - * one that instantiates a log object with an name that identifies log - * messages from that package and then provides static methods that - * generate log messages using that instance. Then, classes in that - * package need only import the log wrapper class and can easily use it to - * generate log messages. For example: + * this package. This is a useful pattern to use when using the samskivert + * logging facilities. One creates a top-level class like this one that + * instantiates a log object with an name that identifies log messages + * from that package and then provides static methods that generate log + * messages using that instance. Then, classes in that package need only + * import the log wrapper class and can easily use it to generate log + * messages. For example: * *
- * import com.threerings.venison.Log;
+ * import com.samskivert.atlanti.Log;
  * // ...
  * Log.warning("All hell is breaking loose!");
  * // ...
@@ -26,7 +26,7 @@ public class Log
 {
     /** The static log instance configured for use by this package. */
     public static com.samskivert.util.Log log =
-	new com.samskivert.util.Log("venison");
+	new com.samskivert.util.Log("atlanti");
 
     /** Convenience function. */
     public static void debug (String message)
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/TileGeometryTest.java b/projects/atlanti/src/java/com/samskivert/atlanti/TileGeometryTest.java
index 571eecb1..08edbe6d 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/TileGeometryTest.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/TileGeometryTest.java
@@ -1,7 +1,7 @@
 //
-// $Id: TileGeometryTest.java,v 1.5 2002/01/29 23:45:56 mdb Exp $
+// $Id: TileGeometryTest.java,v 1.6 2002/12/12 05:51:53 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti;
 
 import java.awt.Dimension;
 import java.awt.Graphics;
@@ -16,17 +16,21 @@ import com.threerings.resource.ResourceManager;
 import com.threerings.media.ImageManager;
 import com.threerings.media.tile.TileManager;
 
+import com.samskivert.atlanti.data.AtlantiTile;
+import com.samskivert.atlanti.data.TileCodes;
+import com.samskivert.atlanti.util.PiecenUtil;
+
 /**
  * A simple class for testing the tile geometry specifications by drawing
  * them.
  */
-public class TileGeometryTest
-    extends JPanel implements TileCodes
+public class TileGeometryTest extends JPanel
+    implements TileCodes
 {
     public TileGeometryTest ()
     {
         for (int i = 0; i < TILE_TYPES; i++) {
-            _tiles[i] = new VenisonTile(i+1, true, NORTH, i % 5, i / 5);
+            _tiles[i] = new AtlantiTile(i+1, true, NORTH, i % 5, i / 5);
         }
     }
 
@@ -50,12 +54,12 @@ public class TileGeometryTest
     {
         JFrame frame = new JFrame("Tile geometry test");
 
-        ResourceManager rmgr = new ResourceManager("rsrc", null, null);
+        ResourceManager rmgr = new ResourceManager("rsrc");
         ImageManager imgr = new ImageManager(rmgr, frame);
         TileManager tmgr = new TileManager(imgr);
 
-        VenisonTile.setTileManager(tmgr);
-        VenisonTile.piecenDebug = true;
+        AtlantiTile.setManagers(imgr, tmgr);
+        AtlantiTile.piecenDebug = true;
         PiecenUtil.init(tmgr);
 
         // quit if we're closed
@@ -67,5 +71,5 @@ public class TileGeometryTest
         frame.show();
     }
 
-    protected VenisonTile[] _tiles = new VenisonTile[TILE_TYPES];
+    protected AtlantiTile[] _tiles = new AtlantiTile[TILE_TYPES];
 }
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiBoard.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiBoard.java
index 58bf3d6b..3d045520 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiBoard.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiBoard.java
@@ -1,7 +1,7 @@
 //
-// $Id: AtlantiBoard.java,v 1.17 2002/05/21 04:45:10 mdb Exp $
+// $Id: AtlantiBoard.java,v 1.18 2002/12/12 05:51:53 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti.client;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -18,27 +18,34 @@ import com.samskivert.util.CollectionUtil;
 
 import com.threerings.presents.dobj.DSet;
 
+import com.samskivert.atlanti.Log;
+import com.samskivert.atlanti.data.AtlantiCodes;
+import com.samskivert.atlanti.data.AtlantiTile;
+import com.samskivert.atlanti.data.Piecen;
+import com.samskivert.atlanti.data.TileCodes;
+import com.samskivert.atlanti.util.TileUtil;
+
 /**
- * Displays the tiles that make up the Venison board.
+ * Displays the tiles that make up the board.
  */
-public class VenisonBoard
-    extends JPanel implements TileCodes, VenisonCodes
+public class AtlantiBoard extends JPanel
+    implements TileCodes, AtlantiCodes
 {
     /**
-     * Constructs a Venison board.
+     * Constructs a board.
      */
-    public VenisonBoard ()
+    public AtlantiBoard ()
     {
         // create mouse adapters that will let us know when interesting
         // mouse events happen
         addMouseListener(new MouseAdapter() {
             public void mouseClicked (MouseEvent evt) {
-                VenisonBoard.this.mouseClicked(evt);
+                AtlantiBoard.this.mouseClicked(evt);
             }
         });
         addMouseMotionListener(new MouseMotionAdapter() {
             public void mouseMoved (MouseEvent evt) {
-                VenisonBoard.this.mouseMoved(evt);
+                AtlantiBoard.this.mouseMoved(evt);
             }
         });
     }
@@ -56,7 +63,7 @@ public class VenisonBoard
      * are forgotten and the new tiles are initialized according to their
      * geometry to set up initial claim groups.
      *
-     * @param tset the set of {@link VenisonTile} objects to be displayed
+     * @param tset the set of {@link AtlantiTile} objects to be displayed
      * by this board.
      */
     public void setTiles (DSet tset)
@@ -94,7 +101,7 @@ public class VenisonBoard
      * Instructs the board to add the specified tile to the display. The
      * tile will have its claims inherited accordingly.
      */
-    public void addTile (VenisonTile tile)
+    public void addTile (AtlantiTile tile)
     {
         Log.info("Adding tile to board " + tile + ".");
 
@@ -135,7 +142,7 @@ public class VenisonBoard
         // locate the tile associated with this piecen
         int tidx = _tiles.indexOf(piecen);
         if (tidx != -1) {
-            VenisonTile tile = (VenisonTile)_tiles.get(tidx);
+            AtlantiTile tile = (AtlantiTile)_tiles.get(tidx);
             // set the piecen on the tile (supplying our tile list so that
             // the necessary claim group adjustments can be made)
             tile.setPiecen(piecen, _tiles);
@@ -157,7 +164,7 @@ public class VenisonBoard
         // locate the tile associated with this piecen key
         int tsize = _tiles.size();
         for (int i = 0; i < tsize; i++) {
-            VenisonTile tile = (VenisonTile)_tiles.get(i);
+            AtlantiTile tile = (AtlantiTile)_tiles.get(i);
             if (tile.getKey().equals(key)) {
                 // clear the piecen out of the tile
                 tile.clearPiecen();
@@ -208,12 +215,12 @@ public class VenisonBoard
      * @param tile the new tile to be placed or null if no tile is to
      * currently be placed.
      */
-    public void setTileToBePlaced (VenisonTile tile)
+    public void setTileToBePlaced (AtlantiTile tile)
     {
         Log.info("Setting tile to be placed [tile=" + tile + "].");
 
         // make a copy of this tile so that we can play with it
-        _placingTile = (VenisonTile)tile.clone();;
+        _placingTile = (AtlantiTile)tile.clone();;
 
         // update our internal state based on this new placing tile
         if (_placingTile != null) {
@@ -224,7 +231,7 @@ public class VenisonBoard
     /**
      * Returns the last tile placed by the user.
      */
-    public VenisonTile getPlacedTile ()
+    public AtlantiTile getPlacedTile ()
     {
         return _placedTile;
     }
@@ -242,7 +249,7 @@ public class VenisonBoard
     /**
      * Causes the supplied tile to be repainted.
      */
-    public void repaintTile (VenisonTile tile)
+    public void repaintTile (AtlantiTile tile)
     {
         int offx = _tx + (tile.x + _origX) * TILE_WIDTH;
         int offy = _ty + (tile.y + _origY) * TILE_HEIGHT;
@@ -262,7 +269,7 @@ public class VenisonBoard
         // iterate over our tiles, painting each of them
         int tsize = _tiles.size();
         for (int i = 0; i < tsize; i++) {
-            VenisonTile tile = (VenisonTile)_tiles.get(i);
+            AtlantiTile tile = (AtlantiTile)_tiles.get(i);
             tile.paint(g2, _origX, _origY);
         }
 
@@ -551,7 +558,7 @@ public class VenisonBoard
         // figure out what our boundaries are
         int tsize = _tiles.size();
         for (int i = 0; i < tsize; i++) {
-            VenisonTile tile = (VenisonTile)_tiles.get(i);
+            AtlantiTile tile = (AtlantiTile)_tiles.get(i);
             if (tile.x > maxX) {
                 maxX = tile.x;
             } else if (tile.x < minX) {
@@ -594,24 +601,24 @@ public class VenisonBoard
     {
         JFrame frame = new JFrame("Board test");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        VenisonBoard board = new VenisonBoard();
+        AtlantiBoard board = new AtlantiBoard();
 
         TestDSet set = new TestDSet();
-        set.addTile(new VenisonTile(CITY_TWO, true, WEST, 0, 0));
-        set.addTile(new VenisonTile(CITY_TWO, false, WEST, -1, 1));
-        set.addTile(new VenisonTile(CITY_ONE, false, SOUTH, -1, -1));
-        VenisonTile zero = new VenisonTile(CURVED_ROAD, false, WEST, 0, 2);
+        set.addTile(new AtlantiTile(CITY_TWO, true, WEST, 0, 0));
+        set.addTile(new AtlantiTile(CITY_TWO, false, WEST, -1, 1));
+        set.addTile(new AtlantiTile(CITY_ONE, false, SOUTH, -1, -1));
+        AtlantiTile zero = new AtlantiTile(CURVED_ROAD, false, WEST, 0, 2);
         set.addTile(zero);
-        VenisonTile one = new VenisonTile(TWO_CITY_TWO, false, NORTH, 0, 1);
+        AtlantiTile one = new AtlantiTile(TWO_CITY_TWO, false, NORTH, 0, 1);
         set.addTile(one);
-        set.addTile(new VenisonTile(CITY_THREE, false, WEST, 1, 1));
-        set.addTile(new VenisonTile(CITY_THREE_ROAD, false, EAST, 1, 2));
-        set.addTile(new VenisonTile(CITY_THREE, false, NORTH, -1, 0));
-        VenisonTile two = new VenisonTile(CITY_ONE, false, EAST, -2, 0);
+        set.addTile(new AtlantiTile(CITY_THREE, false, WEST, 1, 1));
+        set.addTile(new AtlantiTile(CITY_THREE_ROAD, false, EAST, 1, 2));
+        set.addTile(new AtlantiTile(CITY_THREE, false, NORTH, -1, 0));
+        AtlantiTile two = new AtlantiTile(CITY_ONE, false, EAST, -2, 0);
         set.addTile(two);
         board.setTiles(set);
 
-        VenisonTile placing = new VenisonTile(CITY_TWO, false, NORTH, 0, 0);
+        AtlantiTile placing = new AtlantiTile(CITY_TWO, false, NORTH, 0, 0);
         board.setTileToBePlaced(placing);
 
         // set a feature group to test propagation
@@ -640,12 +647,7 @@ public class VenisonBoard
 
     protected static class TestDSet extends DSet
     {
-        public TestDSet ()
-        {
-            super(VenisonTile.class);
-        }
-
-        public void addTile (VenisonTile tile)
+        public void addTile (AtlantiTile tile)
         {
             add(tile);
         }
@@ -655,13 +657,13 @@ public class VenisonBoard
     protected ArrayList _tiles = new ArrayList();
 
     /** The tile currently being placed by the user. */
-    protected VenisonTile _placingTile;
+    protected AtlantiTile _placingTile;
 
     /** The last tile being placed by the user. */
-    protected VenisonTile _placedTile;
+    protected AtlantiTile _placedTile;
 
     /** The last tile placed on the board via {@link #addTile}. */
-    protected VenisonTile _lastPlacedTile;
+    protected AtlantiTile _lastPlacedTile;
 
     /** A flag indicating whether or not we're placing a piecen. */
     protected boolean _placingPiecen = false;
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiConfigurator.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiConfigurator.java
new file mode 100644
index 00000000..63de441b
--- /dev/null
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiConfigurator.java
@@ -0,0 +1,54 @@
+//
+// $Id: AtlantiConfigurator.java,v 1.1 2002/12/12 05:51:53 mdb Exp $
+
+package com.samskivert.atlanti.client;
+
+import com.samskivert.swing.SimpleSlider;
+import com.samskivert.swing.VGroupLayout;
+
+import com.threerings.micasa.lobby.table.TableGameConfigurator;
+
+import com.samskivert.atlanti.data.AtlantiConfig;
+
+/**
+ * Provides a user interface for configuring a game.
+ */
+public class AtlantiConfigurator extends TableGameConfigurator
+{
+    // documentation inherited
+    protected void createConfigInterface ()
+    {
+        super.createConfigInterface();
+
+//         _boardSize = new SimpleSlider("Board size:", 16, 48, 32);
+//         add(_boardSize, VGroupLayout.FIXED);
+//         _handSize = new SimpleSlider("Hand size:", 2, 5, 5);
+//         add(_handSize, VGroupLayout.FIXED);
+    }
+
+    // documentation inherited
+    protected void gotGameConfig ()
+    {
+        super.gotGameConfig();
+        _vconfig = (AtlantiConfig)_config;
+
+//         // configure our elements
+//         _boardSize.setValue(_vconfig.boardWidth);
+//         _handSize.setValue(_vconfig.handSize);
+    }
+
+    // documentation inherited
+    protected void flushGameConfig ()
+    {
+        super.flushGameConfig();
+
+//         // configure our elements
+//         _vconfig.boardWidth = _boardSize.getValue();
+//         _vconfig.boardHeight = _boardSize.getValue();
+//         _vconfig.handSize = _handSize.getValue();
+    }
+
+    protected AtlantiConfig _vconfig;
+//     protected SimpleSlider _boardSize;
+//     protected SimpleSlider _handSize;
+}
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiController.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiController.java
index d90c55f0..94a0fc84 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiController.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiController.java
@@ -1,7 +1,7 @@
 //
 // $Id
 
-package com.threerings.venison;
+package com.samskivert.atlanti.client;
 
 import java.awt.event.ActionEvent;
 import com.samskivert.util.ListUtil;
@@ -25,19 +25,24 @@ import com.threerings.parlor.util.ParlorContext;
 
 import com.threerings.micasa.util.MiCasaContext;
 
-import com.threerings.venison.Log;
+import com.samskivert.atlanti.Log;
+import com.samskivert.atlanti.data.AtlantiCodes;
+import com.samskivert.atlanti.data.AtlantiObject;
+import com.samskivert.atlanti.data.AtlantiTile;
+import com.samskivert.atlanti.data.Piecen;
+import com.samskivert.atlanti.util.TileUtil;
 
 /**
  * The main coordinator of user interface activities on the client-side of
- * the Venison game.
+ * the game.
  */
-public class VenisonController extends GameController
-    implements TurnGameController, VenisonCodes, SetListener
+public class AtlantiController extends GameController
+    implements TurnGameController, AtlantiCodes, SetListener
 {
     /**
      * Creates our controller and prepares it for operation.
      */
-    public VenisonController ()
+    public AtlantiController ()
     {
         addDelegate(_delegate = new TurnGameControllerDelegate(this));
     }
@@ -54,7 +59,7 @@ public class VenisonController extends GameController
     // documentation inherited
     protected PlaceView createPlaceView ()
     {
-        _panel = new VenisonPanel((MiCasaContext)_ctx, this);
+        _panel = new AtlantiPanel((MiCasaContext)_ctx, this);
         return _panel;
     }
 
@@ -64,7 +69,7 @@ public class VenisonController extends GameController
         super.willEnterPlace(plobj);
 
         // get a casted reference to our game object
-        _venobj = (VenisonObject)plobj;
+        _venobj = (AtlantiObject)plobj;
 
         // find out what our index is and use that as our piecen color
         _selfIndex = ListUtil.indexOfEqual(_venobj.players, _self.username);
@@ -99,10 +104,10 @@ public class VenisonController extends GameController
         super.attributeChanged(event);
 
         // handle the setting of the board state
-        if (event.getName().equals(VenisonObject.TILES)) {
+        if (event.getName().equals(AtlantiObject.TILES)) {
             _panel.board.setTiles(_venobj.tiles);
 
-        } else if (event.getName().equals(VenisonObject.PIECENS)) {
+        } else if (event.getName().equals(AtlantiObject.PIECENS)) {
             _panel.board.setPiecens(_venobj.piecens);
         }
     }
@@ -111,12 +116,12 @@ public class VenisonController extends GameController
     public void entryAdded (EntryAddedEvent event)
     {
         // we care about additions to TILES and PIECENS
-        if (event.getName().equals(VenisonObject.TILES)) {
+        if (event.getName().equals(AtlantiObject.TILES)) {
             // a tile was added, add it to the board
-            VenisonTile tile = (VenisonTile)event.getEntry();
+            AtlantiTile tile = (AtlantiTile)event.getEntry();
             _panel.board.addTile(tile);
 
-        } else if (event.getName().equals(VenisonObject.PIECENS)) {
+        } else if (event.getName().equals(AtlantiObject.PIECENS)) {
             // a piecen was added, place it on the board
             Piecen piecen = (Piecen)event.getEntry();
             _panel.board.placePiecen(piecen);
@@ -131,7 +136,7 @@ public class VenisonController extends GameController
     // documentation inherited
     public void entryRemoved (EntryRemovedEvent event)
     {
-        if (event.getName().equals(VenisonObject.PIECENS)) {
+        if (event.getName().equals(AtlantiObject.PIECENS)) {
             // a piecen was removed, update the board
             _panel.board.clearPiecen(event.getKey());
         }
@@ -141,7 +146,7 @@ public class VenisonController extends GameController
     public boolean handleAction (ActionEvent action)
     {
         if (action.getActionCommand().equals(TILE_PLACED)) {
-            VenisonTile tile = _panel.board.getPlacedTile();
+            AtlantiTile tile = _panel.board.getPlacedTile();
 
             // the user placed the tile into a valid location. grab the
             // placed tile from the board and submit it to the server
@@ -204,10 +209,10 @@ public class VenisonController extends GameController
     protected TurnGameControllerDelegate _delegate;
 
     /** A reference to our game panel. */
-    protected VenisonPanel _panel;
+    protected AtlantiPanel _panel;
 
     /** A reference to our game panel. */
-    protected VenisonObject _venobj;
+    protected AtlantiObject _venobj;
 
     /** A reference to our body object. */
     protected BodyObject _self;
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiPanel.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiPanel.java
index aaab53c6..17b4b2ab 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiPanel.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiPanel.java
@@ -1,7 +1,7 @@
 //
 // $Id
 
-package com.threerings.venison;
+package com.samskivert.atlanti.client;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -27,22 +27,27 @@ import com.threerings.crowd.client.PlaceView;
 import com.threerings.micasa.client.ChatPanel;
 import com.threerings.micasa.util.MiCasaContext;
 
+import com.samskivert.atlanti.Log;
+import com.samskivert.atlanti.data.AtlantiCodes;
+import com.samskivert.atlanti.data.AtlantiTile;
+import com.samskivert.atlanti.util.PiecenUtil;
+
 /**
- * The top-level user interface component for the Venison game display.
+ * The top-level user interface component for the game display.
  */
-public class VenisonPanel
-    extends JPanel implements PlaceView, ControllerProvider, VenisonCodes
+public class AtlantiPanel extends JPanel
+    implements PlaceView, ControllerProvider, AtlantiCodes
 {
     /** A reference to the board that is accessible to the controller. */
-    public VenisonBoard board;
+    public AtlantiBoard board;
 
     /** A reference to our _noplace button. */
     public JButton noplace;
 
     /**
-     * Constructs a new Venison game display.
+     * Constructs a new game display.
      */
-    public VenisonPanel (MiCasaContext ctx, VenisonController controller)
+    public AtlantiPanel (MiCasaContext ctx, AtlantiController controller)
     {
 	// give ourselves a wee bit of a border
 	setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
@@ -52,7 +57,7 @@ public class VenisonPanel
 	setLayout(gl);
 
         // create the board
-        board = new VenisonBoard();
+        board = new AtlantiBoard();
 
         // create a scroll area to contain the board
         JScrollPane scrolly = new JScrollPane(board);
@@ -101,23 +106,20 @@ public class VenisonPanel
 
         // we'll need this later to provide it
         _controller = controller;
+    }
+
+    // documentation inherited
+    public void addNotify ()
+    {
+        super.addNotify();
 
         // we can't create our image manager until we have access to our
         // containing frame
-        addAncestorListener(new AncestorListener() {
-            public void ancestorAdded (AncestorEvent event) {
-                // create our image manager
-                JRootPane rpane = getRootPane();
-                ImageManager imgr = new ImageManager(_rmgr, rpane);
-                TileManager tmgr = new TileManager(imgr);
-                VenisonTile.setTileManager(tmgr);
-                PiecenUtil.init(tmgr);
-            }
-            public void ancestorMoved (AncestorEvent event) {
-            }
-            public void ancestorRemoved (AncestorEvent event) {
-            }
-        });
+        JRootPane rpane = getRootPane();
+        ImageManager imgr = new ImageManager(_rmgr, rpane);
+        TileManager tmgr = new TileManager(imgr);
+        AtlantiTile.setManagers(imgr, tmgr);
+        PiecenUtil.init(tmgr);
     }
 
     // documentation inherited
@@ -140,15 +142,15 @@ public class VenisonPanel
 
     /** A reference to our controller that we need to implement the {@link
      * ControllerProvider} interface. */
-    protected VenisonController _controller;
+    protected AtlantiController _controller;
 
     // this stuff is all a bit of a hack right now. by all rights, the
-    // venison app should set up the resource manager, because it knows
-    // about that sort of stuff, and make it available via the venison
-    // context and we may have some better place for the tile manager to
-    // live. but it's late and i want to get this working, so fooey.
+    // MiCasa game app should set up the resource manager, because it
+    // knows about that sort of stuff, and make it available via the
+    // MiCasa context and we may have some better place for the tile
+    // manager to live. but it's late and i want to get this working, so
+    // fooey.
 
     /** Our resource manager. */
-    protected static ResourceManager _rmgr =
-        new ResourceManager("rsrc", null, null);
+    protected static ResourceManager _rmgr = new ResourceManager("rsrc");
 }
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/PlayerInfoView.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/PlayerInfoView.java
index dad2d7cc..97510407 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/client/PlayerInfoView.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/PlayerInfoView.java
@@ -1,7 +1,7 @@
 //
-// $Id: PlayerInfoView.java,v 1.4 2002/05/21 04:45:09 mdb Exp $
+// $Id: PlayerInfoView.java,v 1.5 2002/12/12 05:51:54 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti.client;
 
 import java.awt.Color;
 import java.awt.GridBagLayout;
@@ -20,6 +20,11 @@ import com.threerings.presents.dobj.EntryRemovedEvent;
 import com.threerings.crowd.client.PlaceView;
 import com.threerings.crowd.data.PlaceObject;
 
+import com.samskivert.atlanti.data.AtlantiCodes;
+import com.samskivert.atlanti.data.AtlantiObject;
+import com.samskivert.atlanti.data.Feature;
+import com.samskivert.atlanti.util.TileUtil;
+
 /**
  * Displays each of the players in the game, their piece color and their
  * score.
@@ -29,8 +34,8 @@ public class PlayerInfoView
     implements PlaceView, AttributeChangeListener, SetListener
 {
     /**
-     * Constructs a new player info panel, ready for insertion into a
-     * Venison game panel.
+     * Constructs a new player info panel, ready for insertion into the
+     * game panel.
      */
     public PlayerInfoView ()
     {
@@ -45,26 +50,25 @@ public class PlayerInfoView
     {
         // we want to grab a reference to the game object and add
         // ourselves as an attribute change listener
-        _venobj = (VenisonObject)plobj;
-        _venobj.addListener(this);
+        _atlobj = (AtlantiObject)plobj;
+        _atlobj.addListener(this);
 
         // we need score and piecen labels arrays so that we can keep
         // track of per player information
-        _scoreLabels = new JLabel[_venobj.players.length];
-        _piecenLabels = new JLabel[_venobj.players.length];
+        _scoreLabels = new JLabel[_atlobj.players.length];
+        _piecenLabels = new JLabel[_atlobj.players.length];
 
         // now that we're here, we can add an entry for every player
-        for (int i = 0; i < _venobj.players.length; i++) {
-            addPlayer(i, _venobj.players[i]);
+        for (int i = 0; i < _atlobj.players.length; i++) {
+            addPlayer(i, _atlobj.players[i]);
         }
 
         // if we have scores, update them
-        if (_venobj.scores.length == _venobj.players.length) {
+        if (_atlobj.scores != null) {
             updateScores();
+            // and the piecen count
+            updatePiecenCount();
         }
-
-        // update the piecen count
-        updatePiecenCount();
     }
 
     /**
@@ -101,15 +105,15 @@ public class PlayerInfoView
     public void didLeavePlace (PlaceObject plobj)
     {
         // remove our listening self
-        _venobj.removeListener(this);
-        _venobj = null;
+        _atlobj.removeListener(this);
+        _atlobj = null;
     }
 
     // documentation inherited
     public void attributeChanged (AttributeChangedEvent event)
     {
         // we care about the scores (which change)
-        if (event.getName().equals(VenisonObject.SCORES)) {
+        if (event.getName().equals(AtlantiObject.SCORES)) {
             updateScores();
         }
     }
@@ -136,8 +140,8 @@ public class PlayerInfoView
      */
     protected void updateScores ()
     {
-        for (int i = 0; i < _venobj.scores.length; i++) {
-            _scoreLabels[i].setText(Integer.toString(_venobj.scores[i]));
+        for (int i = 0; i < _atlobj.scores.length; i++) {
+            _scoreLabels[i].setText(Integer.toString(_atlobj.scores[i]));
         }
     }
 
@@ -146,15 +150,15 @@ public class PlayerInfoView
      */
     protected void updatePiecenCount ()
     {
-        for (int i = 0; i < _venobj.scores.length; i++) {
-            int pcount = TileUtil.countPiecens(_venobj.piecens, i);
-            int pleft = VenisonCodes.PIECENS_PER_PLAYER - pcount;
+        for (int i = 0; i < _atlobj.scores.length; i++) {
+            int pcount = TileUtil.countPiecens(_atlobj.piecens, i);
+            int pleft = AtlantiCodes.PIECENS_PER_PLAYER - pcount;
             _piecenLabels[i].setText("(" + pleft + ")");
         }
     }
 
     /** A reference to the game object. */
-    protected VenisonObject _venobj;
+    protected AtlantiObject _atlobj;
 
     /** References to our score label components. */
     protected JLabel[] _scoreLabels;
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/TileLabel.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/TileLabel.java
index 90ccf1e2..e87b4581 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/client/TileLabel.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/TileLabel.java
@@ -1,7 +1,7 @@
 //
-// $Id: TileLabel.java,v 1.1 2001/10/16 01:41:55 mdb Exp $
+// $Id: TileLabel.java,v 1.2 2002/12/12 05:51:54 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti.client;
 
 import java.awt.Color;
 import java.awt.Dimension;
@@ -10,11 +10,14 @@ import java.awt.Graphics2D;
 
 import javax.swing.JComponent;
 
+import com.samskivert.atlanti.data.AtlantiTile;
+import com.samskivert.atlanti.data.TileCodes;
+
 /**
  * Displays a single tile in a Swing component.
  */
-public class TileLabel
-    extends JComponent implements TileCodes
+public class TileLabel extends JComponent
+    implements TileCodes
 {
     /**
      * Configures the component to display the specified tile.
@@ -22,7 +25,7 @@ public class TileLabel
      * @param tile a reference to the tile to display or null if no tile
      * should be displayed.
      */
-    public void setTile (VenisonTile tile)
+    public void setTile (AtlantiTile tile)
     {
         _tile = tile;
         repaint();
@@ -46,5 +49,5 @@ public class TileLabel
     }
 
     /** The tile we are displaying. */
-    protected VenisonTile _tile;
+    protected AtlantiTile _tile;
 }
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/TurnIndicatorView.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/TurnIndicatorView.java
index 05e61da8..33988f72 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/client/TurnIndicatorView.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/TurnIndicatorView.java
@@ -1,7 +1,7 @@
 //
-// $Id: TurnIndicatorView.java,v 1.3 2002/01/29 23:47:03 mdb Exp $
+// $Id: TurnIndicatorView.java,v 1.4 2002/12/12 05:51:54 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti.client;
 
 import javax.swing.JLabel;
 import javax.swing.JPanel;
@@ -14,12 +14,14 @@ import com.threerings.presents.dobj.AttributeChangedEvent;
 import com.threerings.crowd.data.PlaceObject;
 import com.threerings.crowd.client.PlaceView;
 
+import com.samskivert.atlanti.data.AtlantiObject;
+
 /**
  * Displays who the current turn holder is as well as the tile they are
  * currently placing.
  */
-public class TurnIndicatorView
-    extends JPanel implements PlaceView, AttributeChangeListener
+public class TurnIndicatorView extends JPanel
+    implements PlaceView, AttributeChangeListener
 {
     /**
      * Creates a new turn indicator view which in turn creates its
@@ -47,8 +49,8 @@ public class TurnIndicatorView
     {
         // we want to grab a reference to the game object and add
         // ourselves as an attribute change listener
-        _venobj = (VenisonObject)plobj;
-        _venobj.addListener(this);
+        _atlobj = (AtlantiObject)plobj;
+        _atlobj.addListener(this);
 
         // update our displays
         updateCurrentTile();
@@ -61,24 +63,24 @@ public class TurnIndicatorView
     public void didLeavePlace (PlaceObject plobj)
     {
         // remove our listening self
-        _venobj.removeListener(this);
-        _venobj = null;
+        _atlobj.removeListener(this);
+        _atlobj = null;
     }
 
     // documentation inherited
     public void attributeChanged (AttributeChangedEvent event)
     {
-        if (event.getName().equals(VenisonObject.CURRENT_TILE)) {
+        if (event.getName().equals(AtlantiObject.CURRENT_TILE)) {
             // update the current tile display
             updateCurrentTile();
 
-        } else if (event.getName().equals(VenisonObject.STATE)) {
+        } else if (event.getName().equals(AtlantiObject.STATE)) {
             // update the game state display
             updateGameState();
             // update the tiles remaining
             updateRemainingTiles();
 
-        } else if (event.getName().equals(VenisonObject.TURN_HOLDER)) {
+        } else if (event.getName().equals(AtlantiObject.TURN_HOLDER)) {
             // update the turn holder
             updateTurnHolder();
 
@@ -89,16 +91,16 @@ public class TurnIndicatorView
 
     protected void updateGameState ()
     {
-        switch (_venobj.state) {
-        case VenisonObject.AWAITING_PLAYERS:
+        switch (_atlobj.state) {
+        case AtlantiObject.AWAITING_PLAYERS:
             _whoLabel.setText("Awaiting players...");
             _tileLabel.setTile(null);
             break;
-        case VenisonObject.GAME_OVER:
+        case AtlantiObject.GAME_OVER:
             _whoLabel.setText("Game over.");
             _tileLabel.setTile(null);
             break;
-        case VenisonObject.CANCELLED:
+        case AtlantiObject.CANCELLED:
             _whoLabel.setText("Cancelled.");
             _tileLabel.setTile(null);
             break;
@@ -107,20 +109,20 @@ public class TurnIndicatorView
 
     protected void updateTurnHolder ()
     {
-        if (_venobj.state == VenisonObject.IN_PLAY) {
-            _whoLabel.setText(_venobj.turnHolder);
+        if (_atlobj.state == AtlantiObject.IN_PLAY) {
+            _whoLabel.setText(_atlobj.turnHolder);
         }
     }
 
     protected void updateCurrentTile ()
     {
         // display the tile to be placed
-        _tileLabel.setTile(_venobj.currentTile);
+        _tileLabel.setTile(_atlobj.currentTile);
     }
 
     protected void updateRemainingTiles ()
     {
-        _countLabel.setText("Tiles remaining: " + (71-_venobj.tiles.size()));
+        _countLabel.setText("Tiles remaining: " + (71-_atlobj.tiles.size()));
     }
 
     /** The label displaying whose turn it is. */
@@ -133,5 +135,5 @@ public class TurnIndicatorView
     protected JLabel _countLabel;
 
     /** A reference to the game object. */
-    protected VenisonObject _venobj;
+    protected AtlantiObject _atlobj;
 }
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiCodes.java b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiCodes.java
index dc80a345..d4c733e8 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiCodes.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiCodes.java
@@ -1,24 +1,24 @@
 //
-// $Id: AtlantiCodes.java,v 1.5 2002/05/21 04:45:10 mdb Exp $
+// $Id: AtlantiCodes.java,v 1.6 2002/12/12 05:51:54 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti.data;
 
 /**
- * Constants used by the Venison game code.
+ * Constants used by the Atlanti game code.
  */
-public interface VenisonCodes
+public interface AtlantiCodes
 {
     /** The message bundle identifier for translation messages. */
-    public static final String VENISON_MESSAGE_BUNDLE = "venison";
+    public static final String ATLANTI_MESSAGE_BUNDLE = "atlanti";
 
     /** The number of piecens provided to each player. */
     public static final int PIECENS_PER_PLAYER = 7;
 
-    /** The name of the command posted by the {@link VenisonBoard} when
+    /** The name of the command posted by the {@link AtlantiBoard} when
      * the user places a tile into a valid position. */
     public static final String TILE_PLACED = "tile_placed";
 
-    /** The name of the command posted by the {@link VenisonBoard} when
+    /** The name of the command posted by the {@link AtlantiBoard} when
      * the user places a piecen onto an unclaimed feature. */
     public static final String PIECEN_PLACED = "piecen_placed";
 
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiConfig.java b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiConfig.java
index af1ee915..9db45c9b 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiConfig.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiConfig.java
@@ -1,31 +1,41 @@
 //
-// $Id: AtlantiConfig.java,v 1.3 2001/10/24 03:24:53 mdb Exp $
+// $Id: AtlantiConfig.java,v 1.4 2002/12/12 05:51:54 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti.data;
 
 import java.io.IOException;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
 
-import com.threerings.parlor.game.GameConfig;
+import com.threerings.io.ObjectInputStream;
+import com.threerings.io.ObjectOutputStream;
+
 import com.threerings.parlor.data.TableConfig;
+import com.threerings.parlor.game.GameConfig;
+
+import com.samskivert.atlanti.client.AtlantiConfigurator;
+import com.samskivert.atlanti.client.AtlantiController;
 
 /**
- * Describes the configuration parameters for a game of Venison.
+ * Describes the configuration parameters for the game.
  */
-public class VenisonConfig
-    extends GameConfig implements TableConfig
+public class AtlantiConfig extends GameConfig
+    implements TableConfig
 {
     // documentation inherited
     public Class getControllerClass ()
     {
-        return VenisonController.class;
+        return AtlantiController.class;
+    }
+
+    // documentation inherited from interface
+    public Class getConfiguratorClass ()
+    {
+        return AtlantiConfigurator.class;
     }
 
     // documentation inherited
     public String getManagerClassName ()
     {
-        return "com.threerings.venison.VenisonManager";
+        return "com.samskivert.atlanti.server.AtlantiManager";
     }
 
     // documentation inherited
@@ -53,18 +63,18 @@ public class VenisonConfig
     }
 
     // documentation inherited
-    public void writeTo (DataOutputStream out)
+    public void writeObject (ObjectOutputStream out)
         throws IOException
     {
-        super.writeTo(out);
+        out.defaultWriteObject();
         out.writeInt(_desiredPlayers);
     }
 
     // documentation inherited
-    public void readFrom (DataInputStream in)
-        throws IOException
+    public void readObject (ObjectInputStream in)
+        throws IOException, ClassNotFoundException
     {
-        super.readFrom(in);
+        in.defaultReadObject();
         _desiredPlayers = in.readInt();
     }
 
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.dobj b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.dobj
index e2f6e5d1..09189550 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.dobj
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.dobj
@@ -1,17 +1,17 @@
 //
-// $Id: AtlantiObject.dobj,v 1.1 2002/05/21 04:45:10 mdb Exp $
+// $Id: AtlantiObject.dobj,v 1.2 2002/12/12 05:51:54 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti.data;
 
-import com.samskivert.util.StringUtil;
 import com.threerings.presents.dobj.DSet;
+
 import com.threerings.parlor.game.GameObject;
 import com.threerings.parlor.turn.TurnGameObject;
 
 /**
- * The distributed object used to maintain state for the Venison game.
+ * The distributed object used to maintain state for the game.
  */
-public class VenisonObject extends GameObject
+public class AtlantiObject extends GameObject
     implements TurnGameObject
 {
     /** The username of the current turn holder. */
@@ -19,19 +19,25 @@ public class VenisonObject extends GameObject
 
     /** A set containing all of the tiles that are in play in this
      * game. */
-    public DSet tiles = new DSet(VenisonTile.class);
+    public DSet tiles = new DSet();
 
     /** The tile being placed by the current turn holder. This value is
      * only valid while it is someone's turn. */
-    public VenisonTile currentTile = VenisonTile.STARTING_TILE;
+    public AtlantiTile currentTile = AtlantiTile.STARTING_TILE;
 
     /** A set containing all of the piecens that are placed on the
      * board. */
-    public DSet piecens = new DSet(Piecen.class);
+    public DSet piecens = new DSet();
 
     /** The scores for each player. */
     public int[] scores;
 
+    // documentation inherited from interface
+    public String[] getPlayers ()
+    {
+        return players;
+    }
+
     // documentation inherited from interface
     public String getTurnHolderFieldName ()
     {
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.java b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.java
index 84550ef9..ad006a81 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.java
@@ -1,17 +1,17 @@
 //
-// $Id: AtlantiObject.java,v 1.8 2002/05/21 04:45:10 mdb Exp $
+// $Id: AtlantiObject.java,v 1.9 2002/12/12 05:51:54 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti.data;
 
-import com.samskivert.util.StringUtil;
 import com.threerings.presents.dobj.DSet;
+
 import com.threerings.parlor.game.GameObject;
 import com.threerings.parlor.turn.TurnGameObject;
 
 /**
- * The distributed object used to maintain state for the Venison game.
+ * The distributed object used to maintain state for the game.
  */
-public class VenisonObject extends GameObject
+public class AtlantiObject extends GameObject
     implements TurnGameObject
 {
     /** The field name of the turnHolder field. */
@@ -34,19 +34,25 @@ public class VenisonObject extends GameObject
 
     /** A set containing all of the tiles that are in play in this
      * game. */
-    public DSet tiles = new DSet(VenisonTile.class);
+    public DSet tiles = new DSet();
 
     /** The tile being placed by the current turn holder. This value is
      * only valid while it is someone's turn. */
-    public VenisonTile currentTile = VenisonTile.STARTING_TILE;
+    public AtlantiTile currentTile = AtlantiTile.STARTING_TILE;
 
     /** A set containing all of the piecens that are placed on the
      * board. */
-    public DSet piecens = new DSet(Piecen.class);
+    public DSet piecens = new DSet();
 
     /** The scores for each player. */
     public int[] scores;
 
+    // documentation inherited from interface
+    public String[] getPlayers ()
+    {
+        return players;
+    }
+
     // documentation inherited from interface
     public String getTurnHolderFieldName ()
     {
@@ -127,7 +133,7 @@ public class VenisonObject extends GameObject
      * clients) will apply the value change when they received the
      * attribute changed notification.
      */
-    public void setCurrentTile (VenisonTile currentTile)
+    public void setCurrentTile (AtlantiTile currentTile)
     {
         this.currentTile = currentTile;
         requestAttributeChange(CURRENT_TILE, currentTile);
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiTile.java b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiTile.java
index 274ac49c..8e97b4b5 100644
--- a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiTile.java
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiTile.java
@@ -1,7 +1,7 @@
 //
-// $Id: AtlantiTile.java,v 1.14 2002/05/21 04:45:10 mdb Exp $
+// $Id: AtlantiTile.java,v 1.15 2002/12/12 05:51:54 mdb Exp $
 
-package com.threerings.venison;
+package com.samskivert.atlanti.data;
 
 import java.awt.AlphaComposite;
 import java.awt.Color;
@@ -14,28 +14,38 @@ import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
 
 import java.io.IOException;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
 
 import java.util.List;
 import com.samskivert.util.IntTuple;
 import com.samskivert.util.StringUtil;
 
+import com.threerings.media.ImageManager;
+import com.threerings.media.tile.ImageProvider;
 import com.threerings.media.tile.Tile;
 import com.threerings.media.tile.TileManager;
 import com.threerings.media.tile.UniformTileSet;
 
+import com.threerings.io.ObjectInputStream;
 import com.threerings.presents.dobj.DSet;
 
+import com.samskivert.atlanti.Log;
+import com.samskivert.atlanti.util.FeatureUtil;
+import com.samskivert.atlanti.util.PiecenUtil;
+import com.samskivert.atlanti.util.TileUtil;
+
 /**
- * Represents a single tile in play on the Venison game board.
+ * Represents a single tile in play on the game board.
+ *
+ * 

Note: this should really be split into a pure data class + * and an associated visualization class in the + * altanti.client package. */ -public class VenisonTile +public class AtlantiTile implements DSet.Entry, TileCodes, Cloneable, Comparable { /** The starting tile. */ - public static final VenisonTile STARTING_TILE = - new VenisonTile(CITY_ONE_ROAD_STRAIGHT, false, NORTH, 0, 0); + public static final AtlantiTile STARTING_TILE = + new AtlantiTile(CITY_ONE_ROAD_STRAIGHT, false, NORTH, 0, 0); /** Activate this to render a piecen on every feature (useful for the * tile geometry test). */ @@ -58,19 +68,19 @@ public class VenisonTile * connects to this tile, it will be represented here by a non-zero * claim group in the array slot that corresponds to the claimed * feature. */ - public int[] claims; + public transient int[] claims; /** A reference to our static feature descriptions. */ - public Feature[] features; + public transient Feature[] features; /** A reference to the piecen on this tile or null if no piecen has * been placed on this tile. */ - public Piecen piecen; + public transient Piecen piecen; /** * Constructs a tile with all of the supplied tile information. */ - public VenisonTile (int type, boolean hasShield, int orientation, + public AtlantiTile (int type, boolean hasShield, int orientation, int x, int y) { this.type = type; @@ -87,7 +97,7 @@ public class VenisonTile * Constructs a tile with the type information set, but in the default * NORTH orientation and with no position. */ - public VenisonTile (int type, boolean hasShield) + public AtlantiTile (int type, boolean hasShield) { this(type, hasShield, NORTH, 0, 0); } @@ -95,7 +105,7 @@ public class VenisonTile /** * Constructs a blank tile, suitable for unserialization. */ - public VenisonTile () + public AtlantiTile () { // nothing doing } @@ -348,11 +358,11 @@ public class VenisonTile } /** - * Returns a copy of this Venison tile object. + * Returns a copy of this tile object. */ public Object clone () { - return new VenisonTile(type, hasShield, orientation, x, y); + return new AtlantiTile(type, hasShield, orientation, x, y); } /** @@ -365,8 +375,8 @@ public class VenisonTile if (other == null) { return -1; - } else if (other instanceof VenisonTile) { - VenisonTile tile = (VenisonTile)other; + } else if (other instanceof AtlantiTile) { + AtlantiTile tile = (AtlantiTile)other; return (tile.x == x) ? y - tile.y : x - tile.x; } else if (other instanceof IntTuple) { @@ -390,32 +400,20 @@ public class VenisonTile } // documentation inherited - public Object getKey () + public Comparable getKey () { // our key is our coordinates conflated into one integer return new Integer((x + 128) * 256 + y + 128); } - // documentation inherited - public void writeTo (DataOutputStream out) - throws IOException + /** + * After we've been unserialized we have to initialize some derived + * fields. + */ + public void readObject (ObjectInputStream in) + throws IOException, ClassNotFoundException { - out.writeInt(type); - out.writeBoolean(hasShield); - out.writeInt(orientation); - out.writeInt(x); - out.writeInt(y); - } - - // documentation inherited - public void readFrom (DataInputStream in) - throws IOException - { - type = in.readInt(); - hasShield = in.readBoolean(); - orientation = in.readInt(); - x = in.readInt(); - y = in.readInt(); + in.defaultReadObject(); initFeatures(); } @@ -454,8 +452,9 @@ public class VenisonTile * Someone needs to configure this so that we can display tiles on * screen. */ - public static void setTileManager (TileManager tmgr) + public static void setManagers (ImageManager imgr, TileManager tmgr) { + _imgr = imgr; _tmgr = tmgr; } @@ -466,12 +465,9 @@ public class VenisonTile { // load up the tile set if we haven't already if (_tset == null) { - _tset = new UniformTileSet(); - _tset.setTileCount(TILE_TYPES); - _tset.setWidth(TILE_WIDTH); - _tset.setHeight(TILE_HEIGHT); - _tset.setImagePath(TILES_IMG_PATH); - _tset.setImageProvider(_tmgr); + _tset = _tmgr.loadTileSet(TILES_IMG_PATH, TILE_TYPES, + TILE_WIDTH, TILE_HEIGHT); + _tset.setImageProvider(_imgprov); } // fetch the tile @@ -485,12 +481,9 @@ public class VenisonTile { // load up the tile set if we haven't already if (_stset == null) { - _stset = new UniformTileSet(); - _stset.setTileCount(1); - _stset.setWidth(SHIELD_SIZE); - _stset.setHeight(SHIELD_SIZE); - _stset.setImagePath(SHIELD_IMG_PATH); - _stset.setImageProvider(_tmgr); + _stset = _tmgr.loadTileSet(SHIELD_IMG_PATH, 1, + SHIELD_SIZE, SHIELD_SIZE); + _stset.setImageProvider(_imgprov); } // fetch the tile @@ -498,11 +491,25 @@ public class VenisonTile } /** The tile image that we use to render this tile. */ - protected Image _tileImage; + protected transient Image _tileImage; + + /** Our image manager. */ + protected static ImageManager _imgr; /** Our tile manager. */ protected static TileManager _tmgr; + /** Used to load tile images. The default image provider (the tile + * manager) optimizes the images for display on the screen which seems + * to fuck Java's ability to apply rotational transforms to the image + * prior to rendering. Yay! */ + protected static ImageProvider _imgprov = new ImageProvider() { + public Image loadImage (String path) + throws IOException { + return _imgr.loadImage(path); + } + }; + /** Our tile image tileset. */ protected static UniformTileSet _tset; diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/Feature.java b/projects/atlanti/src/java/com/samskivert/atlanti/data/Feature.java index 6d12f31c..541c5c01 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/data/Feature.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/Feature.java @@ -1,7 +1,7 @@ // -// $Id: Feature.java,v 1.5 2001/12/18 13:14:58 mdb Exp $ +// $Id: Feature.java,v 1.6 2002/12/12 05:51:54 mdb Exp $ -package com.threerings.venison; +package com.samskivert.atlanti.data; import java.awt.AlphaComposite; import java.awt.Color; @@ -17,6 +17,10 @@ import java.awt.geom.RoundRectangle2D; import com.samskivert.util.StringUtil; +import com.samskivert.atlanti.Log; +import com.samskivert.atlanti.util.FeatureUtil; +import com.samskivert.atlanti.util.TileUtil; + /** * Represents all of the necessary information for a particular feature of * a particular tile. @@ -24,6 +28,16 @@ import com.samskivert.util.StringUtil; public class Feature implements TileCodes { + /** Maps piecen color codes to colors. */ + public static Color[] PIECEN_COLOR_MAP = { + new Color(0x0246B7), // BLUE + new Color(0x028A12), // GREEN + new Color(0xF47A02), // ORANGE + new Color(0xC20292), // MAGENTA + new Color(0xB90202), // RED + new Color(0xFECA11), // YELLOW + }; + /** The type of this feature. */ public int type; @@ -355,16 +369,6 @@ public class Feature Color.yellow.darker(), // CLOISTER }; - /** Maps piecen color codes to colors. */ - protected static Color[] PIECEN_COLOR_MAP = { - new Color(0x0246B7), // BLUE - new Color(0x028A12), // GREEN - new Color(0xF47A02), // ORANGE - new Color(0xC20292), // MAGENTA - new Color(0xB90202), // RED - new Color(0xFECA11), // YELLOW - }; - /** For rendering piecens with alpha. */ protected static final Composite ALPHA_PLACING = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f); diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/Piecen.java b/projects/atlanti/src/java/com/samskivert/atlanti/data/Piecen.java index 90b8f016..66f4692d 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/data/Piecen.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/Piecen.java @@ -1,7 +1,7 @@ // -// $Id: Piecen.java,v 1.3 2002/05/21 04:45:09 mdb Exp $ +// $Id: Piecen.java,v 1.4 2002/12/12 05:51:54 mdb Exp $ -package com.threerings.venison; +package com.samskivert.atlanti.data; import java.io.IOException; import java.io.DataInputStream; @@ -75,7 +75,7 @@ public class Piecen } // documentation inherited - public Object getKey () + public Comparable getKey () { // our key is our coordinates conflated into one integer return new Integer((x + 128) * 256 + y + 128); @@ -108,8 +108,8 @@ public class Piecen if (other == null) { return false; - } else if (other instanceof VenisonTile) { - VenisonTile tile = (VenisonTile)other; + } else if (other instanceof AtlantiTile) { + AtlantiTile tile = (AtlantiTile)other; return (tile.x == x) ? (y == tile.y) : false; } else if (other instanceof Piecen) { diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/TileCodes.java b/projects/atlanti/src/java/com/samskivert/atlanti/data/TileCodes.java index 798eab54..c558a994 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/data/TileCodes.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/TileCodes.java @@ -1,11 +1,11 @@ // -// $Id: TileCodes.java,v 1.9 2001/12/18 11:58:53 mdb Exp $ +// $Id: TileCodes.java,v 1.10 2002/12/12 05:51:54 mdb Exp $ -package com.threerings.venison; +package com.samskivert.atlanti.data; /** * A repository for constants related to the tiles that are used in the - * game of Venison. + * game of Atlantissonne. */ public interface TileCodes { diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManager.java b/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManager.java index b1080566..050bb512 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManager.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManager.java @@ -1,7 +1,7 @@ // -// $Id: AtlantiManager.java,v 1.23 2002/05/21 04:45:10 mdb Exp $ +// $Id: AtlantiManager.java,v 1.24 2002/12/12 05:51:54 mdb Exp $ -package com.threerings.venison; +package com.samskivert.atlanti.server; import java.util.Arrays; import java.util.ArrayList; @@ -22,31 +22,40 @@ import com.threerings.presents.dobj.MessageEvent; import com.threerings.presents.dobj.MessageEvent; import com.threerings.crowd.chat.ChatProvider; +import com.threerings.crowd.chat.SpeakProvider; import com.threerings.crowd.data.PlaceObject; -import com.threerings.crowd.chat.ChatMessageHandler; -import com.threerings.crowd.chat.ChatService; import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.server.PlaceManager; import com.threerings.parlor.game.GameManager; import com.threerings.parlor.turn.TurnGameManager; +import com.samskivert.atlanti.Log; +import com.samskivert.atlanti.data.AtlantiCodes; +import com.samskivert.atlanti.data.AtlantiObject; +import com.samskivert.atlanti.data.AtlantiTile; +import com.samskivert.atlanti.data.Feature; +import com.samskivert.atlanti.data.Piecen; +import com.samskivert.atlanti.data.TileCodes; +import com.samskivert.atlanti.util.FeatureUtil; +import com.samskivert.atlanti.util.TileUtil; + /** - * The main coordinator of the Venison game on the server side. + * The main coordinator of the Atlantissonne game on the server side. */ -public class VenisonManager extends GameManager - implements TurnGameManager, VenisonCodes, SetListener +public class AtlantiManager extends GameManager + implements TurnGameManager, AtlantiCodes, SetListener { - public VenisonManager () + public AtlantiManager () { - addDelegate(_delegate = new VenisonManagerDelegate(this)); + addDelegate(_delegate = new AtlantiManagerDelegate(this)); } // documentation inherited protected Class getPlaceObjectClass () { - return VenisonObject.class; + return AtlantiObject.class; } public int getTilesInBox () @@ -60,8 +69,6 @@ public class VenisonManager extends GameManager super.didInit(); // register our message handlers - registerMessageHandler( - ChatService.SPEAK_REQUEST, new ChatMessageHandler()); registerMessageHandler(PLACE_TILE_REQUEST, new PlaceTileHandler()); registerMessageHandler( PLACE_PIECEN_REQUEST, new PlacePiecenHandler()); @@ -75,7 +82,7 @@ public class VenisonManager extends GameManager super.didStartup(); // grab our own casted game object reference - _venobj = (VenisonObject)_gameobj; + _atlobj = (AtlantiObject)_gameobj; } /** @@ -99,18 +106,18 @@ public class VenisonManager extends GameManager _tiles.clear(); // create a claim group vector - _claimGroupVector = new int[_players.length]; + _claimGroupVector = new int[getPlayerCount()]; // clear out the scores - _venobj.setScores(new int[_players.length]); + _atlobj.setScores(new int[getPlayerCount()]); // clear out the tile and piecen set - _venobj.setTiles(new DSet(VenisonTile.class)); - _venobj.setPiecens(new DSet(Piecen.class)); + _atlobj.setTiles(new DSet()); + _atlobj.setPiecens(new DSet()); // and add the starting tile - VenisonTile start = TileUtil.getStartingTile(); - _venobj.addToTiles(start); + AtlantiTile start = TileUtil.getStartingTile(); + _atlobj.addToTiles(start); _tiles.add(start); } @@ -119,8 +126,14 @@ public class VenisonManager extends GameManager { // let the players know what the next tile is that should be // played - VenisonTile tile = (VenisonTile)_tilesInBox.remove(0); - _venobj.setCurrentTile(tile); + AtlantiTile tile = (AtlantiTile)_tilesInBox.remove(0); + _atlobj.setCurrentTile(tile); + } + + // documentation inherited + public void turnDidStart () + { + // nothing doing } // documentation inherited @@ -142,9 +155,9 @@ public class VenisonManager extends GameManager // compute the final scores by iterating over each tile and // scoring its features Piecen[] piecens = getPiecens(); - Iterator iter = _venobj.tiles.entries(); + Iterator iter = _atlobj.tiles.entries(); while (iter.hasNext()) { - VenisonTile tile = (VenisonTile)iter.next(); + AtlantiTile tile = (AtlantiTile)iter.next(); scoreFeatures(tile, piecens, true); } @@ -152,7 +165,7 @@ public class VenisonManager extends GameManager scoreFarms(); // update the final scores - _venobj.setScores(_venobj.scores); + _atlobj.setScores(_atlobj.scores); } /** @@ -163,8 +176,8 @@ public class VenisonManager extends GameManager protected Piecen[] getPiecens () { // create a piecen array that we can manipulate while scoring - Piecen[] piecens = new Piecen[_venobj.piecens.size()]; - Iterator iter = _venobj.piecens.entries(); + Piecen[] piecens = new Piecen[_atlobj.piecens.size()]; + Iterator iter = _atlobj.piecens.entries(); for (int i = 0; iter.hasNext(); i++) { piecens[i] = (Piecen)iter.next(); } @@ -182,7 +195,7 @@ public class VenisonManager extends GameManager * we don't remove piecens from the board as we score them. */ protected void scoreFeatures ( - VenisonTile tile, Piecen[] piecens, boolean finalTally) + AtlantiTile tile, Piecen[] piecens, boolean finalTally) { // potentially score all features on the tile for (int i = 0; i < tile.features.length; i++) { @@ -222,27 +235,27 @@ public class VenisonManager extends GameManager StringBuffer names = new StringBuffer(); for (int p = 0; p < cgv.length; p++) { // adjust the score - _venobj.scores[p] += (score * cgv[p]); + _atlobj.scores[p] += (score * cgv[p]); // append the scorers name to the list if (cgv[p] > 0) { if (names.length() > 0) { names.append(", "); } - names.append(_players[p]); + names.append(getPlayerName(p)); } } String message = qual + " " + TileCodes.FEATURE_NAMES[f.type] + " scored " + score + " points for " + names + "."; - ChatProvider.sendSystemMessage( - _venobj.getOid(), VENISON_MESSAGE_BUNDLE, message); + SpeakProvider.sendSystemSpeak( + _atlobj, ATLANTI_MESSAGE_BUNDLE, message); - Log.info("New scores: " + StringUtil.toString(_venobj.scores)); + Log.info("New scores: " + StringUtil.toString(_atlobj.scores)); // broadcast the new scores if this isn't the final tally if (!finalTally) { - _venobj.setScores(_venobj.scores); + _atlobj.setScores(_atlobj.scores); } // and free up the scored piecens @@ -259,7 +272,7 @@ public class VenisonManager extends GameManager for (int dx = -1; dx < 2; dx++) { for (int dy = -1; dy < 2; dy++) { // find our neighbor and make sure they exist - VenisonTile neighbor = + AtlantiTile neighbor = TileUtil.findTile(_tiles, tile.x + dx, tile.y + dy); if (neighbor == null) { continue; @@ -306,18 +319,18 @@ public class VenisonManager extends GameManager // deliver a chat notification to tell the // players about the score - String message = _players[p.owner] + " scored " + + String message = getPlayerName(p.owner) + " scored " + score + " points for " + qual + " temple."; - ChatProvider.sendSystemMessage( - _venobj.getOid(), VENISON_MESSAGE_BUNDLE, message); + SpeakProvider.sendSystemSpeak( + _atlobj, ATLANTI_MESSAGE_BUNDLE, message); // add the score to the owning player - _venobj.scores[p.owner] += score; + _atlobj.scores[p.owner] += score; // only broadcast the updated scores if this isn't // the final tally if (!finalTally) { - _venobj.setScores(_venobj.scores); + _atlobj.setScores(_atlobj.scores); } // and clear out the piecen (only removing it from @@ -335,7 +348,7 @@ public class VenisonManager extends GameManager protected void scoreFarms () { HashIntMap cities = new HashIntMap(); - int[] cityScores = new int[_players.length]; + int[] cityScores = new int[getPlayerCount()]; // clear out the claims for incompleted cities and claim unclaimed // completed cities @@ -344,7 +357,7 @@ public class VenisonManager extends GameManager // do the big process-ola int tsize = _tiles.size(); for (int i = 0; i < tsize; i++) { - VenisonTile tile = (VenisonTile)_tiles.get(i); + AtlantiTile tile = (AtlantiTile)_tiles.get(i); // iterate over all of the city features in this tile for (int f = 0; f < tile.features.length; f++) { @@ -410,10 +423,10 @@ public class VenisonManager extends GameManager while (iter.hasNext()) { int cityClaim = ((Integer)iter.next()).intValue(); int[] farmClaims = (int[])cities.get(cityClaim); - int[] pcount = new int[_players.length]; + int[] pcount = new int[getPlayerCount()]; int max = 0; - Iterator piter = _venobj.piecens.entries(); + Iterator piter = _atlobj.piecens.entries(); while (piter.hasNext()) { Piecen p = (Piecen)piter.next(); // see if the piecen is on any of the farms @@ -442,7 +455,7 @@ public class VenisonManager extends GameManager for (int i = 0; i < pcount.length; i++) { if (pcount[i] == max) { Log.info("Scoring city for player [cgroup=" + cityClaim + - ", player=" + _players[i] + + ", player=" + getPlayerName(i) + ", pcount=" + pcount[i] + "]."); cityScores[i] += 4; } @@ -451,13 +464,13 @@ public class VenisonManager extends GameManager // now report the scoring and transfer the counts to the score // array - for (int i = 0; i < _players.length; i++) { + for (int i = 0; i < getPlayerCount(); i++) { if (cityScores[i] > 0) { - _venobj.scores[i] += cityScores[i]; - String message = _players[i] + " scores " + cityScores[i] + - " points for fisheries."; - ChatProvider.sendSystemMessage( - _venobj.getOid(), VENISON_MESSAGE_BUNDLE, message); + _atlobj.scores[i] += cityScores[i]; + String message = getPlayerName(i) + " scores " + + cityScores[i] + " points for fisheries."; + SpeakProvider.sendSystemSpeak( + _atlobj, ATLANTI_MESSAGE_BUNDLE, message); } } } @@ -524,7 +537,7 @@ public class VenisonManager extends GameManager // if this isn't the final tally, we also clear 'em from the board if (!finalTally) { - Iterator iter = _venobj.piecens.entries(); + Iterator iter = _atlobj.piecens.entries(); while (iter.hasNext()) { Piecen p = (Piecen)iter.next(); if (p.claimGroup == claimGroup) { @@ -550,14 +563,14 @@ public class VenisonManager extends GameManager Log.warning("Requested to remove piecen that is not " + "associated with any tile [piecen=" + piecen + "]."); } else { - VenisonTile tile = (VenisonTile)_tiles.get(tidx); + AtlantiTile tile = (AtlantiTile)_tiles.get(tidx); // and clear the piecen tile.clearPiecen(); } // also remove from the piecens dset if requested if (removeFromPiecens) { - _venobj.removeFromPiecens(piecen.getKey()); + _atlobj.removeFromPiecens(piecen.getKey()); } } @@ -569,11 +582,11 @@ public class VenisonManager extends GameManager // before scoring so that the players can see the piecen pop up on // their screen and then disappear with a scoring notice rather // than never show up at all; plus it simplifies our code - if (event.getName().equals(VenisonObject.PIECENS)) { + if (event.getName().equals(AtlantiObject.PIECENS)) { Piecen piecen = (Piecen)event.getEntry(); // make sure this is a valid placement - VenisonTile tile = (VenisonTile)_venobj.tiles.get(piecen.getKey()); + AtlantiTile tile = (AtlantiTile)_atlobj.tiles.get(piecen.getKey()); if (tile == null) { Log.warning("Can't find tile for piecen scoring " + piecen + "."); @@ -604,14 +617,14 @@ public class VenisonManager extends GameManager */ protected void handlePlaceTileRequest (MessageEvent event) { - VenisonTile tile = (VenisonTile)event.getArgs()[0]; + AtlantiTile tile = (AtlantiTile)event.getArgs()[0]; int pidx = _delegate.getTurnHolderIndex(); // make sure it's this player's turn if (_playerOids[pidx] != event.getSourceOid()) { Log.warning("Requested to place tile by non-turn holder " + "[event=" + event + - ", turnHolder=" + _venobj.turnHolder + "]."); + ", turnHolder=" + _atlobj.turnHolder + "]."); // make sure this is a valid placement } else if (TileUtil.isValidPlacement(_tiles, tile)) { @@ -623,7 +636,7 @@ public class VenisonManager extends GameManager TileUtil.inheritClaims(_tiles, tile); // add the tile to the tiles set - _venobj.addToTiles(tile); + _atlobj.addToTiles(tile); // placing a piece may have completed road or city // features. if it did, we score them now @@ -634,7 +647,7 @@ public class VenisonManager extends GameManager // if the player has no free piecens or if there are no // unclaimed features on this tile, we end their turn // straight away - int pcount = TileUtil.countPiecens(_venobj.piecens, pidx); + int pcount = TileUtil.countPiecens(_atlobj.piecens, pidx); if (pcount >= PIECENS_PER_PLAYER || !tile.hasUnclaimedFeature()) { _delegate.endTurn(); @@ -651,15 +664,15 @@ public class VenisonManager extends GameManager protected void handlePlacePiecenRequest (MessageEvent event) { Piecen piecen = (Piecen)event.getArgs()[0]; - VenisonTile tile = (VenisonTile)_venobj.tiles.get(piecen.getKey()); + AtlantiTile tile = (AtlantiTile)_atlobj.tiles.get(piecen.getKey()); int pidx = _delegate.getTurnHolderIndex(); - int pcount = TileUtil.countPiecens(_venobj.piecens, pidx); + int pcount = TileUtil.countPiecens(_atlobj.piecens, pidx); // make sure it's this player's turn if (_playerOids[pidx] != event.getSourceOid()) { Log.warning("Requested to place piecen by non-turn holder " + "[event=" + event + - ", turnHolder=" + _venobj.turnHolder + "]."); + ", turnHolder=" + _atlobj.turnHolder + "]."); // do some checking before we place the piecen } else if (pcount >= PIECENS_PER_PLAYER) { @@ -683,7 +696,7 @@ public class VenisonManager extends GameManager // and add the piecen to the game object. when we receive // the piecen added event, we'll score it and then end the // turn - _venobj.addToPiecens(piecen); + _atlobj.addToPiecens(piecen); } } @@ -697,7 +710,7 @@ public class VenisonManager extends GameManager if (_playerOids[pidx] != event.getSourceOid()) { Log.warning("Requested to place nothing by non-turn holder " + "[event=" + event + - ", turnHolder=" + _venobj.turnHolder + "]."); + ", turnHolder=" + _atlobj.turnHolder + "]."); } else { // player doesn't want to place anything, so we just end @@ -734,10 +747,10 @@ public class VenisonManager extends GameManager } /** Our turn game delegate. */ - protected VenisonManagerDelegate _delegate; + protected AtlantiManagerDelegate _delegate; - /** A casted reference to our Venison game object. */ - protected VenisonObject _venobj; + /** A casted reference to our Atlanti game object. */ + protected AtlantiObject _atlobj; /** The (shuffled) list of tiles remaining to be played in this * game. */ diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManagerDelegate.java b/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManagerDelegate.java index 57094c46..75c436c5 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManagerDelegate.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManagerDelegate.java @@ -1,23 +1,25 @@ // -// $Id: AtlantiManagerDelegate.java,v 1.1 2002/05/21 04:45:10 mdb Exp $ +// $Id: AtlantiManagerDelegate.java,v 1.2 2002/12/12 05:51:54 mdb Exp $ -package com.threerings.venison; +package com.samskivert.atlanti.server; import com.threerings.parlor.turn.TurnGameManagerDelegate; +import com.samskivert.atlanti.data.AtlantiCodes; + /** * Handles the turn-based gameplay. */ -public class VenisonManagerDelegate extends TurnGameManagerDelegate - implements VenisonCodes +public class AtlantiManagerDelegate extends TurnGameManagerDelegate + implements AtlantiCodes { /** * Constructs the delegate and prepares it for operation. */ - public VenisonManagerDelegate (VenisonManager vmgr) + public AtlantiManagerDelegate (AtlantiManager vmgr) { super(vmgr); - _vmgr = vmgr; + _amgr = vmgr; } /** @@ -26,7 +28,7 @@ public class VenisonManagerDelegate extends TurnGameManagerDelegate protected void setNextTurnHolder () { // if we have tiles left, we move to the next player as normal - if (_vmgr.getTilesInBox() > 0) { + if (_amgr.getTilesInBox() > 0) { super.setNextTurnHolder(); } else { // if we don't, we ensure that a new turn isn't started by @@ -36,5 +38,5 @@ public class VenisonManagerDelegate extends TurnGameManagerDelegate } /** The manager for whom we're delegating. */ - protected VenisonManager _vmgr; + protected AtlantiManager _amgr; } diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/util/FeatureUtil.java b/projects/atlanti/src/java/com/samskivert/atlanti/util/FeatureUtil.java index 9873af48..a29ea464 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/util/FeatureUtil.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/util/FeatureUtil.java @@ -1,10 +1,13 @@ // -// $Id: FeatureUtil.java,v 1.5 2001/12/18 11:58:53 mdb Exp $ +// $Id: FeatureUtil.java,v 1.6 2002/12/12 05:51:54 mdb Exp $ -package com.threerings.venison; +package com.samskivert.atlanti.util; import java.awt.geom.Point2D; +import com.samskivert.atlanti.data.Feature; +import com.samskivert.atlanti.data.TileCodes; + /** * Feature related constants and utility functions. */ diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/util/PiecenUtil.java b/projects/atlanti/src/java/com/samskivert/atlanti/util/PiecenUtil.java index 6b71f671..b9e95e28 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/util/PiecenUtil.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/util/PiecenUtil.java @@ -1,7 +1,7 @@ // -// $Id: PiecenUtil.java,v 1.2 2002/05/21 04:45:09 mdb Exp $ +// $Id: PiecenUtil.java,v 1.3 2002/12/12 05:51:54 mdb Exp $ -package com.threerings.venison; +package com.samskivert.atlanti.util; import java.awt.Image; diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/util/TileUtil.java b/projects/atlanti/src/java/com/samskivert/atlanti/util/TileUtil.java index 7f31f4ff..40969af8 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/util/TileUtil.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/util/TileUtil.java @@ -1,7 +1,7 @@ // -// $Id: TileUtil.java,v 1.16 2002/05/21 04:45:09 mdb Exp $ +// $Id: TileUtil.java,v 1.17 2002/12/12 05:51:55 mdb Exp $ -package com.threerings.venison; +package com.samskivert.atlanti.util; import java.util.ArrayList; import java.util.Collections; @@ -12,8 +12,14 @@ import com.samskivert.util.IntTuple; import com.threerings.presents.dobj.DSet; +import com.samskivert.atlanti.Log; +import com.samskivert.atlanti.data.AtlantiTile; +import com.samskivert.atlanti.data.Feature; +import com.samskivert.atlanti.data.Piecen; +import com.samskivert.atlanti.data.TileCodes; + /** - * Utility functions relating to the Venison tiles. + * Utility functions relating to the Atlantissonne tiles. */ public class TileUtil implements TileCodes { @@ -21,15 +27,15 @@ public class TileUtil implements TileCodes * Returns an instance of the starting tile (properly cloned so that * it can be messed with by the server). */ - public static VenisonTile getStartingTile () + public static AtlantiTile getStartingTile () { - return (VenisonTile)VenisonTile.STARTING_TILE.clone(); + return (AtlantiTile)AtlantiTile.STARTING_TILE.clone(); } /** - * Returns a list containing the standard tile set for the Venison - * game. The list is a clone, so it can be bent, folded and modified - * by the caller. + * Returns a list containing the standard tile set for the + * Atlantissonne game. The list is a clone, so it can be bent, folded + * and modified by the caller. */ public static List getStandardTileSet () { @@ -38,7 +44,7 @@ public class TileUtil implements TileCodes List tiles = new ArrayList(); int tsize = TILE_SET.size(); for (int i = 0; i < tsize; i++) { - tiles.add(((VenisonTile)TILE_SET.get(i)).clone()); + tiles.add(((AtlantiTile)TILE_SET.get(i)).clone()); } return tiles; } @@ -60,7 +66,7 @@ public class TileUtil implements TileCodes * up with the direction constants specified in {@link TileCodes}. */ public static boolean[] computeValidOrients ( - List tiles, VenisonTile target) + List tiles, AtlantiTile target) { // this contains a count of tiles that match up with the candidate // tile in each of its four orientations @@ -68,7 +74,7 @@ public class TileUtil implements TileCodes int tsize = tiles.size(); for (int i = 0; i < tsize; i++) { - VenisonTile tile = (VenisonTile)tiles.get(i); + AtlantiTile tile = (AtlantiTile)tiles.get(i); // figure out where this tile is in relation to the candidate int xdiff = tile.x - target.x; @@ -132,13 +138,13 @@ public class TileUtil implements TileCodes * @return true if the target tile is configured with a valid position * and orientation, false if it is not. */ - public static boolean isValidPlacement (List tiles, VenisonTile target) + public static boolean isValidPlacement (List tiles, AtlantiTile target) { boolean matchedAnEdge = false; int tsize = tiles.size(); for (int i = 0; i < tsize; i++) { - VenisonTile tile = (VenisonTile)tiles.get(i); + AtlantiTile tile = (AtlantiTile)tiles.get(i); // figure out where this tile is in relation to the candidate int xdiff = tile.x - target.x; @@ -203,7 +209,7 @@ public class TileUtil implements TileCodes * not include the tile whose features are being configured). * @param tile the tile whose features should be configured. */ - public static void inheritClaims (List tiles, VenisonTile tile) + public static void inheritClaims (List tiles, AtlantiTile tile) { List flist = new ArrayList(); @@ -263,7 +269,7 @@ public class TileUtil implements TileCodes * @param claimGroup the claim group value to set. */ public static void setClaimGroup ( - List tiles, VenisonTile tile, int featureIndex, int claimGroup) + List tiles, AtlantiTile tile, int featureIndex, int claimGroup) { // load up this feature group List flist = new ArrayList(); @@ -291,7 +297,7 @@ public class TileUtil implements TileCodes * score for a partial feature group. */ public static int computeFeatureScore ( - List tiles, VenisonTile tile, int featureIndex) + List tiles, AtlantiTile tile, int featureIndex) { Feature feature = tile.features[featureIndex]; @@ -316,7 +322,7 @@ public class TileUtil implements TileCodes // now iterate over the list, counting only unique tiles int score = 0; - VenisonTile lastTile = null; + AtlantiTile lastTile = null; int fsize = flist.size(); for (int i = 0; i < fsize; i++) { TileFeature feat = (TileFeature)flist.get(i); @@ -347,9 +353,9 @@ public class TileUtil implements TileCodes /** * A helper function for {@link - * #computeFeatureScore(List,VenisonTile,int)}. + * #computeFeatureScore(List,AtlantiTile,int)}. */ - protected static int computeCloisterScore (List tiles, VenisonTile tile) + protected static int computeCloisterScore (List tiles, AtlantiTile tile) { int score = 0; @@ -381,7 +387,7 @@ public class TileUtil implements TileCodes // iterate over the tiles, marking every city completed or not int tsize = tiles.size(); for (int i = 0; i < tsize; i++) { - VenisonTile tile = (VenisonTile)tiles.get(i); + AtlantiTile tile = (AtlantiTile)tiles.get(i); // iterate over each feature on this tile for (int f = 0; f < tile.features.length; f++) { @@ -448,7 +454,7 @@ public class TileUtil implements TileCodes * features), false if it is not. */ protected static boolean enumerateGroup ( - List tiles, VenisonTile tile, int featureIndex, List group) + List tiles, AtlantiTile tile, int featureIndex, List group) { // create a tilefeature for this feature TileFeature feat = new TileFeature(tile, featureIndex); @@ -477,7 +483,7 @@ public class TileUtil implements TileCodes } // look up our neighbor - VenisonTile neighbor = null; + AtlantiTile neighbor = null; int dir = FeatureUtil.ADJACENCY_MAP[c+1]; dir = (dir + tile.orientation) % 4; switch (dir) { @@ -530,11 +536,11 @@ public class TileUtil implements TileCodes * @return the tile with the requested coordinates or null if no tile * exists at those coordinates. */ - protected static VenisonTile findTile (List tiles, int x, int y) + public static AtlantiTile findTile (List tiles, int x, int y) { IntTuple coord = new IntTuple(x, y); int tidx = Collections.binarySearch(tiles, coord); - return (tidx >= 0) ? (VenisonTile)tiles.get(tidx) : null; + return (tidx >= 0) ? (AtlantiTile)tiles.get(tidx) : null; } /** @@ -551,7 +557,7 @@ public class TileUtil implements TileCodes { int count = 0; for (int i = 0; i < tiles.size(); i++) { - VenisonTile tile = (VenisonTile)tiles.get(i); + AtlantiTile tile = (AtlantiTile)tiles.get(i); if (tile.piecen != null && tile.piecen.owner == playerIndex) { count++; @@ -604,7 +610,7 @@ public class TileUtil implements TileCodes } /** Used to generate our standard tile set. */ - protected static void addTiles (int count, List list, VenisonTile tile) + protected static void addTiles (int count, List list, AtlantiTile tile) { for (int i = 0; i < count; i++) { list.add(tile); @@ -615,13 +621,13 @@ public class TileUtil implements TileCodes protected static final class TileFeature implements Comparable { /** The tile that contains the feature. */ - public VenisonTile tile; + public AtlantiTile tile; /** The index of the feature in the tile. */ public int featureIndex; /** Constructs a new tile feature. */ - public TileFeature (VenisonTile tile, int featureIndex) + public TileFeature (AtlantiTile tile, int featureIndex) { this.tile = tile; this.featureIndex = featureIndex; @@ -689,40 +695,40 @@ public class TileUtil implements TileCodes GRASS, GRASS, ROAD, ROAD, // CURVED_ROAD }; - /** The standard tile set for a game of Venison. */ + /** The standard tile set for a game of Atlantissonne. */ protected static ArrayList TILE_SET = new ArrayList(); // create our standard tile set static { - addTiles(1, TILE_SET, new VenisonTile(CITY_FOUR, true)); + addTiles(1, TILE_SET, new AtlantiTile(CITY_FOUR, true)); - addTiles(3, TILE_SET, new VenisonTile(CITY_THREE, false)); - addTiles(1, TILE_SET, new VenisonTile(CITY_THREE, true)); - addTiles(1, TILE_SET, new VenisonTile(CITY_THREE_ROAD, false)); - addTiles(2, TILE_SET, new VenisonTile(CITY_THREE_ROAD, true)); + addTiles(3, TILE_SET, new AtlantiTile(CITY_THREE, false)); + addTiles(1, TILE_SET, new AtlantiTile(CITY_THREE, true)); + addTiles(1, TILE_SET, new AtlantiTile(CITY_THREE_ROAD, false)); + addTiles(2, TILE_SET, new AtlantiTile(CITY_THREE_ROAD, true)); - addTiles(3, TILE_SET, new VenisonTile(CITY_TWO, false)); - addTiles(2, TILE_SET, new VenisonTile(CITY_TWO, true)); - addTiles(3, TILE_SET, new VenisonTile(CITY_TWO_ROAD, false)); - addTiles(2, TILE_SET, new VenisonTile(CITY_TWO_ROAD, true)); - addTiles(1, TILE_SET, new VenisonTile(CITY_TWO_ACROSS, false)); - addTiles(2, TILE_SET, new VenisonTile(CITY_TWO_ACROSS, true)); + addTiles(3, TILE_SET, new AtlantiTile(CITY_TWO, false)); + addTiles(2, TILE_SET, new AtlantiTile(CITY_TWO, true)); + addTiles(3, TILE_SET, new AtlantiTile(CITY_TWO_ROAD, false)); + addTiles(2, TILE_SET, new AtlantiTile(CITY_TWO_ROAD, true)); + addTiles(1, TILE_SET, new AtlantiTile(CITY_TWO_ACROSS, false)); + addTiles(2, TILE_SET, new AtlantiTile(CITY_TWO_ACROSS, true)); - addTiles(2, TILE_SET, new VenisonTile(TWO_CITY_TWO, false)); - addTiles(3, TILE_SET, new VenisonTile(TWO_CITY_TWO_ACROSS, false)); + addTiles(2, TILE_SET, new AtlantiTile(TWO_CITY_TWO, false)); + addTiles(3, TILE_SET, new AtlantiTile(TWO_CITY_TWO_ACROSS, false)); - addTiles(5, TILE_SET, new VenisonTile(CITY_ONE, false)); - addTiles(3, TILE_SET, new VenisonTile(CITY_ONE_ROAD_RIGHT, false)); - addTiles(3, TILE_SET, new VenisonTile(CITY_ONE_ROAD_LEFT, false)); - addTiles(3, TILE_SET, new VenisonTile(CITY_ONE_ROAD_TEE, false)); - addTiles(3, TILE_SET, new VenisonTile(CITY_ONE_ROAD_STRAIGHT, false)); + addTiles(5, TILE_SET, new AtlantiTile(CITY_ONE, false)); + addTiles(3, TILE_SET, new AtlantiTile(CITY_ONE_ROAD_RIGHT, false)); + addTiles(3, TILE_SET, new AtlantiTile(CITY_ONE_ROAD_LEFT, false)); + addTiles(3, TILE_SET, new AtlantiTile(CITY_ONE_ROAD_TEE, false)); + addTiles(3, TILE_SET, new AtlantiTile(CITY_ONE_ROAD_STRAIGHT, false)); - addTiles(4, TILE_SET, new VenisonTile(CLOISTER_PLAIN, false)); - addTiles(2, TILE_SET, new VenisonTile(CLOISTER_ROAD, false)); + addTiles(4, TILE_SET, new AtlantiTile(CLOISTER_PLAIN, false)); + addTiles(2, TILE_SET, new AtlantiTile(CLOISTER_ROAD, false)); - addTiles(1, TILE_SET, new VenisonTile(FOUR_WAY_ROAD, false)); - addTiles(4, TILE_SET, new VenisonTile(THREE_WAY_ROAD, false)); - addTiles(8, TILE_SET, new VenisonTile(STRAIGHT_ROAD, false)); - addTiles(9, TILE_SET, new VenisonTile(CURVED_ROAD, false)); + addTiles(1, TILE_SET, new AtlantiTile(FOUR_WAY_ROAD, false)); + addTiles(4, TILE_SET, new AtlantiTile(THREE_WAY_ROAD, false)); + addTiles(8, TILE_SET, new AtlantiTile(STRAIGHT_ROAD, false)); + addTiles(9, TILE_SET, new AtlantiTile(CURVED_ROAD, false)); } }