A healthy swig of google-collections
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@839 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.micasa.lobby;
|
package com.threerings.micasa.lobby;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -39,6 +38,8 @@ import javax.swing.JComboBox;
|
|||||||
import javax.swing.JList;
|
import javax.swing.JList;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
|
|
||||||
import com.threerings.micasa.util.MiCasaContext;
|
import com.threerings.micasa.util.MiCasaContext;
|
||||||
@@ -119,8 +120,8 @@ public class LobbySelector extends JPanel
|
|||||||
public void gotCategories (String[] categories)
|
public void gotCategories (String[] categories)
|
||||||
{
|
{
|
||||||
// append these to our "unselected" item
|
// append these to our "unselected" item
|
||||||
for (int i = 0; i < categories.length; i++) {
|
for (String categorie : categories) {
|
||||||
_combo.addItem(categories[i]);
|
_combo.addItem(categorie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +223,7 @@ public class LobbySelector extends JPanel
|
|||||||
protected JComboBox _combo;
|
protected JComboBox _combo;
|
||||||
protected JList _loblist;
|
protected JList _loblist;
|
||||||
|
|
||||||
protected Map<String, DefaultListModel> _catlists = new HashMap<String, DefaultListModel>();
|
protected Map<String, DefaultListModel> _catlists = Maps.newHashMap();
|
||||||
protected String _pendingCategory;
|
protected String _pendingCategory;
|
||||||
|
|
||||||
protected static final String CAT_FIRST_ITEM = "<categories...>";
|
protected static final String CAT_FIRST_ITEM = "<categories...>";
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
package com.threerings.micasa.simulator.server;
|
package com.threerings.micasa.simulator.server;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ public class SimulatorManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The simulant body objects. */
|
/** The simulant body objects. */
|
||||||
protected List<ClientObject> _sims = new ArrayList<ClientObject>();
|
protected List<ClientObject> _sims = Lists.newArrayList();
|
||||||
|
|
||||||
/** The game object for the game being created. */
|
/** The game object for the game being created. */
|
||||||
protected GameObject _gobj;
|
protected GameObject _gobj;
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import java.awt.event.MouseEvent;
|
|||||||
|
|
||||||
import javax.swing.event.MouseInputAdapter;
|
import javax.swing.event.MouseInputAdapter;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
import com.samskivert.util.Predicate;
|
import com.samskivert.util.Predicate;
|
||||||
import com.samskivert.util.QuickSort;
|
import com.samskivert.util.QuickSort;
|
||||||
@@ -259,8 +261,8 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
public void clearHandSelection ()
|
public void clearHandSelection ()
|
||||||
{
|
{
|
||||||
CardSprite[] sprites = getSelectedHandSprites();
|
CardSprite[] sprites = getSelectedHandSprites();
|
||||||
for (int i = 0; i < sprites.length; i++) {
|
for (CardSprite sprite : sprites) {
|
||||||
deselectHandSprite(sprites[i]);
|
deselectHandSprite(sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,11 +396,11 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
{
|
{
|
||||||
// fly each sprite over, removing it from the hand immediately and from the board when it
|
// fly each sprite over, removing it from the hand immediately and from the board when it
|
||||||
// finishes its path
|
// finishes its path
|
||||||
for (int i = 0; i < cards.length; i++) {
|
for (CardSprite card : cards) {
|
||||||
removeFromHand(cards[i]);
|
removeFromHand(card);
|
||||||
LinePath flight = new LinePath(dest, flightDuration);
|
LinePath flight = new LinePath(dest, flightDuration);
|
||||||
cards[i].addSpriteObserver(_pathEndRemover);
|
card.addSpriteObserver(_pathEndRemover);
|
||||||
cards[i].moveAndFadeOut(flight, flightDuration, fadePortion);
|
card.moveAndFadeOut(flight, flightDuration, fadePortion);
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust the hand to cover the hole
|
// adjust the hand to cover the hole
|
||||||
@@ -433,21 +435,21 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
|
|
||||||
// then set the layers and fly the cards in
|
// then set the layers and fly the cards in
|
||||||
int size = _handSprites.size();
|
int size = _handSprites.size();
|
||||||
for (int i = 0; i < sprites.length; i++) {
|
for (CardSprite sprite : sprites) {
|
||||||
int idx = _handSprites.indexOf(sprites[i]);
|
int idx = _handSprites.indexOf(sprite);
|
||||||
sprites[i].setLocation(src.x, src.y);
|
sprite.setLocation(src.x, src.y);
|
||||||
sprites[i].setRenderOrder(idx);
|
sprite.setRenderOrder(idx);
|
||||||
sprites[i].addSpriteObserver(_handSpriteObserver);
|
sprite.addSpriteObserver(_handSpriteObserver);
|
||||||
addSprite(sprites[i]);
|
addSprite(sprite);
|
||||||
|
|
||||||
// create a path sequence containing flight, pause, and drop
|
// create a path sequence containing flight, pause, and drop
|
||||||
ArrayList<Path> paths = new ArrayList<Path>();
|
ArrayList<Path> paths = Lists.newArrayList();
|
||||||
Point hp2 = new Point(getHandX(size, idx), _handLocation.y),
|
Point hp2 = new Point(getHandX(size, idx), _handLocation.y),
|
||||||
hp1 = new Point(hp2.x, hp2.y - _selectedCardOffset);
|
hp1 = new Point(hp2.x, hp2.y - _selectedCardOffset);
|
||||||
paths.add(new LinePath(hp1, flightDuration));
|
paths.add(new LinePath(hp1, flightDuration));
|
||||||
paths.add(new LinePath(hp1, pauseDuration));
|
paths.add(new LinePath(hp1, pauseDuration));
|
||||||
paths.add(new LinePath(hp2, dropDuration));
|
paths.add(new LinePath(hp2, dropDuration));
|
||||||
sprites[i].moveAndFadeIn(new PathSequence(paths), flightDuration +
|
sprite.moveAndFadeIn(new PathSequence(paths), flightDuration +
|
||||||
pauseDuration + dropDuration, fadePortion);
|
pauseDuration + dropDuration, fadePortion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -587,11 +589,11 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
public void flyFromBoard (CardSprite[] cards, Point dest, long flightDuration,
|
public void flyFromBoard (CardSprite[] cards, Point dest, long flightDuration,
|
||||||
float fadePortion)
|
float fadePortion)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < cards.length; i++) {
|
for (CardSprite card : cards) {
|
||||||
LinePath flight = new LinePath(dest, flightDuration);
|
LinePath flight = new LinePath(dest, flightDuration);
|
||||||
cards[i].addSpriteObserver(_pathEndRemover);
|
card.addSpriteObserver(_pathEndRemover);
|
||||||
cards[i].moveAndFadeOut(flight, flightDuration, fadePortion);
|
card.moveAndFadeOut(flight, flightDuration, fadePortion);
|
||||||
_boardSprites.remove(cards[i]);
|
_boardSprites.remove(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,13 +610,13 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
public void flyFromBoard (CardSprite[] cards, Point dest1, Point dest2, long flightDuration,
|
public void flyFromBoard (CardSprite[] cards, Point dest1, Point dest2, long flightDuration,
|
||||||
float fadePortion)
|
float fadePortion)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < cards.length; i++) {
|
for (CardSprite card : cards) {
|
||||||
PathSequence flight = new PathSequence(
|
PathSequence flight = new PathSequence(
|
||||||
new LinePath(dest1, flightDuration/2),
|
new LinePath(dest1, flightDuration/2),
|
||||||
new LinePath(dest1, dest2, flightDuration/2));
|
new LinePath(dest1, dest2, flightDuration/2));
|
||||||
cards[i].addSpriteObserver(_pathEndRemover);
|
card.addSpriteObserver(_pathEndRemover);
|
||||||
cards[i].moveAndFadeOut(flight, flightDuration, fadePortion);
|
card.moveAndFadeOut(flight, flightDuration, fadePortion);
|
||||||
_boardSprites.remove(cards[i]);
|
_boardSprites.remove(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1072,11 +1074,10 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
protected CardSprite _activeCardSprite;
|
protected CardSprite _activeCardSprite;
|
||||||
|
|
||||||
/** The sprites for cards within the hand. */
|
/** The sprites for cards within the hand. */
|
||||||
protected ArrayList<CardSprite> _handSprites = new ArrayList<CardSprite>();
|
protected ArrayList<CardSprite> _handSprites = Lists.newArrayList();
|
||||||
|
|
||||||
/** The sprites for cards within the hand that have been selected. */
|
/** The sprites for cards within the hand that have been selected. */
|
||||||
protected ArrayList<CardSprite> _selectedHandSprites =
|
protected ArrayList<CardSprite> _selectedHandSprites = Lists.newArrayList();
|
||||||
new ArrayList<CardSprite>();
|
|
||||||
|
|
||||||
/** The current selection mode for the hand. */
|
/** The current selection mode for the hand. */
|
||||||
protected int _handSelectionMode;
|
protected int _handSelectionMode;
|
||||||
@@ -1103,7 +1104,7 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
protected int _selectedCardOffset;
|
protected int _selectedCardOffset;
|
||||||
|
|
||||||
/** The sprites for cards on the board. */
|
/** The sprites for cards on the board. */
|
||||||
protected ArrayList<CardSprite> _boardSprites = new ArrayList<CardSprite>();
|
protected ArrayList<CardSprite> _boardSprites = Lists.newArrayList();
|
||||||
|
|
||||||
/** The hand sprite observer instance. */
|
/** The hand sprite observer instance. */
|
||||||
protected HandSpriteObserver _handSpriteObserver = new HandSpriteObserver();
|
protected HandSpriteObserver _handSpriteObserver = new HandSpriteObserver();
|
||||||
|
|||||||
@@ -21,10 +21,11 @@
|
|||||||
|
|
||||||
package com.threerings.parlor.card.trick.server;
|
package com.threerings.parlor.card.trick.server;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.ArrayUtil;
|
import com.samskivert.util.ArrayUtil;
|
||||||
import com.samskivert.util.Interval;
|
import com.samskivert.util.Interval;
|
||||||
import com.samskivert.util.RandomUtil;
|
import com.samskivert.util.RandomUtil;
|
||||||
@@ -451,7 +452,7 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
|||||||
*/
|
*/
|
||||||
protected Card pickRandomPlayableCard (Hand hand)
|
protected Card pickRandomPlayableCard (Hand hand)
|
||||||
{
|
{
|
||||||
List<Card> playableCards = new ArrayList<Card>();
|
List<Card> playableCards = Lists.newArrayList();
|
||||||
for (int i = 0; i < hand.size(); i++) {
|
for (int i = 0; i < hand.size(); i++) {
|
||||||
Card card = hand.get(i);
|
Card card = hand.get(i);
|
||||||
if (_trickCardGame.isCardPlayable(hand, card)) {
|
if (_trickCardGame.isCardPlayable(hand, card)) {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.ArrayIntSet;
|
import com.samskivert.util.ArrayIntSet;
|
||||||
import com.samskivert.util.ListUtil;
|
import com.samskivert.util.ListUtil;
|
||||||
@@ -129,8 +130,8 @@ public class Table
|
|||||||
@ActionScript(omit=true)
|
@ActionScript(omit=true)
|
||||||
public boolean isEmpty ()
|
public boolean isEmpty ()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < bodyOids.length; i++) {
|
for (int bodyOid : bodyOids) {
|
||||||
if (bodyOids[i] != 0) {
|
if (bodyOid != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,8 +145,8 @@ public class Table
|
|||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (players != null) {
|
if (players != null) {
|
||||||
for (int ii = 0; ii < players.length; ii++) {
|
for (Name player : players) {
|
||||||
if (players[ii] != null) {
|
if (player != null) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,7 +271,7 @@ public class Table
|
|||||||
public void addBannedUser (Name player)
|
public void addBannedUser (Name player)
|
||||||
{
|
{
|
||||||
if (_bannedUsers == null) {
|
if (_bannedUsers == null) {
|
||||||
_bannedUsers = new HashSet<Name>();
|
_bannedUsers = Sets.newHashSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
_bannedUsers.add(player);
|
_bannedUsers.add(player);
|
||||||
@@ -373,10 +374,10 @@ public class Table
|
|||||||
} else {
|
} else {
|
||||||
// for a team game, make sure each team has the minimum players
|
// for a team game, make sure each team has the minimum players
|
||||||
int[][] teams = tconfig.teamMemberIndices;
|
int[][] teams = tconfig.teamMemberIndices;
|
||||||
for (int ii=0; ii < teams.length; ii++) {
|
for (int[] team : teams) {
|
||||||
int teamCount = 0;
|
int teamCount = 0;
|
||||||
for (int jj=0; jj < teams[ii].length; jj++) {
|
for (int jj=0; jj < team.length; jj++) {
|
||||||
if (players[teams[ii][jj]] != null) {
|
if (players[team[jj]] != null) {
|
||||||
teamCount++;
|
teamCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,10 @@
|
|||||||
|
|
||||||
package com.threerings.parlor.game.data;
|
package com.threerings.parlor.game.data;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import com.threerings.crowd.data.PlaceConfig;
|
import com.threerings.crowd.data.PlaceConfig;
|
||||||
@@ -121,7 +122,7 @@ public abstract class GameConfig extends PlaceConfig
|
|||||||
*/
|
*/
|
||||||
public List<String> getDescription ()
|
public List<String> getDescription ()
|
||||||
{
|
{
|
||||||
return new ArrayList<String>(); // nothing by default
|
return Lists.newArrayList(); // nothing by default
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class RatingRepository extends DepotRepository
|
|||||||
*/
|
*/
|
||||||
public List<RatingRecord> getRatings (int playerId, long since, int count)
|
public List<RatingRecord> getRatings (int playerId, long since, int count)
|
||||||
{
|
{
|
||||||
ArrayList<QueryClause> clauses = new ArrayList<QueryClause>();
|
ArrayList<QueryClause> clauses = Lists.newArrayList();
|
||||||
if (since > 0L) {
|
if (since > 0L) {
|
||||||
Timestamp when = new Timestamp(System.currentTimeMillis() - since);
|
Timestamp when = new Timestamp(System.currentTimeMillis() - since);
|
||||||
clauses.add(new Where(new And(new Equals(RatingRecord.PLAYER_ID, playerId),
|
clauses.add(new Where(new And(new Equals(RatingRecord.PLAYER_ID, playerId),
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
@@ -146,7 +147,7 @@ public class TourneyRepository extends JORARepository
|
|||||||
throws PersistenceException
|
throws PersistenceException
|
||||||
{
|
{
|
||||||
ArrayList<TourneyRecord> recordList = loadAll(_ttable, "");
|
ArrayList<TourneyRecord> recordList = loadAll(_ttable, "");
|
||||||
ArrayList<TourneyConfig> configList = new ArrayList<TourneyConfig>(recordList.size());
|
ArrayList<TourneyConfig> configList = Lists.newArrayListWithCapacity(recordList.size());
|
||||||
for (TourneyRecord record : recordList) {
|
for (TourneyRecord record : recordList) {
|
||||||
configList.add(record.getTourneyConfig());
|
configList.add(record.getTourneyConfig());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ import javax.swing.Icon;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.swing.util.SwingUtil;
|
import com.samskivert.swing.util.SwingUtil;
|
||||||
|
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
@@ -213,7 +215,7 @@ public class TurnDisplay extends JPanel
|
|||||||
protected TurnGameObject _turnObj;
|
protected TurnGameObject _turnObj;
|
||||||
|
|
||||||
/** A mapping of the labels currently associated with each player. */
|
/** A mapping of the labels currently associated with each player. */
|
||||||
protected HashMap<Name,JLabel> _labels = new HashMap<Name,JLabel>();
|
protected HashMap<Name,JLabel> _labels = Maps.newHashMap();
|
||||||
|
|
||||||
/** The game-specified player icons. */
|
/** The game-specified player icons. */
|
||||||
protected Icon[] _playerIcons;
|
protected Icon[] _playerIcons;
|
||||||
|
|||||||
@@ -21,11 +21,12 @@
|
|||||||
|
|
||||||
package com.threerings.parlor.util;
|
package com.threerings.parlor.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.CollectionUtil;
|
import com.samskivert.util.CollectionUtil;
|
||||||
import com.samskivert.util.Interval;
|
import com.samskivert.util.Interval;
|
||||||
import com.samskivert.util.RandomUtil;
|
import com.samskivert.util.RandomUtil;
|
||||||
@@ -118,10 +119,10 @@ public class RobotPlayer extends Interval
|
|||||||
protected long _robotDelay = DEFAULT_ROBOT_DELAY;
|
protected long _robotDelay = DEFAULT_ROBOT_DELAY;
|
||||||
|
|
||||||
/** The list of available key press action commands. */
|
/** The list of available key press action commands. */
|
||||||
protected List<String> _press = new ArrayList<String>();
|
protected List<String> _press = Lists.newArrayList();
|
||||||
|
|
||||||
/** The list of available key release action commands. */
|
/** The list of available key release action commands. */
|
||||||
protected List<String> _release = new ArrayList<String>();
|
protected List<String> _release = Lists.newArrayList();
|
||||||
|
|
||||||
/** The key translator that describes available keys and commands. */
|
/** The key translator that describes available keys and commands. */
|
||||||
protected KeyTranslator _xlate;
|
protected KeyTranslator _xlate;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.puzzle.client;
|
package com.threerings.puzzle.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
@@ -31,6 +30,8 @@ import java.awt.Font;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.samskivert.swing.Label;
|
import com.samskivert.swing.Label;
|
||||||
@@ -375,10 +376,10 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel
|
|||||||
protected Rectangle _bounds;
|
protected Rectangle _bounds;
|
||||||
|
|
||||||
/** The action animations on the board. */
|
/** The action animations on the board. */
|
||||||
protected List<Animation> _actionAnims = new ArrayList<Animation>();
|
protected List<Animation> _actionAnims = Lists.newArrayList();
|
||||||
|
|
||||||
/** The action sprites on the board. */
|
/** The action sprites on the board. */
|
||||||
protected List<Sprite> _actionSprites = new ArrayList<Sprite>();
|
protected List<Sprite> _actionSprites = Lists.newArrayList();
|
||||||
|
|
||||||
/** Prevents certain animations from overlapping others. */
|
/** Prevents certain animations from overlapping others. */
|
||||||
protected AnimationArranger _avoidArranger;
|
protected AnimationArranger _avoidArranger;
|
||||||
|
|||||||
@@ -21,10 +21,11 @@
|
|||||||
|
|
||||||
package com.threerings.stage.client;
|
package com.threerings.stage.client;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.threerings.media.image.ColorPository;
|
import com.threerings.media.image.ColorPository;
|
||||||
import com.threerings.media.image.Colorization;
|
import com.threerings.media.image.Colorization;
|
||||||
import com.threerings.media.tile.TileSet;
|
import com.threerings.media.tile.TileSet;
|
||||||
@@ -145,5 +146,5 @@ public class SceneColorizer implements TileSet.Colorizer
|
|||||||
protected StageScene _scene;
|
protected StageScene _scene;
|
||||||
|
|
||||||
/** Contains our colorization class information. */
|
/** Contains our colorization class information. */
|
||||||
protected Map<String, int[]> _cids = new HashMap<String, int[]>();
|
protected Map<String, int[]> _cids = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ package com.threerings.stage.data;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.threerings.crowd.data.PlaceConfig;
|
import com.threerings.crowd.data.PlaceConfig;
|
||||||
|
|
||||||
import com.threerings.miso.data.ObjectInfo;
|
import com.threerings.miso.data.ObjectInfo;
|
||||||
@@ -223,5 +225,5 @@ public class StageScene extends SceneImpl
|
|||||||
protected SpotSceneImpl _sdelegate;
|
protected SpotSceneImpl _sdelegate;
|
||||||
|
|
||||||
/** A list of all interesting scene objects. */
|
/** A list of all interesting scene objects. */
|
||||||
protected ArrayList<ObjectInfo> _objects = new ArrayList<ObjectInfo>();
|
protected ArrayList<ObjectInfo> _objects = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ import java.util.List;
|
|||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
@@ -819,14 +822,14 @@ public class StageSceneManager extends SpotSceneManager
|
|||||||
|
|
||||||
/** Rectangles describing the footprints (in tile coordinates) of all
|
/** Rectangles describing the footprints (in tile coordinates) of all
|
||||||
* of our scene objects. */
|
* of our scene objects. */
|
||||||
protected ArrayList<Rectangle> _footprints = new ArrayList<Rectangle>();
|
protected ArrayList<Rectangle> _footprints = Lists.newArrayList();
|
||||||
|
|
||||||
/** Rectangles containing a "footprint" for the users that aren't in
|
/** Rectangles containing a "footprint" for the users that aren't in
|
||||||
* any clusters. */
|
* any clusters. */
|
||||||
protected HashIntMap<Rectangle> _loners = new HashIntMap<Rectangle>();
|
protected HashIntMap<Rectangle> _loners = new HashIntMap<Rectangle>();
|
||||||
|
|
||||||
/** Contains the (tile) coordinates of all of our portals. */
|
/** Contains the (tile) coordinates of all of our portals. */
|
||||||
protected HashSet<Point> _plocs = new HashSet<Point>();
|
protected HashSet<Point> _plocs = Sets.newHashSet();
|
||||||
|
|
||||||
/** The dimensions of a cluster with the specified number of
|
/** The dimensions of a cluster with the specified number of
|
||||||
* occupants. */
|
* occupants. */
|
||||||
|
|||||||
@@ -1167,7 +1167,7 @@ public class EditorScenePanel extends StageScenePanel
|
|||||||
protected SceneObject _pscobj;
|
protected SceneObject _pscobj;
|
||||||
|
|
||||||
/** A list of things that will do some extra painting for us. */
|
/** A list of things that will do some extra painting for us. */
|
||||||
protected ArrayList<ExtrasPainter> _extras = new ArrayList<ExtrasPainter>();
|
protected ArrayList<ExtrasPainter> _extras = Lists.newArrayList();
|
||||||
|
|
||||||
/** The dialog providing portal edit functionality. */
|
/** The dialog providing portal edit functionality. */
|
||||||
protected PortalDialog _dialogPortal;
|
protected PortalDialog _dialogPortal;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ import javax.swing.JTextField;
|
|||||||
import javax.swing.event.PopupMenuEvent;
|
import javax.swing.event.PopupMenuEvent;
|
||||||
import javax.swing.event.PopupMenuListener;
|
import javax.swing.event.PopupMenuListener;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.Collections;
|
import com.samskivert.util.Collections;
|
||||||
import com.samskivert.util.ComparableArrayList;
|
import com.samskivert.util.ComparableArrayList;
|
||||||
|
|
||||||
@@ -45,6 +47,7 @@ import com.samskivert.swing.GroupLayout;
|
|||||||
import com.samskivert.swing.HGroupLayout;
|
import com.samskivert.swing.HGroupLayout;
|
||||||
|
|
||||||
import com.threerings.media.image.ColorPository;
|
import com.threerings.media.image.ColorPository;
|
||||||
|
import com.threerings.media.image.ColorPository.ColorRecord;
|
||||||
import com.threerings.media.tile.NoSuchTileSetException;
|
import com.threerings.media.tile.NoSuchTileSetException;
|
||||||
import com.threerings.media.tile.RecolorableTileSet;
|
import com.threerings.media.tile.RecolorableTileSet;
|
||||||
import com.threerings.media.tile.TileManager;
|
import com.threerings.media.tile.TileManager;
|
||||||
@@ -170,7 +173,7 @@ public class SceneInfoPanel extends JPanel
|
|||||||
{
|
{
|
||||||
// add all possible colorization names to the list
|
// add all possible colorization names to the list
|
||||||
final TileManager tilemgr = _ctx.getTileManager();
|
final TileManager tilemgr = _ctx.getTileManager();
|
||||||
final HashSet<String> set = new HashSet<String>();
|
final HashSet<String> set = Sets.newHashSet();
|
||||||
StageMisoSceneModel msmodel = StageMisoSceneModel.getSceneModel(
|
StageMisoSceneModel msmodel = StageMisoSceneModel.getSceneModel(
|
||||||
_scene.getSceneModel());
|
_scene.getSceneModel());
|
||||||
msmodel.visitObjects(new ObjectVisitor() {
|
msmodel.visitObjects(new ObjectVisitor() {
|
||||||
@@ -189,8 +192,8 @@ public class SceneInfoPanel extends JPanel
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (zations != null) {
|
if (zations != null) {
|
||||||
for (int ii=0; ii < zations.length; ii++) {
|
for (String zation : zations) {
|
||||||
set.add(zations[ii]);
|
set.add(zation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,10 +237,10 @@ public class SceneInfoPanel extends JPanel
|
|||||||
|
|
||||||
ColorPository.ColorRecord[] colors = cpos.enumerateColors(cclass);
|
ColorPository.ColorRecord[] colors = cpos.enumerateColors(cclass);
|
||||||
ComparableArrayList<String> list = new ComparableArrayList<String>();
|
ComparableArrayList<String> list = new ComparableArrayList<String>();
|
||||||
for (int ii=0; ii < colors.length; ii++) {
|
for (ColorRecord color : colors) {
|
||||||
list.insertSorted(colors[ii].name);
|
list.insertSorted(color.name);
|
||||||
if (colors[ii].colorId == pick) {
|
if (color.colorId == pick) {
|
||||||
choice = colors[ii].name;
|
choice = color.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,9 +271,9 @@ public class SceneInfoPanel extends JPanel
|
|||||||
Object selected = _colorIds.getSelectedItem();
|
Object selected = _colorIds.getSelectedItem();
|
||||||
int pick = -1;
|
int pick = -1;
|
||||||
|
|
||||||
for (int ii=0; ii < colors.length; ii++) {
|
for (ColorRecord color : colors) {
|
||||||
if (colors[ii].name.equals(selected)) {
|
if (color.name.equals(selected)) {
|
||||||
pick = colors[ii].colorId;
|
pick = color.colorId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.stage.tools.editor;
|
package com.threerings.stage.tools.editor;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -34,6 +33,8 @@ import java.awt.image.BufferedImage;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
import com.threerings.media.tile.ImageProvider;
|
import com.threerings.media.tile.ImageProvider;
|
||||||
@@ -110,8 +111,8 @@ public class TestTileLoader implements TileSetIDBroker
|
|||||||
return f.isDirectory();
|
return f.isDirectory();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for (int ii=0; ii < subdirs.length; ii++) {
|
for (File subdir : subdirs) {
|
||||||
loadTestTilesFromDir(subdirs[ii], sets);
|
loadTestTilesFromDir(subdir, sets);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now look for the xml file
|
// now look for the xml file
|
||||||
@@ -121,10 +122,10 @@ public class TestTileLoader implements TileSetIDBroker
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (int ii=0; ii < xml.length; ii++) {
|
for (String element : xml) {
|
||||||
File xmlfile = new File(directory, xml[ii]);
|
File xmlfile = new File(directory, element);
|
||||||
|
|
||||||
Map<String, TileSet> tiles = new HashMap<String, TileSet>();
|
Map<String, TileSet> tiles = Maps.newHashMap();
|
||||||
try {
|
try {
|
||||||
_parser.loadTileSets(xmlfile, tiles);
|
_parser.loadTileSets(xmlfile, tiles);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
@@ -179,7 +180,7 @@ public class TestTileLoader implements TileSetIDBroker
|
|||||||
protected int _fakeID = Short.MAX_VALUE;
|
protected int _fakeID = Short.MAX_VALUE;
|
||||||
|
|
||||||
/** A mapping of pathname -> tileset id. */
|
/** A mapping of pathname -> tileset id. */
|
||||||
protected Map<String, Integer> _idmap = new HashMap<String, Integer>();
|
protected Map<String, Integer> _idmap = Maps.newHashMap();
|
||||||
|
|
||||||
/** Our xml parser. */
|
/** Our xml parser. */
|
||||||
protected XMLTileSetParser _parser;
|
protected XMLTileSetParser _parser;
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ import javax.swing.tree.DefaultTreeModel;
|
|||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
import javax.swing.tree.TreeSelectionModel;
|
import javax.swing.tree.TreeSelectionModel;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
@@ -362,26 +363,24 @@ public class TileInfoPanel extends JSplitPane
|
|||||||
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
|
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
|
||||||
root.removeAllChildren();
|
root.removeAllChildren();
|
||||||
|
|
||||||
ArrayList<TreePath> expand = new ArrayList<TreePath>();
|
ArrayList<TreePath> expand = Lists.newArrayList();
|
||||||
|
|
||||||
// add all the elements in the base layer
|
// add all the elements in the base layer
|
||||||
DefaultMutableTreeNode base = new DefaultMutableTreeNode("Base Layer");
|
DefaultMutableTreeNode base = new DefaultMutableTreeNode("Base Layer");
|
||||||
root.add(base);
|
root.add(base);
|
||||||
addNodes(base, getSortedTileSets(EditorModel.BASE_LAYER),
|
addNodes(base, getSortedTileSets(EditorModel.BASE_LAYER), "", 0, expand);
|
||||||
"", 0, expand);
|
|
||||||
|
|
||||||
// add all the elements in the object layer
|
// add all the elements in the object layer
|
||||||
DefaultMutableTreeNode obj = new DefaultMutableTreeNode("Object Layer");
|
DefaultMutableTreeNode obj = new DefaultMutableTreeNode("Object Layer");
|
||||||
root.add(obj);
|
root.add(obj);
|
||||||
addNodes(obj, getSortedTileSets(EditorModel.OBJECT_LAYER),
|
addNodes(obj, getSortedTileSets(EditorModel.OBJECT_LAYER), "", 0, expand);
|
||||||
"", 0, expand);
|
|
||||||
|
|
||||||
// notify the JTree that we've put some brand new branches on it.
|
// notify the JTree that we've put some brand new branches on it.
|
||||||
model.reload();
|
model.reload();
|
||||||
|
|
||||||
// expand our container categories
|
// expand our container categories
|
||||||
for (Iterator<TreePath> iter = expand.iterator(); iter.hasNext(); ) {
|
for (TreePath treePath : expand) {
|
||||||
_tsettree.expandPath(iter.next());
|
_tsettree.expandPath(treePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now select the previously selected item, or the first...
|
// now select the previously selected item, or the first...
|
||||||
|
|||||||
@@ -22,12 +22,12 @@
|
|||||||
package com.threerings.stage.util;
|
package com.threerings.stage.util;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.ListUtil;
|
import com.samskivert.util.ListUtil;
|
||||||
|
|
||||||
@@ -225,20 +225,20 @@ public class PlacementConstraints
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < removed.length; i++) {
|
for (ObjectData element : removed) {
|
||||||
if (removed[i].tile.hasConstraint(ObjectTileSet.SURFACE) &&
|
if (element.tile.hasConstraint(ObjectTileSet.SURFACE) &&
|
||||||
hasOnSurface(removed[i], added, removed)) {
|
hasOnSurface(element, added, removed)) {
|
||||||
return MessageBundle.qualify(STAGE_MESSAGE_BUNDLE,
|
return MessageBundle.qualify(STAGE_MESSAGE_BUNDLE,
|
||||||
"m.has_on_surface");
|
"m.has_on_surface");
|
||||||
}
|
}
|
||||||
|
|
||||||
int dir = getConstraintDirection(removed[i], ObjectTileSet.WALL);
|
int dir = getConstraintDirection(element, ObjectTileSet.WALL);
|
||||||
if (dir != NONE) {
|
if (dir != NONE) {
|
||||||
if (hasOnWall(removed[i], added, removed, dir)) {
|
if (hasOnWall(element, added, removed, dir)) {
|
||||||
return MessageBundle.qualify(STAGE_MESSAGE_BUNDLE,
|
return MessageBundle.qualify(STAGE_MESSAGE_BUNDLE,
|
||||||
"m.has_on_wall");
|
"m.has_on_wall");
|
||||||
|
|
||||||
} else if (hasAttached(removed[i], added, removed, dir)) {
|
} else if (hasAttached(element, added, removed, dir)) {
|
||||||
return MessageBundle.qualify(STAGE_MESSAGE_BUNDLE,
|
return MessageBundle.qualify(STAGE_MESSAGE_BUNDLE,
|
||||||
"m.has_attached");
|
"m.has_attached");
|
||||||
}
|
}
|
||||||
@@ -457,14 +457,14 @@ public class PlacementConstraints
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < constraints.length; i++) {
|
for (String constraint : constraints) {
|
||||||
if (constraints[i].startsWith(prefix)) {
|
if (constraint.startsWith(prefix)) {
|
||||||
int fromidx = prefix.length(),
|
int fromidx = prefix.length(),
|
||||||
toidx = constraints[i].indexOf('_', fromidx);
|
toidx = constraint.indexOf('_', fromidx);
|
||||||
dirheight.dir = DirectionUtil.fromShortString(toidx == -1 ?
|
dirheight.dir = DirectionUtil.fromShortString(toidx == -1 ?
|
||||||
constraints[i].substring(fromidx) :
|
constraint.substring(fromidx) :
|
||||||
constraints[i].substring(fromidx, toidx));
|
constraint.substring(fromidx, toidx));
|
||||||
dirheight.low = constraints[i].endsWith(ObjectTileSet.LOW);
|
dirheight.low = constraint.endsWith(ObjectTileSet.LOW);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -503,17 +503,16 @@ public class PlacementConstraints
|
|||||||
{
|
{
|
||||||
List<ObjectData> list = Lists.newArrayList();
|
List<ObjectData> list = Lists.newArrayList();
|
||||||
|
|
||||||
for (Iterator<ObjectData> it = _objectData.values().iterator(); it.hasNext(); ) {
|
for (ObjectData data : _objectData.values()) {
|
||||||
ObjectData data = it.next();
|
|
||||||
if (rect.intersects(data.bounds) && !ListUtil.contains(removed,
|
if (rect.intersects(data.bounds) && !ListUtil.contains(removed,
|
||||||
data)) {
|
data)) {
|
||||||
list.add(data);
|
list.add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < added.length; i++) {
|
for (ObjectData element : added) {
|
||||||
if (rect.intersects(added[i].bounds)) {
|
if (rect.intersects(element.bounds)) {
|
||||||
list.add(added[i]);
|
list.add(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,9 +567,8 @@ public class PlacementConstraints
|
|||||||
/** The Miso scene model. */
|
/** The Miso scene model. */
|
||||||
protected StageMisoSceneModel _mmodel;
|
protected StageMisoSceneModel _mmodel;
|
||||||
|
|
||||||
/** For all objects in the scene, maps {@link ObjectInfo}s to
|
/** For all objects in the scene, maps {@link ObjectInfo}s to {@link ObjectData}s. */
|
||||||
* {@link ObjectData}s. */
|
protected HashMap<ObjectInfo, ObjectData> _objectData = Maps.newHashMap();
|
||||||
protected HashMap<ObjectInfo,ObjectData> _objectData = new HashMap<ObjectInfo,ObjectData>();
|
|
||||||
|
|
||||||
/** One rectangle we'll re-use for all constraints ops. */
|
/** One rectangle we'll re-use for all constraints ops. */
|
||||||
protected static final Rectangle _constrainRect = new Rectangle();
|
protected static final Rectangle _constrainRect = new Rectangle();
|
||||||
|
|||||||
@@ -21,13 +21,14 @@
|
|||||||
|
|
||||||
package com.threerings.stage.util;
|
package com.threerings.stage.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.SortableArrayList;
|
import com.samskivert.util.SortableArrayList;
|
||||||
|
|
||||||
import com.threerings.util.DirectionCodes;
|
import com.threerings.util.DirectionCodes;
|
||||||
@@ -247,7 +248,7 @@ public class StageSceneUtil
|
|||||||
*/
|
*/
|
||||||
public static List<SceneLocation> getClusterLocs (Cluster cluster)
|
public static List<SceneLocation> getClusterLocs (Cluster cluster)
|
||||||
{
|
{
|
||||||
List<SceneLocation> list = new ArrayList<SceneLocation>();
|
List<SceneLocation> list = Lists.newArrayList();
|
||||||
|
|
||||||
// convert our tile coordinates into a cartesian coordinate system
|
// convert our tile coordinates into a cartesian coordinate system
|
||||||
// with units equal to one fine coordinate in size
|
// with units equal to one fine coordinate in size
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.util.Set;
|
|||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
@@ -92,7 +93,7 @@ public class StatRepository extends DepotRepository
|
|||||||
*/
|
*/
|
||||||
public ArrayList<Stat> loadStats (int playerId)
|
public ArrayList<Stat> loadStats (int playerId)
|
||||||
{
|
{
|
||||||
ArrayList<Stat> stats = new ArrayList<Stat>();
|
ArrayList<Stat> stats = Lists.newArrayList();
|
||||||
Where where = new Where(StatRecord.PLAYER_ID, playerId);
|
Where where = new Where(StatRecord.PLAYER_ID, playerId);
|
||||||
for (StatRecord record : findAll(StatRecord.class, where)) {
|
for (StatRecord record : findAll(StatRecord.class, where)) {
|
||||||
Stat stat = decodeStat(record.statCode, record.statData, record.modCount);
|
Stat stat = decodeStat(record.statCode, record.statData, record.modCount);
|
||||||
@@ -117,13 +118,13 @@ public class StatRepository extends DepotRepository
|
|||||||
*/
|
*/
|
||||||
public void writeModified (int playerId, Stat[] stats)
|
public void writeModified (int playerId, Stat[] stats)
|
||||||
{
|
{
|
||||||
for (int ii = 0; ii < stats.length; ii++) {
|
for (Stat stat : stats) {
|
||||||
try {
|
try {
|
||||||
if (stats[ii].getType().isPersistent() && stats[ii].isModified()) {
|
if (stat.getType().isPersistent() && stat.isModified()) {
|
||||||
updateStat(playerId, stats[ii], true);
|
updateStat(playerId, stat, true);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warning("Error flushing modified stat", "stat", stats[ii], e);
|
log.warning("Error flushing modified stat", "stat", stat, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
import com.samskivert.io.PersistenceException;
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
@@ -166,7 +168,7 @@ public class SceneUpdateMarshaller
|
|||||||
protected HashIntMap<Class<?>> _typeToClass = new HashIntMap<Class<?>>();
|
protected HashIntMap<Class<?>> _typeToClass = new HashIntMap<Class<?>>();
|
||||||
|
|
||||||
/** The table mapping update classes to types. */
|
/** The table mapping update classes to types. */
|
||||||
protected HashMap<Class<?>,Integer> _classToType = new HashMap<Class<?>,Integer>();
|
protected HashMap<Class<?>, Integer> _classToType = Maps.newHashMap();
|
||||||
|
|
||||||
/** A counter used in assigning update types to classes. */
|
/** A counter used in assigning update types to classes. */
|
||||||
protected int _nextType = 0;
|
protected int _nextType = 0;
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ package com.threerings.whirled.spot.server;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
@@ -591,5 +593,5 @@ public class SpotSceneManager extends SceneManager
|
|||||||
protected HashIntMap<ClusterRecord> _clusters = new HashIntMap<ClusterRecord>();
|
protected HashIntMap<ClusterRecord> _clusters = new HashIntMap<ClusterRecord>();
|
||||||
|
|
||||||
/** A mapping of entering bodies to portal ids. */
|
/** A mapping of entering bodies to portal ids. */
|
||||||
protected HashMap<Integer, Portal> _enterers = new HashMap<Integer, Portal>();
|
protected HashMap<Integer, Portal> _enterers = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.whirled.tools.xml;
|
package com.threerings.whirled.tools.xml;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -31,6 +30,7 @@ import java.io.IOException;
|
|||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.megginson.sax.DataWriter;
|
import com.megginson.sax.DataWriter;
|
||||||
|
|
||||||
import com.threerings.tools.xml.NestableWriter;
|
import com.threerings.tools.xml.NestableWriter;
|
||||||
@@ -108,8 +108,7 @@ public class SceneWriter
|
|||||||
throws SAXException
|
throws SAXException
|
||||||
{
|
{
|
||||||
// write out our auxiliary scene models
|
// write out our auxiliary scene models
|
||||||
for (int ii = 0; ii < model.auxModels.length; ii++) {
|
for (AuxModel amodel : model.auxModels) {
|
||||||
AuxModel amodel = model.auxModels[ii];
|
|
||||||
NestableWriter awriter = _auxers.get(amodel.getClass());
|
NestableWriter awriter = _auxers.get(amodel.getClass());
|
||||||
if (awriter != null) {
|
if (awriter != null) {
|
||||||
awriter.write(amodel, writer);
|
awriter.write(amodel, writer);
|
||||||
@@ -120,5 +119,5 @@ public class SceneWriter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<Class<?>, NestableWriter> _auxers = new HashMap<Class<?>, NestableWriter>();
|
protected Map<Class<?>, NestableWriter> _auxers = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ package com.threerings.whirled.zone.client;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.ResultListener;
|
import com.samskivert.util.ResultListener;
|
||||||
|
|
||||||
import com.threerings.presents.client.BasicDirector;
|
import com.threerings.presents.client.BasicDirector;
|
||||||
@@ -289,7 +291,7 @@ public class ZoneDirector extends BasicDirector
|
|||||||
protected ZoneSummary _summary;
|
protected ZoneSummary _summary;
|
||||||
|
|
||||||
/** Our zone observer list. */
|
/** Our zone observer list. */
|
||||||
protected ArrayList<ZoneObserver> _observers = new ArrayList<ZoneObserver>();
|
protected ArrayList<ZoneObserver> _observers = Lists.newArrayList();
|
||||||
|
|
||||||
/** Our previous zone id. */
|
/** Our previous zone id. */
|
||||||
protected int _previousZoneId = -1;
|
protected int _previousZoneId = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user