|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.world.BackgroundMapLoader
This class spawns threads to load maps, so that the server doesn't have to block while maps load (which would freeze the game).
Field Summary | |
wyvern.kernel.data.MultiHashMap |
loading_
Keeps track of the maps that are currently loading, so incoming requests to load them can be merged together. |
EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap |
maps_
This variable holds all the maps currently loaded in the game. |
Fields inherited from interface wyvern.lib.GameMap.UnloadMapConstants |
MAP_CONTAINS_PLAYERS, MAP_NOT_LOADED, SUCCESS |
Method Summary | |
void |
autoloadMap(java.lang.String path)
Used for autoloading the destinations of "autoload" teleporters. |
static BackgroundMapLoader |
getInstance()
|
GameMap |
getMap(MapLoaderListener callback,
java.lang.String name)
Returns a reference to a map, loading it if necessary on a background thread. |
GameMap |
getMap(MapLoaderListener callback,
java.lang.String name,
GameMapLoader loader,
boolean cache)
Loads a map in the background using a custom map loader. |
GameMap |
getMapNoLoad(java.lang.String name)
Retrieves the specified map if it's already loaded in memory, else returns null. |
static java.lang.String |
getProfilingInfo()
Prints information about the health/status of the object. |
java.lang.String[] |
getRegisteredMaps()
Returns a list of all currently loaded maps. |
void |
registerMap(GameMap map)
Adds a map to the World. |
int |
unloadMap(java.lang.String name)
Attempts to unload a map from the game. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap maps_
public wyvern.kernel.data.MultiHashMap loading_
Method Detail |
public static BackgroundMapLoader getInstance()
public GameMap getMap(MapLoaderListener callback, java.lang.String name)
callback
- the callback wanting to know when it's loadedname
- the map path, e.g. "village/blacksmith" or
"wiz/rhialto/maps/desert/pyramid", or a virtual path for
per-player maps, such as "players/bob/village/blacksmith".
public GameMap getMap(MapLoaderListener callback, java.lang.String name, GameMapLoader loader, boolean cache)
name
- the map path, e.g. "village/blacksmith" or
"wiz/rhialto/maps/desert/pyramid", or a virtual path for
per-player maps, such as "players/bob/village/blacksmith".callback
- the callback wanting to know when it's loadedloader
- a custom map loader, perhaps one that constructs
the map dynamically without reading it from a mapfile. Also
called by getMap(MapLoaderListener, String), passing in a
standard MapLoader.cache
- true to cache the map in the World list by
its path after loading the map. If you're passing in a
custom GameMapLoader, then you probably want to pass false,
and register the map yourself after the map is completely
constructed, using World.registerMap().
public GameMap getMapNoLoad(java.lang.String name)
name
- the map path, e.g. "village/blacksmith" or
"wiz/rhialto/maps/desert/pyramid", or a virtual path for
per-player maps, such as "players/bob/village/blacksmith".
public void autoloadMap(java.lang.String path)
path
- the map path, e.g. "village/blacksmith" or
"wiz/rhialto/maps/desert/pyramid"public int unloadMap(java.lang.String name)
name
- the map path, e.g. "village/blacksmith" or
"wiz/rhialto/maps/desert/pyramid", or a virtual path for
per-player maps, such as "players/bob/village/blacksmith".
public void registerMap(GameMap map)
map
- the map to add; must have its path setpublic java.lang.String[] getRegisteredMaps()
public static java.lang.String getProfilingInfo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |