public Map LoadMap()
{
var tempMap = Map;
if ( tempMap != null )
return tempMap;
lock ( SyncRoot ) {
if ( Map != null )
return Map;
if ( File.Exists( MapFileName ) ) {
try {
Map = MapUtility.Load( MapFileName );
} catch ( Exception ex ) {
Logger.Log( LogType.Error,
"World.LoadMap: Failed to load map ({0}): {1}",
MapFileName, ex );
}
}
// or generate a default one
if ( Map == null ) {
Server.Message( "&WMapfile is missing for world {0}&W. A new map has been created.", ClassyName );
Logger.Log( LogType.Warning,
"World.LoadMap: Map file missing for world {0}. Generating default flatgrass map.",
Name );
Map = MapGeneratorOld.GenerateFlatgrass( 128, 128, 64 );
}
return Map;
}
}