![]() |
Crossfire Server, Trunk
1.75.0
|
#include <Messages.h>
Inheritance diagram for Messages:
Collaboration diagram for Messages:Public Member Functions | |
| Messages () | |
| GeneralMessage * | random () |
Public Member Functions inherited from AssetsCollection< GeneralMessage > | |
| void | clear () |
| Clear all assets. More... | |
| size_t | count () const |
| Get the number of assets. More... | |
| GeneralMessage * | define (const std::string &name, GeneralMessage *asset) |
| Define an asset, erasing an existing one. More... | |
| void | each (std::function< void(GeneralMessage *)> op) |
| Apply a function to each asset. More... | |
| GeneralMessage * | find (const std::string &name) |
| Get a named asset if it exists. More... | |
| GeneralMessage * | first (std::function< bool(const GeneralMessage *)> op) |
| Find the first asset matching some condition. More... | |
| GeneralMessage * | get (const std::string &name) |
| Get a named asset. More... | |
| std::vector< std::string > | keys () const |
| Get the names of all defined assets. More... | |
| GeneralMessage * | next (GeneralMessage *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 Member Functions | |
| virtual void | added (GeneralMessage *asset) override |
| An asset was either referenced (but undefined) or defined. More... | |
| virtual void | replace (GeneralMessage *existing, GeneralMessage *update) override |
| Replace an asset by an updated version. More... | |
Protected Attributes | |
| int | m_totalChance |
Protected Attributes inherited from AssetsCollection< GeneralMessage > | |
| std::unordered_map< std::string, GeneralMessage * > | m_assets |
| Known assets. More... | |
| std::set< std::string > | m_undefined |
| List of undefined assets. More... | |
Definition at line 22 of file Messages.h.
| Messages::Messages | ( | ) |
Definition at line 32 of file Messages.cpp.
|
overrideprotectedvirtual |
An asset was either referenced (but undefined) or defined.
Reimplemented from AssetsCollection< GeneralMessage >.
Definition at line 46 of file Messages.cpp.
References GeneralMessage::chance, and m_totalChance.
| GeneralMessage * Messages::random | ( | ) |
Definition at line 50 of file Messages.cpp.
References AssetsCollection< GeneralMessage >::m_assets, m_totalChance, RANDOM, and weight.
Referenced by msgfile_msg().
Here is the caller graph for this function:
|
overrideprotectedvirtual |
Replace an asset by an updated version.
| existing | asset to be updated. |
| update | new version of the asset, which must be destroyed. |
Implements AssetsCollection< GeneralMessage >.
Definition at line 35 of file Messages.cpp.
References asset_destroy(), GeneralMessage::chance, FREE_AND_COPY_IF, GeneralMessage::identifier, m_totalChance, GeneralMessage::message, GeneralMessage::quest_code, and GeneralMessage::title.
Here is the call graph for this function:
|
protected |
Definition at line 30 of file Messages.h.