diff --git a/client/restart.cpp b/client/clean_up.cpp similarity index 85% rename from client/restart.cpp rename to client/clean_up.cpp index 636a7f7..f504e16 100644 --- a/client/restart.cpp +++ b/client/clean_up.cpp @@ -19,7 +19,7 @@ * 3. This notice may not be removed or altered from any source * distribution. */ -#include "restart.hpp" +#include "clean_up.hpp" #include "channels.hpp" @@ -29,7 +29,7 @@ //Public access members //------------------------- -Restart::Restart( +CleanUp::CleanUp( ConfigUtility* const argConfig, UDPNetworkUtility* const argNetwork, int* const argClientIndex, @@ -77,7 +77,7 @@ Restart::Restart( startTick = std::chrono::steady_clock::now(); } -Restart::~Restart() { +CleanUp::~CleanUp() { // } @@ -85,7 +85,7 @@ Restart::~Restart() { //Frame loop //------------------------- -void Restart::Update(double delta) { +void CleanUp::Update(double delta) { if (std::chrono::steady_clock::now() - startTick > std::chrono::duration(10)) { QuitEvent(); } @@ -94,14 +94,14 @@ void Restart::Update(double delta) { while(network.Receive()); } -void Restart::RenderFrame() { +void CleanUp::RenderFrame() { SDL_FillRect(GetScreen(), 0, 0); Render(GetScreen()); SDL_Flip(GetScreen()); fps.Calculate(); } -void Restart::Render(SDL_Surface* const screen) { +void CleanUp::Render(SDL_Surface* const screen) { backButton.DrawTo(screen); font.DrawStringTo("You have been disconnected.", screen, 50, 30); } @@ -110,28 +110,28 @@ void Restart::Render(SDL_Surface* const screen) { //Event handlers //------------------------- -void Restart::QuitEvent() { +void CleanUp::QuitEvent() { SetNextScene(SceneList::QUIT); } -void Restart::MouseMotion(SDL_MouseMotionEvent const& motion) { +void CleanUp::MouseMotion(SDL_MouseMotionEvent const& motion) { backButton.MouseMotion(motion); } -void Restart::MouseButtonDown(SDL_MouseButtonEvent const& button) { +void CleanUp::MouseButtonDown(SDL_MouseButtonEvent const& button) { backButton.MouseButtonDown(button); } -void Restart::MouseButtonUp(SDL_MouseButtonEvent const& button) { +void CleanUp::MouseButtonUp(SDL_MouseButtonEvent const& button) { if (backButton.MouseButtonUp(button) == Button::State::HOVER) { SetNextScene(SceneList::MAINMENU); } } -void Restart::KeyDown(SDL_KeyboardEvent const& key) { +void CleanUp::KeyDown(SDL_KeyboardEvent const& key) { // } -void Restart::KeyUp(SDL_KeyboardEvent const& key) { +void CleanUp::KeyUp(SDL_KeyboardEvent const& key) { // } diff --git a/client/restart.hpp b/client/clean_up.hpp similarity index 95% rename from client/restart.hpp rename to client/clean_up.hpp index 4012a80..5618cc7 100644 --- a/client/restart.hpp +++ b/client/clean_up.hpp @@ -19,8 +19,8 @@ * 3. This notice may not be removed or altered from any source * distribution. */ -#ifndef RESTART_HPP_ -#define RESTART_HPP_ +#ifndef CLEANUP_HPP_ +#define CLEANUP_HPP_ //network #include "udp_network_utility.hpp" @@ -44,10 +44,10 @@ //std namespace #include -class Restart : public BaseScene { +class CleanUp : public BaseScene { public: //Public access members - Restart( + CleanUp( ConfigUtility* const argConfig, UDPNetworkUtility* const argNetwork, int* const argClientIndex, @@ -57,7 +57,7 @@ public: std::map* argCharacterMap, std::map* argEnemyMap ); - ~Restart(); + ~CleanUp(); protected: //Frame loop diff --git a/client/client_application.cpp b/client/client_application.cpp index d3ce86c..06f0bc6 100644 --- a/client/client_application.cpp +++ b/client/client_application.cpp @@ -37,7 +37,7 @@ #include "lobby_menu.hpp" #include "in_world.hpp" #include "in_combat.hpp" -#include "restart.hpp" +#include "clean_up.hpp" //------------------------- //Public access members @@ -132,8 +132,8 @@ void ClientApplication::LoadScene(SceneList sceneIndex) { case SceneList::INCOMBAT: activeScene = new InCombat(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap); break; - case SceneList::RESTART: - activeScene = new Restart(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap); + case SceneList::CLEANUP: + activeScene = new CleanUp(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap); break; default: throw(std::logic_error("Failed to recognize the scene index")); diff --git a/client/in_combat.cpp b/client/in_combat.cpp index 132a4fe..3d8b2f3 100644 --- a/client/in_combat.cpp +++ b/client/in_combat.cpp @@ -163,7 +163,7 @@ void InCombat::HandlePacket(SerialPacket* const argPacket) { } void InCombat::HandleDisconnect(SerialPacket* const) { - SetNextScene(SceneList::RESTART); + SetNextScene(SceneList::CLEANUP); } //TODO: more network handlers diff --git a/client/in_world.cpp b/client/in_world.cpp index 812521b..4557a9b 100644 --- a/client/in_world.cpp +++ b/client/in_world.cpp @@ -277,7 +277,7 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) { } void InWorld::HandleDisconnect(SerialPacket* const argPacket) { - SetNextScene(SceneList::RESTART); + SetNextScene(SceneList::CLEANUP); } void InWorld::HandleCharacterNew(CharacterPacket* const argPacket) { diff --git a/client/lobby_menu.cpp b/client/lobby_menu.cpp index 6976c8b..f4b5e32 100644 --- a/client/lobby_menu.cpp +++ b/client/lobby_menu.cpp @@ -224,7 +224,7 @@ void LobbyMenu::HandleBroadcastResponse(ServerPacket* const argPacket) { server.playerCount = argPacket->playerCount; server.version = argPacket->version; - //NOTE: Check compatibility here + //Checking compatibility server.compatible = server.version == NETWORK_VERSION; //push diff --git a/client/scene_list.hpp b/client/scene_list.hpp index 79d396c..804b9c9 100644 --- a/client/scene_list.hpp +++ b/client/scene_list.hpp @@ -35,7 +35,7 @@ enum class SceneList { LOBBYMENU, INWORLD, INCOMBAT, - RESTART, + CLEANUP, }; #endif diff --git a/common/network/serial/serial.cpp b/common/network/serial/serial.cpp index 791da27..45c9c32 100644 --- a/common/network/serial/serial.cpp +++ b/common/network/serial/serial.cpp @@ -148,7 +148,6 @@ void deserializePacket(SerialPacketBase* packet, void* buffer) { case SerialPacketType::COMBAT_DELETE: case SerialPacketType::COMBAT_UPDATE: - //TODO: is this the best fit? case SerialPacketType::COMBAT_ENTER_REQUEST: case SerialPacketType::COMBAT_ENTER_RESPONSE: case SerialPacketType::COMBAT_EXIT_REQUEST: diff --git a/common/network/udp_network_utility.cpp b/common/network/udp_network_utility.cpp index 275c1c8..ad97a1c 100644 --- a/common/network/udp_network_utility.cpp +++ b/common/network/udp_network_utility.cpp @@ -25,7 +25,7 @@ #include -//DOCS: memset() is used before sending a packet to remove old data; you don't want to send sensitive data over the network +//BUGFIX: memset() is used before sending a packet to remove old data; you don't want to send sensitive data over the network //NOTE: don't confuse SerialPacket with UDPpacket void UDPNetworkUtility::Open(int port) { diff --git a/server/character_manager.cpp b/server/character_manager.cpp index 0fdd2c0..bfc070c 100644 --- a/server/character_manager.cpp +++ b/server/character_manager.cpp @@ -58,7 +58,7 @@ static const char* DELETE_CHARACTER = "DELETE FROM Characters WHERE uid = ?;"; //Define the methods //------------------------- -//TODO: default stats as a parameter? This would be good for differing beggining states or multiple classes +//NOTE: default stats as a parameter would be good for different beggining states or multiple classes int CharacterManager::CreateCharacter(int owner, std::string handle, std::string avatar) { //Create the character, failing if it exists sqlite3_stmt* statement = nullptr; diff --git a/todo.txt b/todo.txt index 72cf445..78b1506 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,3 @@ -TODO: rename restart scene to cleanup scene TODO: encapsulate the data structures TODO: Get the rooms working