From 2ebed980b56319a2ca3c2916939fb6f382b1d16e Mon Sep 17 00:00:00 2001 From: mdb Date: Tue, 16 Oct 2001 17:12:32 +0000 Subject: [PATCH] Move features and claim array initialization into initFeatures() so that we can call it after unserialization as well as via the regular constructor. git-svn-id: https://samskivert.googlecode.com/svn/trunk@362 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../samskivert/atlanti/data/AtlantiTile.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) 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 341484ad..6668db85 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiTile.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiTile.java @@ -1,5 +1,5 @@ // -// $Id: AtlantiTile.java,v 1.6 2001/10/16 09:31:46 mdb Exp $ +// $Id: AtlantiTile.java,v 1.7 2001/10/16 17:12:32 mdb Exp $ package com.threerings.venison; @@ -68,11 +68,8 @@ public class VenisonTile this.x = x; this.y = y; - // grab a reference to our feature information - features = TileUtil.TILE_FEATURES[type-1]; - - // create our claims array - claims = new int[features.length/2]; + // initialize our feature info + initFeatures(); } /** @@ -251,6 +248,26 @@ public class VenisonTile orientation = in.readInt(); x = in.readInt(); y = in.readInt(); + initFeatures(); + } + + /** + * Initializes this tile's feature management data structures. + */ + protected void initFeatures () + { + if (type > 0) { + // grab a reference to our feature information + features = TileUtil.TILE_FEATURES[type-1]; + + // create our claims array + claims = new int[features.length/2]; + + } else { + Log.warning("Requested to init features without valid type " + + this + "."); + Thread.dumpStack(); + } } /**