ScummVM API documentation
Ultima::Ultima2::Data::Map Struct Reference

#include <map.h>

Public Member Functions

void load (int mapEra, int mapType)
 
bool canLoad (int mapEra, int mapType) const
 
void synchronize (Common::Serializer &s, bool isDungeon)
 
void saveOverworld ()
 
void clearSaved ()
 
void synchronizeSaved (Common::Serializer &s)
 
Common::String talkString (int index) const
 
TileId tileAt (int x, int y) const
 

Public Attributes

TileId _tiles [MAP_HEIGHT][MAP_WIDTH] = {}
 
MapMonsters _monsters
 
Common::Array< Common::String > _talk
 

Detailed Description

A planet, village, town, or castle's map: a flat 64x64 grid of tiles, plus its monster/NPC slots. Towers and dungeons share the same on-disk mapX??/monX?? files but use a different internal layout for the map data itself – see MapDungeon.

Member Function Documentation

◆ canLoad()

bool Ultima::Ultima2::Data::Map::canLoad ( int  mapEra,
int  mapType 
) const

Checks that a map's file exists and, for overworld/town/castle maps, is the right size, without actually loading it. The original's moongate travel reloads the target era unconditionally and can show corrupted terrain if that era's data turns out to be missing or truncated; callers doing an unprompted map switch (moongate travel, not a player-chosen destination) can check this first and bail out instead

◆ synchronize()

void Ultima::Ultima2::Data::Map::synchronize ( Common::Serializer &  s,
bool  isDungeon 
)

Saves or restores the current map's contents and monsters as they are now, including changes made during play. Loading expects the map to have been loaded first

◆ saveOverworld()

void Ultima::Ultima2::Data::Map::saveOverworld ( )

Keeps the current overworld map as it is, to be loaded again in place of the one in its file. Called before leaving it for somewhere else

◆ clearSaved()

void Ultima::Ultima2::Data::Map::clearSaved ( )
inline

Forgets all the overworld maps that were kept

◆ synchronizeSaved()

void Ultima::Ultima2::Data::Map::synchronizeSaved ( Common::Serializer &  s)

Saves or restores the overworld maps that were kept

◆ talkString()

Common::String Ultima::Ultima2::Data::Map::talkString ( int  index) const
inline

Returns the given line of the map's NPC dialogue, or an empty string if there isn't one


The documentation for this struct was generated from the following file: