This class stores a delta, i.e.
More...
#include <item_event_info.hpp>
|
| ItemEventInfo (int ticks, int index, int kart_id, int16_t ttr) |
| Constructor for collecting an existing item.
|
|
| ItemEventInfo (int ticks, ItemState::ItemType type, int index, int kart_id, const Vec3 &xyz, const Vec3 &normal) |
| Constructor for creating a new item (i.e.
|
|
| ItemEventInfo (int ticks) |
| Constructor for switching items.
|
|
| ItemEventInfo (BareNetworkString *buffer, int *count) |
| Loads an event from a server message.
|
|
void | saveState (BareNetworkString *buffer) |
| Stores this event into a network string.
|
|
bool | isNewItem () const |
| Returns if this event represents a new item.
|
|
bool | isItemCollection () const |
| Returns true if this event represents collection of an item.
|
|
bool | isSwitch () const |
| Returns true if this event represent a switch usage.
|
|
int | getIndex () const |
| Returns the index of this item.
|
|
int | getTicks () const |
| Returns the time of the event in ticks.
|
|
int | getKartId () const |
| Returns the id of the kart that collected an item.
|
|
const Vec3 & | getXYZ () const |
| Returns the location of a new item.
|
|
const Vec3 & | getNormal () const |
| Returns the normal of a new item only.
|
|
int | getTicksTillReturn () const |
| Returns the ticks till return, used only by collection events.
|
|
ItemState::ItemType | getNewItemType () const |
| Returns the type of this item.
|
|
|
enum | EventType { IEI_COLLECT
, IEI_NEW
, IEI_SWITCH
} |
| Type of this event.
|
|
|
enum ItemEventInfo::EventType | m_type |
|
int | m_ticks |
| Time at which this event happens.
|
|
int | m_index |
| Index of this item in the item list.
|
|
int | m_kart_id |
| The kart id that collected an item if >=0; if -1 it indicates a new item, and a -2 indicates a switch being used.
|
|
Vec3 | m_xyz |
| In case of new items the position of the new item.
|
|
Vec3 | m_normal |
| The normal of an item.
|
|
int16_t | m_ticks_till_return |
| Ticks for the item to return, atm used by collecting banana with bomb to delay the return for banana.
|
|
This class stores a delta, i.e.
an item event (either collection of an item, adding a new item, or an item switch being activated). All those deltas will be applied to the confirmed state to get a new state.
◆ ItemEventInfo() [1/3]
ItemEventInfo::ItemEventInfo |
( |
int |
ticks, |
|
|
int |
index, |
|
|
int |
kart_id, |
|
|
int16_t |
ttr |
|
) |
| |
|
inline |
Constructor for collecting an existing item.
- Parameters
-
ticks | Time of the event. |
item_id | The index of the item that was collected. |
kart_id | the kart that collected the item. |
ttr | Ticks till return after being collected. |
◆ ItemEventInfo() [2/3]
Constructor for creating a new item (i.e.
a bubble gum is dropped). At the moment only bubble gums can be droppes, so there is no need to encode the new item type.
◆ ItemEventInfo() [3/3]
Loads an event from a server message.
It helps encapsulate the encoding of events from and into a message buffer.
- Parameters
-
buffer | A network string with the event data. |
count | The number of bytes read will be subtracted from this value. |
◆ getKartId()
int ItemEventInfo::getKartId |
( |
| ) |
const |
|
inline |
Returns the id of the kart that collected an item.
Only allowed to be called when this event is an item collection.
◆ getNewItemType()
Returns the type of this item.
Note at this stage only bubble gums can be created during a race.
◆ getXYZ()
const Vec3 & ItemEventInfo::getXYZ |
( |
| ) |
const |
|
inline |
Returns the location of a new item.
Only allowed to be called when this is a new item event.
◆ saveState()
Stores this event into a network string.
- Parameters
-
buffer | The network string to which the data should be appended. |
◆ m_index
int ItemEventInfo::m_index |
|
private |
Index of this item in the item list.
Only used when creating new items (e.g. bubble gum).
The documentation for this class was generated from the following files: