mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 22:17:45 +00:00
Add custom vars to director
This commit is contained in:
parent
0a0f1b2790
commit
714e024128
2 changed files with 30 additions and 0 deletions
|
@ -121,3 +121,16 @@ uint8_t Sapphire::Event::Director::getDirectorVar( uint8_t index, bool shiftLeft
|
|||
{
|
||||
return getDirectorVar( index ) & ( shiftLeft ? 0xF0 : 0x0F );
|
||||
}
|
||||
|
||||
void Sapphire::Event::Director::setCustomVar( uint32_t index, uint64_t value )
|
||||
{
|
||||
m_customVarMap[ index ] = value;
|
||||
}
|
||||
|
||||
uint64_t Sapphire::Event::Director::getCustomVar( uint32_t index )
|
||||
{
|
||||
auto it = m_customVarMap.find( index );
|
||||
if( it != m_customVarMap.end() )
|
||||
return it->second;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,13 @@ namespace Sapphire::Event
|
|||
*/
|
||||
void setDirectorVar( uint8_t index, uint8_t valueLeft, uint8_t valueRight );
|
||||
|
||||
/*!
|
||||
* @brief Sets a value of a custom var
|
||||
* @param index of var to set
|
||||
* @param value to set
|
||||
*/
|
||||
void setCustomVar( uint32_t index, uint64_t value );
|
||||
|
||||
/*!
|
||||
* @brief Gets a value of a director var
|
||||
* @param index of var to get
|
||||
|
@ -114,6 +121,13 @@ namespace Sapphire::Event
|
|||
* @return 4 bits of selected index
|
||||
*/
|
||||
uint8_t getDirectorVar( uint8_t index, bool shiftLeft );
|
||||
|
||||
/*!
|
||||
* @brief Gets a value of a custom var
|
||||
* @param index of var to get
|
||||
* @return custom var
|
||||
*/
|
||||
uint64_t getCustomVar( uint32_t index );
|
||||
private:
|
||||
/*! Id of the content of the director */
|
||||
uint16_t m_contextId;
|
||||
|
@ -131,6 +145,9 @@ namespace Sapphire::Event
|
|||
|
||||
/*! type of the director */
|
||||
DirectorType m_type;
|
||||
|
||||
/*! custom vars */
|
||||
std::unordered_map< uint32_t, uint64_t > m_customVarMap;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue