Merge commit '0f13956'

* also eliminated ./todo.txt
This commit is contained in:
Kayne Ruse
2014-11-07 00:17:04 +11:00
18 changed files with 62 additions and 55 deletions
+2 -2
View File
@@ -26,8 +26,8 @@
class BaseMonster { class BaseMonster {
public: public:
BaseMonster(); BaseMonster() = default;
virtual ~BaseMonster(); virtual ~BaseMonster() = default;
private: private:
// //
+4
View File
@@ -30,9 +30,13 @@ public:
LocalCharacter() = default; LocalCharacter() = default;
~LocalCharacter() = default; ~LocalCharacter() = default;
int SetRoomIndex(int i) { return roomIndex = i; }
int GetRoomIndex() { return roomIndex; }
Statistics* GetBaseStats() { return &baseStats; } Statistics* GetBaseStats() { return &baseStats; }
private: private:
int roomIndex = -1;
Statistics baseStats; Statistics baseStats;
//TODO: weapons, armour, buffs, debuffs, etc. //TODO: weapons, armour, buffs, debuffs, etc.
}; };
+5 -4
View File
@@ -138,7 +138,7 @@ void InWorld::Update() {
} }
} }
//update the camera //update the camera (following the player)
camera.x = localCharacter->GetOrigin().x - camera.marginX; camera.x = localCharacter->GetOrigin().x - camera.marginX;
camera.y = localCharacter->GetOrigin().y - camera.marginY; camera.y = localCharacter->GetOrigin().y - camera.marginY;
@@ -179,6 +179,7 @@ void InWorld::Render(SDL_Surface* const screen) {
//draw characters //draw characters
for (auto& it : characterMap) { for (auto& it : characterMap) {
//BUG: #29 drawing order according to Y origin //BUG: #29 drawing order according to Y origin
//TODO: use a list of renderable objects
it.second.DrawTo(screen, camera.x, camera.y); 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) { 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(); RequestDisconnect();
} }
if (shutDownButton.MouseButtonUp(button) == Button::State::HOVER) { if (shutDownButton.MouseButtonUp(button) == Button::State::HOVER && button.button == SDL_BUTTON_LEFT) {
RequestShutDown(); RequestShutDown();
} }
} }
@@ -326,7 +327,7 @@ void InWorld::HandlePing(ServerPacket* const argPacket) {
void InWorld::HandlePong(ServerPacket* const argPacket) { void InWorld::HandlePong(ServerPacket* const argPacket) {
if (network.GetIPAddress(Channels::SERVER)->host != argPacket->srcAddress.host) { 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; attemptedBeats = 0;
+9 -5
View File
@@ -39,6 +39,7 @@
#include "frame_rate.hpp" #include "frame_rate.hpp"
#include "base_character.hpp" #include "base_character.hpp"
#include "base_monster.hpp"
#include "local_character.hpp" #include "local_character.hpp"
//client //client
@@ -92,12 +93,13 @@ protected:
//utilities //utilities
void UpdateMap(); void UpdateMap();
//shared parameters //singleton shortcut
UDPNetworkUtility& network = UDPNetworkUtility::GetSingleton(); UDPNetworkUtility& network = UDPNetworkUtility::GetSingleton();
//indexes
int& clientIndex; int& clientIndex;
int& accountIndex; int& accountIndex;
int characterIndex = -1; int characterIndex = -1;
std::map<int, BaseCharacter> characterMap;
//graphics //graphics
Image buttonImage; Image buttonImage;
@@ -110,6 +112,7 @@ protected:
//UI //UI
Button disconnectButton; Button disconnectButton;
Button shutDownButton; Button shutDownButton;
FrameRate fps;
//the camera structure //the camera structure
struct { struct {
@@ -117,12 +120,13 @@ protected:
int width = 0, height = 0; int width = 0, height = 0;
int marginX = 0, marginY = 0; int marginX = 0, marginY = 0;
} camera; } camera;
FrameRate fps;
//game //game components
BaseCharacter* localCharacter = nullptr; BaseCharacter* localCharacter = nullptr;
std::map<int, BaseCharacter> characterMap;
std::map<int, BaseMonster> monsterMap;
//connections //heartbeat
//TODO: This needs it's own utility, for both InWorld and InCombat //TODO: This needs it's own utility, for both InWorld and InCombat
typedef std::chrono::steady_clock Clock; typedef std::chrono::steady_clock Clock;
Clock::time_point lastBeat = Clock::now(); Clock::time_point lastBeat = Clock::now();
+3 -3
View File
@@ -22,10 +22,10 @@
#ifndef REGIONAPI_HPP_ #ifndef REGIONAPI_HPP_
#define REGIONAPI_HPP_ #define REGIONAPI_HPP_
#ifdef __unix__ #if defined(__MINGW32__)
#include "lua.hpp"
#else
#include "lua/lua.hpp" #include "lua/lua.hpp"
#else
#include "lua.hpp"
#endif #endif
#define TORTUGA_REGION_NAME "Region" #define TORTUGA_REGION_NAME "Region"
+3 -3
View File
@@ -22,10 +22,10 @@
#ifndef REGIONPAGERAPI_HPP_ #ifndef REGIONPAGERAPI_HPP_
#define REGIONPAGERAPI_HPP_ #define REGIONPAGERAPI_HPP_
#ifdef __unix__ #if defined(__MINGW32__)
#include "lua.hpp"
#else
#include "lua/lua.hpp" #include "lua/lua.hpp"
#else
#include "lua.hpp"
#endif #endif
#define TORTUGA_REGION_PAGER_NAME "RegionPager" #define TORTUGA_REGION_PAGER_NAME "RegionPager"
+3 -3
View File
@@ -24,10 +24,10 @@
#include "region_pager_base.hpp" #include "region_pager_base.hpp"
#ifdef __unix__ #if defined(__MINGW32__)
#include "lua.hpp"
#else
#include "lua/lua.hpp" #include "lua/lua.hpp"
#else
#include "lua.hpp"
#endif #endif
#include <string> #include <string>
+3 -3
View File
@@ -22,10 +22,10 @@
#ifndef TILESHEETAPI_HPP_ #ifndef TILESHEETAPI_HPP_
#define TILESHEETAPI_HPP_ #define TILESHEETAPI_HPP_
#ifdef __unix__ #if defined(__MINGW32__)
#include "lua.hpp"
#else
#include "lua/lua.hpp" #include "lua/lua.hpp"
#else
#include "lua.hpp"
#endif #endif
+1 -3
View File
@@ -29,10 +29,8 @@ std::string truncatePath(std::string pathname) {
pathname.rbegin(), pathname.rbegin(),
pathname.rend(), pathname.rend(),
[](char ch) -> bool { [](char ch) -> bool {
//windows only //windows & unix tested
return ch == '/' || ch == '\\'; return ch == '/' || ch == '\\';
// //unix only
// return ch == '/';
}).base(), }).base(),
pathname.end()); pathname.end());
} }
+3 -3
View File
@@ -26,10 +26,10 @@
#include "singleton.hpp" #include "singleton.hpp"
#include "manager_interface.hpp" #include "manager_interface.hpp"
#ifdef __unix__ #if defined(__MINGW32__)
#include "sqlite3.h"
#else
#include "sqlite3/sqlite3.h" #include "sqlite3/sqlite3.h"
#else
#include "sqlite3.h"
#endif #endif
#include <functional> #include <functional>
+3 -3
View File
@@ -21,10 +21,10 @@
*/ */
#include "character_manager.hpp" #include "character_manager.hpp"
#ifdef __unix__ #if defined(__MINGW32__)
#include "sqlite3.h"
#else
#include "sqlite3/sqlite3.h" #include "sqlite3/sqlite3.h"
#else
#include "sqlite3.h"
#endif #endif
#include <algorithm> #include <algorithm>
+3 -3
View File
@@ -26,10 +26,10 @@
#include "singleton.hpp" #include "singleton.hpp"
#include "manager_interface.hpp" #include "manager_interface.hpp"
#ifdef __unix__ #if defined(__MINGW32__)
#include "sqlite3.h"
#else
#include "sqlite3/sqlite3.h" #include "sqlite3/sqlite3.h"
#else
#include "sqlite3.h"
#endif #endif
#include <functional> #include <functional>
+3 -3
View File
@@ -34,10 +34,10 @@
#define linit_c #define linit_c
#define LUA_LIB #define LUA_LIB
#ifdef __unix__ #if defined(__MINGW32__)
#include "lua.hpp"
#else
#include "lua/lua.hpp" #include "lua/lua.hpp"
#else
#include "lua.hpp"
#endif #endif
#include "region_api.hpp" #include "region_api.hpp"
+3 -3
View File
@@ -22,10 +22,10 @@
#ifndef ROOMAPI_HPP_ #ifndef ROOMAPI_HPP_
#define ROOMAPI_HPP_ #define ROOMAPI_HPP_
#ifdef __unix__ #if defined(__MINGW32__)
#include "lua.hpp"
#else
#include "lua/lua.hpp" #include "lua/lua.hpp"
#else
#include "lua.hpp"
#endif #endif
#define TORTUGA_ROOM_NAME "Room" #define TORTUGA_ROOM_NAME "Room"
+3 -3
View File
@@ -26,10 +26,10 @@
#include "singleton.hpp" #include "singleton.hpp"
#include "manager_interface.hpp" #include "manager_interface.hpp"
#ifdef __unix__ #if defined(__MINGW32__)
#include "lua.hpp"
#else
#include "lua/lua.hpp" #include "lua/lua.hpp"
#else
#include "lua.hpp"
#endif #endif
class RoomManager: class RoomManager:
+3 -3
View File
@@ -22,10 +22,10 @@
#ifndef ROOMMANAGERAPI_HPP_ #ifndef ROOMMANAGERAPI_HPP_
#define ROOMMANAGERAPI_HPP_ #define ROOMMANAGERAPI_HPP_
#ifdef __unix__ #if defined(__MINGW32__)
#include "lua.hpp"
#else
#include "lua/lua.hpp" #include "lua/lua.hpp"
#else
#include "lua.hpp"
#endif #endif
#define TORTUGA_ROOM_MANAGER_NAME "RoomManager" #define TORTUGA_ROOM_MANAGER_NAME "RoomManager"
+4 -4
View File
@@ -35,12 +35,12 @@
#include "singleton.hpp" #include "singleton.hpp"
//APIs //APIs
#if __unix__ #if defined(__MINGW32__)
#include "lua.hpp"
#include "sqlite3.h"
#else
#include "lua/lua.hpp" #include "lua/lua.hpp"
#include "sqlite3/sqlite3.h" #include "sqlite3/sqlite3.h"
#else
#include "lua.hpp"
#include "sqlite3.h"
#endif #endif
#include "SDL/SDL.h" #include "SDL/SDL.h"
+3 -3
View File
@@ -22,10 +22,10 @@
#ifndef SERVERUTILITY_HPP_ #ifndef SERVERUTILITY_HPP_
#define SERVERUTILITY_HPP_ #define SERVERUTILITY_HPP_
#ifdef __unix__ #if defined(__MINGW32__)
#include "sqlite3.h"
#else
#include "sqlite3/sqlite3.h" #include "sqlite3/sqlite3.h"
#else
#include "sqlite3.h"
#endif #endif
#include <string> #include <string>