Crossfire Server, Trunk
Messages Class Reference

#include <Messages.h>

+ Inheritance diagram for Messages:
+ Collaboration diagram for Messages:

Public Member Functions

 Messages ()
 
GeneralMessagerandom ()
 
- Public Member Functions inherited from AssetsCollection< GeneralMessage >
void clear ()
 
size_t count () const
 
GeneralMessagedefine (const std::string &name, GeneralMessage *asset)
 
void each (std::function< void(GeneralMessage *)> op)
 
GeneralMessagefind (const std::string &name)
 
GeneralMessagefirst (std::function< bool(const GeneralMessage *)> op)
 
GeneralMessageget (const std::string &name)
 
std::vector< std::string > keys () const
 
GeneralMessagenext (GeneralMessage *current)
 
const std::set< std::string > & undefined () const
 
virtual ~AssetsCollection ()
 

Protected Member Functions

virtual void added (GeneralMessage *asset) override
 
virtual void replace (GeneralMessage *existing, GeneralMessage *update) override
 

Protected Attributes

int m_totalChance
 
- Protected Attributes inherited from AssetsCollection< GeneralMessage >
std::unordered_map< std::string, GeneralMessage * > m_assets
 
std::set< std::string > m_undefined
 

Detailed Description

Definition at line 22 of file Messages.h.

Constructor & Destructor Documentation

◆ Messages()

Messages::Messages ( )

Definition at line 32 of file Messages.cpp.

Member Function Documentation

◆ added()

void Messages::added ( GeneralMessage )
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.

◆ random()

GeneralMessage * Messages::random ( )

Definition at line 50 of file Messages.cpp.

References AssetsCollection< GeneralMessage >::m_assets, m_totalChance, navar-midane_pickup::msg, and RANDOM.

Referenced by msgfile_msg().

+ Here is the caller graph for this function:

◆ replace()

void Messages::replace ( GeneralMessage existing,
GeneralMessage 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< 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:

Field Documentation

◆ m_totalChance

int Messages::m_totalChance
protected

Definition at line 30 of file Messages.h.

Referenced by added(), random(), and replace().


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