Merge branch 'master' into dev

This commit is contained in:
Otto Naderer 2022-06-07 17:52:34 +02:00
commit fb0b8cee79
4 changed files with 60 additions and 3 deletions

41
CMakeLists.txt Executable file
View File

@ -0,0 +1,41 @@
# cmake for irrnet, ottona, 2022-04-27
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/lib")
set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
#irrnet stuff
add_definitions(-DCOMPILE_WITH_IRRLICHT)
set(IRRNET_TARGET irrnet)
set(IRRNET_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/source")
set(IRRNET_INC_DIR "${CMAKE_CURRENT_LIST_DIR}/include")
#enet stuff
set(ENET_TARGET enet)
set(ENET_DIR "${CMAKE_CURRENT_LIST_DIR}/enet")
set(ENET_INC_DIR ${ENET_DIR}/include)
add_subdirectory(${ENET_DIR} EXCLUDE_FROM_ALL)
#zlib stuff
set(ZLIB_TARGET zlibstatic)
set(ZLIB_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib")
set(ZLIB_INC_DIR ${ZLIB_DIR}/include)
add_subdirectory(${ZLIB_DIR} EXCLUDE_FROM_ALL)
project(irrnet)
include_directories(/usr/include/irrlicht)
add_library(${IRRNET_TARGET} STATIC
${IRRNET_SRC_DIR}/CNetManager.cpp
${IRRNET_SRC_DIR}/SPacket.cpp
)
target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRNET_INC_DIR} ${ENET_INC_DIR} ${ZLIB_INC_DIR})

View File

@ -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.

View File

@ -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;

2
zlib

@ -1 +1 @@
Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f
Subproject commit 21767c654d31d2dccdde4330529775c6c5fd5389