Crossfire Server, Trunk  1.75.0
Treasures Class Reference

#include <Treasures.h>

+ Inheritance diagram for Treasures:
+ Collaboration diagram for Treasures:

Protected Member Functions

virtual void replace (treasurelist *existing, treasurelist *update) override
 Replace an asset by an updated version. More...
 
- Protected Member Functions inherited from AssetsCollection< treasurelist >
virtual void added (treasurelist *)
 An asset was either referenced (but undefined) or defined. More...
 

Additional Inherited Members

- Public Member Functions inherited from AssetsCollection< treasurelist >
void clear ()
 Clear all assets. More...
 
size_t count () const
 Get the number of assets. More...
 
treasurelistdefine (const std::string &name, treasurelist *asset)
 Define an asset, erasing an existing one. More...
 
void each (std::function< void(treasurelist *)> op)
 Apply a function to each asset. More...
 
treasurelistfind (const std::string &name)
 Get a named asset if it exists. More...
 
treasurelistfirst (std::function< bool(const treasurelist *)> op)
 Find the first asset matching some condition. More...
 
treasurelistget (const std::string &name)
 Get a named asset. More...
 
std::vector< std::string > keys () const
 Get the names of all defined assets. More...
 
treasurelistnext (treasurelist *current)
 Allow browsing assets in a list-like manner. More...
 
const std::set< std::string > & undefined () const
 Return the list of undefined assets, that is assets requested through get() but not defined through define(). More...
 
virtual ~AssetsCollection ()
 Destroy this instance and all assets it owns. More...
 
- Protected Attributes inherited from AssetsCollection< treasurelist >
std::unordered_map< std::string, treasurelist * > m_assets
 Known assets. More...
 
std::set< std::string > m_undefined
 List of undefined assets. More...
 

Detailed Description

Definition at line 21 of file Treasures.h.

Member Function Documentation

◆ replace()

void Treasures::replace ( treasurelist existing,
treasurelist update 
)
overrideprotectedvirtual

Replace an asset by an updated version.

Parameters
existingasset to be updated.
updatenew version of the asset, which must be destroyed.

Implements AssetsCollection< treasurelist >.

Definition at line 31 of file Treasures.cpp.

References asset_destroy(), treasurelist::items, treasurelist::total_chance, and treasure_free().

+ Here is the call graph for this function:

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