From a4d184ca75aac5fcfaca17e87d7ee341f9d21c5b Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 21 Jun 2013 21:36:48 +1000 Subject: [PATCH] Moved random code out of defines.* --- README.md | 3 +- client/character.cpp | 24 ++++++++++++++++ client/character.hpp | 32 ++++++++++++++++++++++ client/in_world.hpp | 1 + client/lobby.hpp | 1 + client/splash_screen.cpp | 2 +- client/splash_screen.hpp | 3 +- libs/common/defines.hpp | 7 ----- libs/common/{defines.cpp => utilities.cpp} | 2 +- libs/common/utilities.hpp | 29 ++++++++++++++++++++ server/server_application.hpp | 5 +++- 11 files changed, 96 insertions(+), 13 deletions(-) create mode 100644 client/character.cpp create mode 100644 client/character.hpp rename libs/common/{defines.cpp => utilities.cpp} (97%) create mode 100644 libs/common/utilities.hpp diff --git a/README.md b/README.md index 188ae07..0c900ba 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ modules Studio 2012. Personally, I'm using MinGW 4.7.2. * I'm trying to keep this as IDE agnostic as possible, so if you use an IDE, please add it's files to .gitignore. -* You can read more details on the GitHub wiki [here](https://github.com/Ratstail91/Tortuga/wiki). +* You can read more details on the Tortuga wiki +[here](https://github.com/Ratstail91/Tortuga/wiki). ## Copyright diff --git a/client/character.cpp b/client/character.cpp new file mode 100644 index 0000000..6fcaf9a --- /dev/null +++ b/client/character.cpp @@ -0,0 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ + #include "character.hpp" + + \ No newline at end of file diff --git a/client/character.hpp b/client/character.hpp new file mode 100644 index 0000000..ade049f --- /dev/null +++ b/client/character.hpp @@ -0,0 +1,32 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ + #ifndef CHARACTER_HPP_ + #define CHARACTER_HPP_ + +class Character { +public: + Character(); + ~Character(); +private: +}; + + #endif diff --git a/client/in_world.hpp b/client/in_world.hpp index 2536173..d363cff 100644 --- a/client/in_world.hpp +++ b/client/in_world.hpp @@ -23,6 +23,7 @@ #define INWORLD_HPP_ #include "base_scene.hpp" +#include "utilities.hpp" #include "defines.hpp" #include "service_locator.hpp" #include "packet_type.hpp" diff --git a/client/lobby.hpp b/client/lobby.hpp index 1af49a3..dfb80bb 100644 --- a/client/lobby.hpp +++ b/client/lobby.hpp @@ -23,6 +23,7 @@ #define LOBBY_HPP_ #include "base_scene.hpp" +#include "utilities.hpp" #include "defines.hpp" #include "service_locator.hpp" #include "packet_type.hpp" diff --git a/client/splash_screen.cpp b/client/splash_screen.cpp index a676b94..0c3efde 100644 --- a/client/splash_screen.cpp +++ b/client/splash_screen.cpp @@ -59,7 +59,7 @@ void SplashScreen::RunFrame(double delta) { LoadResources(); } - if (Clock::now() - start > std::chrono::duration(1)) { + if (std::chrono::steady_clock::now() - start > std::chrono::duration(1)) { SetNextScene(SceneList::MAINMENU); } } diff --git a/client/splash_screen.hpp b/client/splash_screen.hpp index e666634..919c82c 100644 --- a/client/splash_screen.hpp +++ b/client/splash_screen.hpp @@ -23,7 +23,6 @@ #define SPLASHSCREEN_HPP_ #include "base_scene.hpp" -#include "defines.hpp" #include "service_locator.hpp" #include "config_utility.hpp" @@ -48,7 +47,7 @@ protected: ConfigUtility* configUtil = ServiceLocator::Get(); SurfaceManager* surfaceMgr = ServiceLocator::Get(); Image logo; - Clock::time_point start = Clock::now(); + std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now(); }; #endif diff --git a/libs/common/defines.hpp b/libs/common/defines.hpp index 2c47d13..87db2e5 100644 --- a/libs/common/defines.hpp +++ b/libs/common/defines.hpp @@ -22,14 +22,7 @@ #ifndef DEFINES_HPP_ #define DEFINES_HPP -#include -#include - #define GAME_CHANNEL 0 #define CHAT_CHANNEL 1 -typedef std::chrono::high_resolution_clock Clock; - -std::string itos(int i); - #endif diff --git a/libs/common/defines.cpp b/libs/common/utilities.cpp similarity index 97% rename from libs/common/defines.cpp rename to libs/common/utilities.cpp index 72148fc..bd8aed7 100644 --- a/libs/common/defines.cpp +++ b/libs/common/utilities.cpp @@ -19,7 +19,7 @@ * 3. This notice may not be removed or altered from any source * distribution. */ -#include "defines.hpp" +#include "utilities.hpp" #include diff --git a/libs/common/utilities.hpp b/libs/common/utilities.hpp new file mode 100644 index 0000000..fdf4618 --- /dev/null +++ b/libs/common/utilities.hpp @@ -0,0 +1,29 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef UTILITIES_HPP_ +#define UTILITIES_HPP_ + +#include + +std::string itos(int i); + +#endif diff --git a/server/server_application.hpp b/server/server_application.hpp index f3f98c5..1f65ed3 100644 --- a/server/server_application.hpp +++ b/server/server_application.hpp @@ -22,7 +22,7 @@ #ifndef SERVERAPPLICATION_HPP_ #define SERVERAPPLICATION_HPP_ -#include "defines.hpp" +#include "utilities.hpp" #include "packet_type.hpp" #include "service_locator.hpp" #include "network_queue.hpp" @@ -37,6 +37,9 @@ #include #include +//lazy +typedef std::chrono::high_resolution_clock Clock; + struct ClientData { int index; int channel;