Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
AssetCache Class Reference

Loads all of the assets into memory (objects, textures, etc.). More...

#include <AssetCache.hpp>

Collaboration diagram for AssetCache:
Collaboration graph

Public Member Functions

void loadAssets ()
 Loads all the assets into memory. More...
 
std::map< std::string, MapAreaAssetData > & getAreaAssetData ()
 Returns the map of area asset data. More...
 
const ObjectAssetDatagetObjectAssetDataById (int id)
 Returns the object asset data by type id. More...
 
const CharacterAssetDatagetCharacterAssetDataById (int id)
 Returns the character asset data by type id. More...
 
const ItemAssetDatagetItemAssetDataById (int id)
 Returns the item asset data by type id. More...
 
std::map< std::string, ImageData > & getTextureAssetData ()
 Returns the map of texture asset data. More...
 
ImageData getDefaultTexture ()
 Get default texture. More...
 
std::map< int, ItemAssetData > & getItemAssetData ()
 Get item asset data map. More...
 

Static Public Member Functions

static AssetCachegetInstance ()
 Returns the singleton instance of the AssetCache. More...
 

Private Member Functions

 AssetCache ()
 
 AssetCache (AssetCache const &)
 
void operator= (AssetCache const &)
 
std::map< int, ObjectAssetDataloadGameObjectAssetData (const GameObjects &gameObjects)
 Loads the game object assets data. More...
 
std::map< int, CharacterAssetDataloadCharacterAssetData (const GameCharacters &gameCharacters)
 Loads the character assets data. More...
 
std::map< std::string, MapAreaAssetDataloadAreaAssetData (const std::vector< std::vector< std::string >> &areaMap)
 Loads the map area assets data. More...
 
std::map< int, ItemAssetDataloadItemAssetData (const GameItems &gameItems)
 Loads the item assets data. More...
 

Private Attributes

std::map< std::string, MapAreaAssetDataareaAssetDataM
 
std::map< int, ObjectAssetDataobjectAssetDataM
 
std::map< int, CharacterAssetDatacharacterAssetDataM
 
std::map< int, ItemAssetDataitemAssetDataM
 
std::map< std::string, ImageDatatextureAssetDataM
 
ImageData defaultTextureM
 

Detailed Description

Loads all of the assets into memory (objects, textures, etc.).

Note
This is a singleton class. Also all the assets are mapped with their filename as the key.

Constructor & Destructor Documentation

◆ AssetCache() [1/2]

AssetCache::AssetCache ( )
inlineprivate

◆ AssetCache() [2/2]

AssetCache::AssetCache ( AssetCache const &  )
private

Member Function Documentation

◆ getAreaAssetData()

std::map< std::string, MapAreaAssetData > & AssetCache::getAreaAssetData ( )

Returns the map of area asset data.

Returns
Map of area name and its corresponding asset data (MapAreaAssetData)
Here is the caller graph for this function:

◆ getCharacterAssetDataById()

const CharacterAssetData & AssetCache::getCharacterAssetDataById ( int  id)

Returns the character asset data by type id.

Parameters
idcharacter type id
Returns
CharacterAssetData
Here is the caller graph for this function:

◆ getDefaultTexture()

ImageData AssetCache::getDefaultTexture ( )

Get default texture.

Returns
ImageData
Here is the caller graph for this function:

◆ getInstance()

static AssetCache& AssetCache::getInstance ( )
inlinestatic

Returns the singleton instance of the AssetCache.

Here is the caller graph for this function:

◆ getItemAssetData()

std::map< int, ItemAssetData > & AssetCache::getItemAssetData ( )

Get item asset data map.

Returns
std::map<int, ItemAssetData>&
Here is the caller graph for this function:

◆ getItemAssetDataById()

const ItemAssetData & AssetCache::getItemAssetDataById ( int  id)

Returns the item asset data by type id.

Parameters
iditem type id
Returns
ItemAssetData
Here is the caller graph for this function:

◆ getObjectAssetDataById()

const ObjectAssetData & AssetCache::getObjectAssetDataById ( int  id)

Returns the object asset data by type id.

Parameters
idobject type id
Returns
ObjectAssetData
Here is the caller graph for this function:

◆ getTextureAssetData()

std::map< std::string, ImageData > & AssetCache::getTextureAssetData ( )

Returns the map of texture asset data.

Returns
Map of texture filename and its corresponding asset data (ImageData)

◆ loadAreaAssetData()

std::map< std::string, MapAreaAssetData > AssetCache::loadAreaAssetData ( const std::vector< std::vector< std::string >> &  areaMap)
private

Loads the map area assets data.

Parameters
areaMapThe area map
Returns
Map of area name and its corresponding asset data (MapAreaAssetData )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadAssets()

void AssetCache::loadAssets ( )

Loads all the assets into memory.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadCharacterAssetData()

std::map< int, CharacterAssetData > AssetCache::loadCharacterAssetData ( const GameCharacters gameCharacters)
private

Loads the character assets data.

Parameters
gameCharactersThe game characters data
Returns
Map of character id and its corresponding asset data (CharacterAssetData)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadGameObjectAssetData()

std::map< int, ObjectAssetData > AssetCache::loadGameObjectAssetData ( const GameObjects gameObjects)
private

Loads the game object assets data.

Parameters
gameObjectsThe game objects
Returns
Map of game object id and its corresponding asset data (ObjectAssetData)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadItemAssetData()

std::map< int, ItemAssetData > AssetCache::loadItemAssetData ( const GameItems gameItems)
private

Loads the item assets data.

Parameters
gameItemsGameItems
Returns
Map of item id and its corresponding asset data (ItemAssetData)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

void AssetCache::operator= ( AssetCache const &  )
private

Member Data Documentation

◆ areaAssetDataM

std::map<std::string, MapAreaAssetData> AssetCache::areaAssetDataM
private

◆ characterAssetDataM

std::map<int, CharacterAssetData> AssetCache::characterAssetDataM
private

◆ defaultTextureM

ImageData AssetCache::defaultTextureM
private

◆ itemAssetDataM

std::map<int, ItemAssetData> AssetCache::itemAssetDataM
private

◆ objectAssetDataM

std::map<int, ObjectAssetData> AssetCache::objectAssetDataM
private

◆ textureAssetDataM

std::map<std::string, ImageData> AssetCache::textureAssetDataM
private

The documentation for this class was generated from the following files: