diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e0d47b..2236f4b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,25 +19,17 @@ set(IRRNET_INC_DIR "${CMAKE_CURRENT_LIST_DIR}/include") set(ENET_TARGET enet) set(ENET_DIR "${CMAKE_CURRENT_LIST_DIR}/enet") set(ENET_INC_DIR ${ENET_DIR}/include) -add_subdirectory(${ENET_DIR}) +add_subdirectory(${ENET_DIR} EXCLUDE_FROM_ALL) #zlib stuff -set(ZLIB_TARGET zlib) +set(ZLIB_TARGET zlibstatic) set(ZLIB_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib") -#set(ZLIB_INC_DIR ${ZLIB_DIR}/include) -add_subdirectory(${ZLIB_DIR}) +set(ZLIB_INC_DIR ${ZLIB_DIR}/include) +add_subdirectory(${ZLIB_DIR} EXCLUDE_FROM_ALL) project(irrnet) -#include_directories( -# /usr/include/irrlicht -# ${IRRNET_INC_DIR} -# ${TESLINK_SRC_DIR} -# ${TESSERVER_REST_INC_DIR} -# ${JSON_INC_DIR} -#) - include_directories(/usr/include/irrlicht) add_library(${IRRNET_TARGET} STATIC @@ -45,6 +37,5 @@ add_library(${IRRNET_TARGET} STATIC ${IRRNET_SRC_DIR}/SPacket.cpp ) -target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRNET_INC_DIR} ${ENET_INC_DIR}) +target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRNET_INC_DIR} ${ENET_INC_DIR} ${ZLIB_INC_DIR}) -target_link_libraries(${IRRNET_LIB_TARGET} ${ENET_TARGET}) diff --git a/include/SPacket.h b/include/SPacket.h index 6d9d1e9..ec213ee 100644 --- a/include/SPacket.h +++ b/include/SPacket.h @@ -49,6 +49,8 @@ class SOutPacket SOutPacket& operator << (const f64 data); /// Adds data to the packet. SOutPacket& operator << (const core::vector3df& data); + /// Adds a quaternion to the packet + SOutPacket& operator << (const core::quaternion&); /// Adds data to the packet. SOutPacket& operator << (const c8* string); /// Adds data to the packet. @@ -57,7 +59,6 @@ class SOutPacket SOutPacket& operator << (const std::string& string); /// Adds data to the packet. SOutPacket& operator << (const core::stringw& string); - /// Appends another SOutPacket to the packet. SOutPacket& operator << (const SOutPacket& other); @@ -114,7 +115,9 @@ class SInPacket /// Gets the next item in the packet based on the size of the variable. void operator >> (f64& data); /// Gets the next item in the packet based on the size of the variable. - void operator >> (core::vector3df& data); + void operator >> (core::vector3df& data); + /// Gets the next item in the packet based on the size of the variable. + void operator >> (core::quaternion& data); /// Gets the next item in the packet based on the size of the variable. void operator >> (char* string); /// Gets the next item in the packet based on the size of the variable. diff --git a/source/SPacket.cpp b/source/SPacket.cpp index 55bd1c0..bbb04b3 100644 --- a/source/SPacket.cpp +++ b/source/SPacket.cpp @@ -107,6 +107,13 @@ SOutPacket& SOutPacket::operator << (const core::vector3df& data) return *this; } +SOutPacket& SOutPacket::operator << (const core::quaternion& data) +{ + enlargeBuffer(16); + memcpy(buff.pointer() + buff.size() - 16, &data.X, 16); + return *this; +} + SOutPacket& SOutPacket::operator << (const c8* string) { u16 tmp = (u16)strlen(string); @@ -298,6 +305,12 @@ void SInPacket::operator >> (core::vector3df &data) pos+=12; } +void SInPacket::operator >> (core::quaternion &data) +{ + memcpy(&data.X,getData()+pos,16); + pos+=16; +} + void SInPacket::operator >> (char *string) { u16 sz; diff --git a/zlib b/zlib index cacf7f1..21767c6 160000 --- a/zlib +++ b/zlib @@ -1 +1 @@ -Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f +Subproject commit 21767c654d31d2dccdde4330529775c6c5fd5389