diff --git a/client/renderable/base_monster.hpp b/client/renderable/base_monster.hpp index 58d8f49..15cea7d 100644 --- a/client/renderable/base_monster.hpp +++ b/client/renderable/base_monster.hpp @@ -26,8 +26,8 @@ class BaseMonster { public: - BaseMonster(); - virtual ~BaseMonster(); + BaseMonster() = default; + virtual ~BaseMonster() = default; private: // diff --git a/client/renderable/local_character.hpp b/client/renderable/local_character.hpp index 8407fef..37e90de 100644 --- a/client/renderable/local_character.hpp +++ b/client/renderable/local_character.hpp @@ -30,9 +30,13 @@ public: LocalCharacter() = default; ~LocalCharacter() = default; + int SetRoomIndex(int i) { return roomIndex = i; } + int GetRoomIndex() { return roomIndex; } + Statistics* GetBaseStats() { return &baseStats; } private: + int roomIndex = -1; Statistics baseStats; //TODO: weapons, armour, buffs, debuffs, etc. }; diff --git a/client/scenes/in_world.cpp b/client/scenes/in_world.cpp index 4581b1a..bea05c3 100644 --- a/client/scenes/in_world.cpp +++ b/client/scenes/in_world.cpp @@ -138,7 +138,7 @@ void InWorld::Update() { } } - //update the camera + //update the camera (following the player) camera.x = localCharacter->GetOrigin().x - camera.marginX; camera.y = localCharacter->GetOrigin().y - camera.marginY; @@ -179,6 +179,7 @@ void InWorld::Render(SDL_Surface* const screen) { //draw characters for (auto& it : characterMap) { //BUG: #29 drawing order according to Y origin + //TODO: use a list of renderable objects it.second.DrawTo(screen, camera.x, camera.y); } @@ -209,10 +210,10 @@ void InWorld::MouseButtonDown(SDL_MouseButtonEvent const& button) { } void InWorld::MouseButtonUp(SDL_MouseButtonEvent const& button) { - if (disconnectButton.MouseButtonUp(button) == Button::State::HOVER) { + if (disconnectButton.MouseButtonUp(button) == Button::State::HOVER && button.button == SDL_BUTTON_LEFT) { RequestDisconnect(); } - if (shutDownButton.MouseButtonUp(button) == Button::State::HOVER) { + if (shutDownButton.MouseButtonUp(button) == Button::State::HOVER && button.button == SDL_BUTTON_LEFT) { RequestShutDown(); } } @@ -326,7 +327,7 @@ void InWorld::HandlePing(ServerPacket* const argPacket) { void InWorld::HandlePong(ServerPacket* const argPacket) { if (network.GetIPAddress(Channels::SERVER)->host != argPacket->srcAddress.host) { - throw(std::runtime_error("Heartbeat message received from unknown source")); + throw(std::runtime_error("Heartbeat message received from an unknown source")); } attemptedBeats = 0; diff --git a/client/scenes/in_world.hpp b/client/scenes/in_world.hpp index 62904d9..7f2e078 100644 --- a/client/scenes/in_world.hpp +++ b/client/scenes/in_world.hpp @@ -39,6 +39,7 @@ #include "frame_rate.hpp" #include "base_character.hpp" +#include "base_monster.hpp" #include "local_character.hpp" //client @@ -92,12 +93,13 @@ protected: //utilities void UpdateMap(); - //shared parameters + //singleton shortcut UDPNetworkUtility& network = UDPNetworkUtility::GetSingleton(); + + //indexes int& clientIndex; int& accountIndex; int characterIndex = -1; - std::map characterMap; //graphics Image buttonImage; @@ -110,6 +112,7 @@ protected: //UI Button disconnectButton; Button shutDownButton; + FrameRate fps; //the camera structure struct { @@ -117,12 +120,13 @@ protected: int width = 0, height = 0; int marginX = 0, marginY = 0; } camera; - FrameRate fps; - //game + //game components BaseCharacter* localCharacter = nullptr; + std::map characterMap; + std::map monsterMap; - //connections + //heartbeat //TODO: This needs it's own utility, for both InWorld and InCombat typedef std::chrono::steady_clock Clock; Clock::time_point lastBeat = Clock::now(); diff --git a/common/map/region_api.hpp b/common/map/region_api.hpp index 749fb68..babbb4f 100644 --- a/common/map/region_api.hpp +++ b/common/map/region_api.hpp @@ -22,10 +22,10 @@ #ifndef REGIONAPI_HPP_ #define REGIONAPI_HPP_ -#ifdef __unix__ -#include "lua.hpp" +#if defined(__MINGW32__) + #include "lua/lua.hpp" #else -#include "lua/lua.hpp" + #include "lua.hpp" #endif #define TORTUGA_REGION_NAME "Region" diff --git a/common/map/region_pager_api.hpp b/common/map/region_pager_api.hpp index f6cfe8d..b4f8c7b 100644 --- a/common/map/region_pager_api.hpp +++ b/common/map/region_pager_api.hpp @@ -22,10 +22,10 @@ #ifndef REGIONPAGERAPI_HPP_ #define REGIONPAGERAPI_HPP_ -#ifdef __unix__ -#include "lua.hpp" +#if defined(__MINGW32__) + #include "lua/lua.hpp" #else -#include "lua/lua.hpp" + #include "lua.hpp" #endif #define TORTUGA_REGION_PAGER_NAME "RegionPager" diff --git a/common/map/region_pager_lua.hpp b/common/map/region_pager_lua.hpp index 8badec4..d23260f 100644 --- a/common/map/region_pager_lua.hpp +++ b/common/map/region_pager_lua.hpp @@ -24,10 +24,10 @@ #include "region_pager_base.hpp" -#ifdef __unix__ -#include "lua.hpp" +#if defined(__MINGW32__) + #include "lua/lua.hpp" #else -#include "lua/lua.hpp" + #include "lua.hpp" #endif #include diff --git a/common/map/tile_sheet_api.hpp b/common/map/tile_sheet_api.hpp index 33a563f..385a4b2 100644 --- a/common/map/tile_sheet_api.hpp +++ b/common/map/tile_sheet_api.hpp @@ -22,10 +22,10 @@ #ifndef TILESHEETAPI_HPP_ #define TILESHEETAPI_HPP_ -#ifdef __unix__ -#include "lua.hpp" +#if defined(__MINGW32__) + #include "lua/lua.hpp" #else -#include "lua/lua.hpp" + #include "lua.hpp" #endif diff --git a/common/utilities/utility.cpp b/common/utilities/utility.cpp index 5e2c439..6f9e171 100644 --- a/common/utilities/utility.cpp +++ b/common/utilities/utility.cpp @@ -29,10 +29,8 @@ std::string truncatePath(std::string pathname) { pathname.rbegin(), pathname.rend(), [](char ch) -> bool { - //windows only + //windows & unix tested return ch == '/' || ch == '\\'; -// //unix only -// return ch == '/'; }).base(), pathname.end()); } diff --git a/server/accounts/account_manager.hpp b/server/accounts/account_manager.hpp index 7b0839a..9520839 100644 --- a/server/accounts/account_manager.hpp +++ b/server/accounts/account_manager.hpp @@ -26,10 +26,10 @@ #include "singleton.hpp" #include "manager_interface.hpp" -#ifdef __unix__ -#include "sqlite3.h" +#if defined(__MINGW32__) + #include "sqlite3/sqlite3.h" #else -#include "sqlite3/sqlite3.h" + #include "sqlite3.h" #endif #include diff --git a/server/characters/character_manager.cpp b/server/characters/character_manager.cpp index 05aea38..13d7efa 100644 --- a/server/characters/character_manager.cpp +++ b/server/characters/character_manager.cpp @@ -21,10 +21,10 @@ */ #include "character_manager.hpp" -#ifdef __unix__ -#include "sqlite3.h" +#if defined(__MINGW32__) + #include "sqlite3/sqlite3.h" #else -#include "sqlite3/sqlite3.h" + #include "sqlite3.h" #endif #include diff --git a/server/characters/character_manager.hpp b/server/characters/character_manager.hpp index 8e54ede..d8b2b80 100644 --- a/server/characters/character_manager.hpp +++ b/server/characters/character_manager.hpp @@ -26,10 +26,10 @@ #include "singleton.hpp" #include "manager_interface.hpp" -#ifdef __unix__ -#include "sqlite3.h" +#if defined(__MINGW32__) + #include "sqlite3/sqlite3.h" #else -#include "sqlite3/sqlite3.h" + #include "sqlite3.h" #endif #include diff --git a/server/linit.cpp b/server/linit.cpp index f2ffa13..cec8779 100644 --- a/server/linit.cpp +++ b/server/linit.cpp @@ -34,10 +34,10 @@ #define linit_c #define LUA_LIB -#ifdef __unix__ -#include "lua.hpp" +#if defined(__MINGW32__) + #include "lua/lua.hpp" #else -#include "lua/lua.hpp" + #include "lua.hpp" #endif #include "region_api.hpp" diff --git a/server/rooms/room_api.hpp b/server/rooms/room_api.hpp index 553506b..5a1a0c2 100644 --- a/server/rooms/room_api.hpp +++ b/server/rooms/room_api.hpp @@ -22,10 +22,10 @@ #ifndef ROOMAPI_HPP_ #define ROOMAPI_HPP_ -#ifdef __unix__ -#include "lua.hpp" +#if defined(__MINGW32__) + #include "lua/lua.hpp" #else -#include "lua/lua.hpp" + #include "lua.hpp" #endif #define TORTUGA_ROOM_NAME "Room" diff --git a/server/rooms/room_manager.hpp b/server/rooms/room_manager.hpp index 093f902..dc75548 100644 --- a/server/rooms/room_manager.hpp +++ b/server/rooms/room_manager.hpp @@ -26,10 +26,10 @@ #include "singleton.hpp" #include "manager_interface.hpp" -#ifdef __unix__ -#include "lua.hpp" +#if defined(__MINGW32__) + #include "lua/lua.hpp" #else -#include "lua/lua.hpp" + #include "lua.hpp" #endif class RoomManager: diff --git a/server/rooms/room_manager_api.hpp b/server/rooms/room_manager_api.hpp index 7ded134..d8d7b75 100644 --- a/server/rooms/room_manager_api.hpp +++ b/server/rooms/room_manager_api.hpp @@ -22,10 +22,10 @@ #ifndef ROOMMANAGERAPI_HPP_ #define ROOMMANAGERAPI_HPP_ -#ifdef __unix__ -#include "lua.hpp" +#if defined(__MINGW32__) + #include "lua/lua.hpp" #else -#include "lua/lua.hpp" + #include "lua.hpp" #endif #define TORTUGA_ROOM_MANAGER_NAME "RoomManager" diff --git a/server/server_application.hpp b/server/server_application.hpp index afb4f63..ee27742 100644 --- a/server/server_application.hpp +++ b/server/server_application.hpp @@ -35,12 +35,12 @@ #include "singleton.hpp" //APIs -#if __unix__ -#include "lua.hpp" -#include "sqlite3.h" +#if defined(__MINGW32__) + #include "lua/lua.hpp" + #include "sqlite3/sqlite3.h" #else -#include "lua/lua.hpp" -#include "sqlite3/sqlite3.h" + #include "lua.hpp" + #include "sqlite3.h" #endif #include "SDL/SDL.h" diff --git a/server/server_utilities/sql_tools.hpp b/server/server_utilities/sql_tools.hpp index 8251d29..99d0902 100644 --- a/server/server_utilities/sql_tools.hpp +++ b/server/server_utilities/sql_tools.hpp @@ -22,10 +22,10 @@ #ifndef SERVERUTILITY_HPP_ #define SERVERUTILITY_HPP_ -#ifdef __unix__ -#include "sqlite3.h" +#if defined(__MINGW32__) + #include "sqlite3/sqlite3.h" #else -#include "sqlite3/sqlite3.h" + #include "sqlite3.h" #endif #include