Fixed kart id being received as unsigned int (needs to be signed since
the sign indicates the event type).
This commit is contained in:
@@ -32,9 +32,9 @@
|
||||
ItemEventInfo::ItemEventInfo(BareNetworkString *buffer, int *count)
|
||||
{
|
||||
m_ticks = buffer->getTime();
|
||||
m_kart_id = buffer->getUInt8();
|
||||
m_kart_id = buffer->getInt8();
|
||||
m_index = buffer->getUInt16();
|
||||
*count -= 7;
|
||||
*count -= 7;
|
||||
} // ItemEventInfo(BareNetworkString, int *count)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -61,22 +61,26 @@ public:
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
/** 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(int ticks, ItemState::ItemType type, int index,
|
||||
const Vec3 &xyz)
|
||||
const Vec3 &xyz)
|
||||
: m_ticks(ticks), m_index(index), m_kart_id(-1), m_xyz(xyz)
|
||||
{
|
||||
} // ItemEventInfo(new item)
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
/** Constructor for switching items. */
|
||||
ItemEventInfo(int ticks) : m_ticks(ticks), m_kart_id(-2)
|
||||
{
|
||||
} // ItemEventInfo(switch)
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
ItemEventInfo(BareNetworkString *buffer, int *count);
|
||||
// --------------------------------------------------------------------
|
||||
ItemEventInfo(BareNetworkString *buffer, int *count);
|
||||
void saveState(BareNetworkString *buffer);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
/** Returns if this event represents a new item. */
|
||||
bool isNewItem() const { return m_kart_id == -1; }
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
4
src/network/network_string.hpp
Normal file → Executable file
4
src/network/network_string.hpp
Normal file → Executable file
@@ -294,10 +294,10 @@ public:
|
||||
} // getUInt8
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns an unsigned 8-bit integer. */
|
||||
inline uint8_t getInt8() const
|
||||
inline int8_t getInt8() const
|
||||
{
|
||||
return m_buffer[m_current_offset++];
|
||||
} // getUInt8
|
||||
} // getInt8
|
||||
// ------------------------------------------------------------------------
|
||||
/** Gets a 4 byte floating point value. */
|
||||
float getFloat() const
|
||||
|
||||
Reference in New Issue
Block a user