📄 mapworldobject.java
字号:
/*
* MapWorldObject.java
*
* Copyright (C) 2000 Jason M. Hanley
* Released under the GNU General Public License (GPL)
* See license.txt for additional information.
*
* Created on July 30, 2000, 10:18 PM
*/
package fate.world;
import java.util.*;
import java.io.*;
import fate.*;
import fate.util.*;
/**
* Simple map to contain {@link WorldObject} objects.
* @author preylude@s3m.com
* @version 0.1.0
*/
public class MapWorldObject extends HashMap implements Serializable {
/** Creates new MapWorldObject */
public MapWorldObject() {
super();
}
/** Adds a new WorldObject object */
public int put( WorldObject wo ) {
// If the object does not yet have an id
if (wo.id == -1) {
int lastID = FateServer.universe.getNextID();
wo.id = lastID;
put( new Integer( lastID ), wo );
} else {
put( new Integer( wo.id ), wo );
}
return wo.id;
}
/** Updates an existing WorldObject object */
public void update( WorldObject wo ) {
put( new Integer( wo.id ), wo );
}
/** Retrieves a WorldObject object */
public WorldObject get( int id ) {
WorldObject wo = null;
wo = (WorldObject) get( new Integer( id ) );
if (wo == null)
Debug.trace( "Error: ID " + Integer.toString( id ) + " not found in MapWorldObject.get()" );
return wo;
}
/** Retrieves a WorldObject object */
public WorldObject remove( int id ) {
return (WorldObject) remove( new Integer( id ) );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -