From e7b8c2cb22e947c80fb6cdf4fc99eaf351384c01 Mon Sep 17 00:00:00 2001 From: Mordred Date: Fri, 9 Feb 2018 00:55:44 +0100 Subject: [PATCH 1/4] New base class for anything actor related, not being used yet --- .../sapphire_zone/Actor/GameObject.cpp | 7 ++ src/servers/sapphire_zone/Actor/GameObject.h | 78 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/servers/sapphire_zone/Actor/GameObject.cpp create mode 100644 src/servers/sapphire_zone/Actor/GameObject.h diff --git a/src/servers/sapphire_zone/Actor/GameObject.cpp b/src/servers/sapphire_zone/Actor/GameObject.cpp new file mode 100644 index 00000000..44ade97c --- /dev/null +++ b/src/servers/sapphire_zone/Actor/GameObject.cpp @@ -0,0 +1,7 @@ +#include "GameObject.h" + +Core::Entity::GameObject::GameObject( ObjKind type ) : + m_objKind( type ) +{ + +} diff --git a/src/servers/sapphire_zone/Actor/GameObject.h b/src/servers/sapphire_zone/Actor/GameObject.h new file mode 100644 index 00000000..2641b30e --- /dev/null +++ b/src/servers/sapphire_zone/Actor/GameObject.h @@ -0,0 +1,78 @@ +#ifndef _GAME_OBJECT_H_ +#define _GAME_OBJECT_H_ + +#include +#include + +#include "Forwards.h" +#include +#include +#include + +namespace Core { + namespace Entity { + +/*! +\class GameObject +\brief Base class for all actor/objects + +*/ + class GameObject : public boost::enable_shared_from_this< GameObject > + { + public: + enum ObjKind : uint8_t + { + None = 0x00, + Player = 0x01, + BattleNpc = 0x02, + EventNpc = 0x03, + Treasure = 0x04, + Aetheryte = 0x05, + GatheringPoint = 0x06, + EventObj = 0x07, + Mount = 0x08, + Companion = 0x09, + Retainer = 0x0A, + Area = 0x0B, + Housing = 0x0C, + Cutscene = 0x0D, + CardStand = 0x0E, + }; + + protected: + /*! Position of the object */ + Common::FFXIVARR_POSITION3 m_pos; + /*! Rotation of the object */ + float m_rot; + /*! Id of the actor */ + uint32_t m_id; + /*! Type of the actor */ + ObjKind m_objKind; + + public: + GameObject( ObjKind type ); + virtual ~GameObject(); + + uint32_t getId() const; + + ObjKind getObjKind() const; + + Common::FFXIVARR_POSITION3& getPos(); + void setPos( const Common::FFXIVARR_POSITION3& pos ); + void setPos( float x, float y, float z ); + + float getRot() const; + void setRot( float rot ); + + bool isPlayer() const; + bool isBNpc() const; + bool isENpc() const; + + PlayerPtr getAsPlayer(); + BattleNpcPtr getAsBNpc(); + EventNpcPtr getAsENpc(); + }; + + } +} +#endif \ No newline at end of file From 6594dd1dc4079fbe14a65c335cd29dc76421241b Mon Sep 17 00:00:00 2001 From: Mordred Admin Date: Fri, 9 Feb 2018 08:32:28 +0100 Subject: [PATCH 2/4] Missing virtual destructor implementation --- src/servers/sapphire_zone/Actor/GameObject.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/servers/sapphire_zone/Actor/GameObject.h b/src/servers/sapphire_zone/Actor/GameObject.h index 2641b30e..fe1efe03 100644 --- a/src/servers/sapphire_zone/Actor/GameObject.h +++ b/src/servers/sapphire_zone/Actor/GameObject.h @@ -51,7 +51,7 @@ namespace Core { public: GameObject( ObjKind type ); - virtual ~GameObject(); + virtual ~GameObject() {}; uint32_t getId() const; @@ -75,4 +75,4 @@ namespace Core { } } -#endif \ No newline at end of file +#endif From 99eb4c7d174ee5472329b34eb48415816405828a Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 9 Feb 2018 20:11:30 +1100 Subject: [PATCH 3/4] fix script builds and logging issues on WSL --- src/servers/sapphire_api/main.cpp | 2 +- src/servers/sapphire_lobby/ServerLobby.cpp | 2 +- .../sapphire_zone/Script/Scripts/CMakeLists.txt | 17 ++++++++++------- src/servers/sapphire_zone/ServerZone.cpp | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/servers/sapphire_api/main.cpp b/src/servers/sapphire_api/main.cpp index 1a6fe25f..bcce3189 100644 --- a/src/servers/sapphire_api/main.cpp +++ b/src/servers/sapphire_api/main.cpp @@ -739,7 +739,7 @@ void defaultGet( shared_ptr response, shared_ptr( new ${_scriptname} ),\n") @@ -55,11 +56,13 @@ foreach(_scriptDir ${children}) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ScriptLoader.cpp.in" "${_scriptDir}/ScriptLoader.cpp") - add_custom_command(TARGET "script_${_name}" POST_BUILD - COMMAND ${CMAKE_COMMAND} -E remove "${SCRIPT_LIB_DIR}/script_${_name}.exp" - COMMAND ${CMAKE_COMMAND} -E remove "${SCRIPT_LIB_DIR}/script_${_name}.lib" - COMMAND ${CMAKE_COMMAND} -E remove "${SCRIPT_LIB_DIR}/script_${_name}.ilk" - ) + if(MSVC) + add_custom_command(TARGET "script_${_name}" POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove "${SCRIPT_LIB_DIR}/script_${_name}.exp" + COMMAND ${CMAKE_COMMAND} -E remove "${SCRIPT_LIB_DIR}/script_${_name}.lib" + COMMAND ${CMAKE_COMMAND} -E remove "${SCRIPT_LIB_DIR}/script_${_name}.ilk" + ) + endif() unset(ScriptIncludes) unset(ScriptNames) diff --git a/src/servers/sapphire_zone/ServerZone.cpp b/src/servers/sapphire_zone/ServerZone.cpp index ee723654..9f2f3785 100644 --- a/src/servers/sapphire_zone/ServerZone.cpp +++ b/src/servers/sapphire_zone/ServerZone.cpp @@ -193,7 +193,7 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] ) void Core::ServerZone::run( int32_t argc, char* argv[] ) { // TODO: add more error checks for the entire initialisation - g_log.setLogPath( "log\\SapphireZone_" ); + g_log.setLogPath( "log/SapphireZone_" ); g_log.init(); printBanner(); From 42e0a7c09a49405c3da28a9749e94d6cf597b9e0 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 9 Feb 2018 20:25:18 +1100 Subject: [PATCH 4/4] builds should work now... probably --- src/servers/sapphire_zone/Script/Scripts/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/servers/sapphire_zone/Script/Scripts/CMakeLists.txt b/src/servers/sapphire_zone/Script/Scripts/CMakeLists.txt index 31921d03..03c76b3c 100644 --- a/src/servers/sapphire_zone/Script/Scripts/CMakeLists.txt +++ b/src/servers/sapphire_zone/Script/Scripts/CMakeLists.txt @@ -32,14 +32,14 @@ foreach(_scriptDir ${children}) if(ScriptIncludes) set(ScriptIncludes "${ScriptIncludes}\n#include \"${_script}\"") else() - set(ScriptIncludes "#include \"./${_script}\"") + set(ScriptIncludes "#include \"${_script}\"") endif() set(ScriptNames "${ScriptNames} static_cast< ScriptObject* >( new ${_scriptname} ),\n") endif() endforeach() - add_library("script_${_name}" MODULE "${SCRIPT_FILES}" "${SCRIPT_INCLUDE_FILES}" "${_scriptDir}/ScriptLoader.cpp") + add_library("script_${_name}" MODULE "${SCRIPT_BUILD_FILES}" "${SCRIPT_INCLUDE_FILES}" "${_scriptDir}/ScriptLoader.cpp") target_link_libraries("script_${_name}" sapphire_zone) if(MSVC)