From 5c74ecdd722a6c97f12f78e1997750a970db0cbb Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sun, 15 Jun 2014 22:24:50 +1000 Subject: [PATCH] Removed ESC key exit, and tweaked some comments --- README.md | 1 + client/in_combat.cpp | 13 +++---------- client/in_world.cpp | 14 +++----------- client/lobby_menu.cpp | 9 ++++----- client/main_menu.cpp | 6 +----- client/options_menu.cpp | 6 +----- client/restart.cpp | 15 +++++---------- common/gameplay/character_data.hpp | 5 +---- common/gameplay/enemy_data.hpp | 7 +------ common/network/packet/character_packet.hpp | 5 +---- common/network/packet/combat_packet.hpp | 2 +- common/network/packet/enemy_packet.hpp | 7 +------ common/network/serial/serial_character.cpp | 10 ++-------- common/network/serial/serial_combat.cpp | 4 ++-- common/network/serial/serial_enemy.cpp | 14 ++------------ server/character_manager.cpp | 10 ++-------- server/server_application.cpp | 6 ++---- todo.txt | 2 -- 18 files changed, 33 insertions(+), 103 deletions(-) diff --git a/README.md b/README.md index a215a4e..37f8001 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This game is inspired by classic 2D RPGs, as well as more modern sandbox MMOs. T Tortuga's full documentation can be found in a separate branch, see [Tortuga/docs](https://github.com/Ratstail91/Tortuga/tree/docs). For Tortuga's primary documentation, please read the [Tortuga Game Design Document](https://github.com/Ratstail91/Tortuga/blob/docs/Tortuga%20Game%20Design%20Document.docx?raw=true). +For a list of known bugs, see the [GitHub bug tracker](https://github.com/Ratstail91/Tortuga/issues). ## External Dependencies diff --git a/client/in_combat.cpp b/client/in_combat.cpp index 24b85e9..132a4fe 100644 --- a/client/in_combat.cpp +++ b/client/in_combat.cpp @@ -123,7 +123,7 @@ void InCombat::Render(SDL_Surface* const screen) { void InCombat::QuitEvent() { //exit the game AND the server RequestDisconnect(); - SetNextScene(SceneList::MAINMENU); + SetNextScene(SceneList::QUIT); } void InCombat::MouseMotion(SDL_MouseMotionEvent const& motion) { @@ -139,11 +139,7 @@ void InCombat::MouseButtonUp(SDL_MouseButtonEvent const& button) { } void InCombat::KeyDown(SDL_KeyboardEvent const& key) { - switch(key.keysym.sym) { - case SDLK_ESCAPE: - QuitEvent(); - break; - } + // } void InCombat::KeyUp(SDL_KeyboardEvent const& key) { @@ -201,10 +197,7 @@ void InCombat::SendPlayerUpdate() { // newPacket.motion = localCharacter->motion; // newPacket.stats = localCharacter->stats; - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs + //TODO: gameplay components: equipment, items, buffs, debuffs network.SendTo(Channels::SERVER, &newPacket); } diff --git a/client/in_world.cpp b/client/in_world.cpp index abd311e..812521b 100644 --- a/client/in_world.cpp +++ b/client/in_world.cpp @@ -135,7 +135,7 @@ void InWorld::Render(SDL_Surface* const screen) { //draw characters for (auto& it : characterMap) { - //TODO: drawing order according to Y origin + //BUG: #29 drawing order according to Y origin it.second.DrawTo(screen, camera.x, camera.y); } @@ -152,7 +152,7 @@ void InWorld::Render(SDL_Surface* const screen) { void InWorld::QuitEvent() { //exit the game AND the server RequestDisconnect(); - SetNextScene(SceneList::MAINMENU); + SetNextScene(SceneList::QUIT); } void InWorld::MouseMotion(SDL_MouseMotionEvent const& motion) { @@ -176,11 +176,6 @@ void InWorld::MouseButtonUp(SDL_MouseButtonEvent const& button) { void InWorld::KeyDown(SDL_KeyboardEvent const& key) { switch(key.keysym.sym) { - case SDLK_ESCAPE: { - QuitEvent(); - } - break; - //player movement case SDLK_LEFT: if (localCharacter) { @@ -386,10 +381,7 @@ void InWorld::SendPlayerUpdate() { newPacket.motion = localCharacter->motion; newPacket.stats = localCharacter->stats; - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs + //TODO: gameplay components: equipment, items, buffs, debuffs network.SendTo(Channels::SERVER, &newPacket); } diff --git a/client/lobby_menu.cpp b/client/lobby_menu.cpp index 8cbf55a..6976c8b 100644 --- a/client/lobby_menu.cpp +++ b/client/lobby_menu.cpp @@ -69,6 +69,9 @@ LobbyMenu::LobbyMenu( //set the server list's position listBox = {300, 50, 200, font.GetCharH()}; + + //BUGFIX: Eat incoming packets + while(network.Receive()); } LobbyMenu::~LobbyMenu() { @@ -187,11 +190,7 @@ void LobbyMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) { } void LobbyMenu::KeyDown(SDL_KeyboardEvent const& key) { - switch(key.keysym.sym) { - case SDLK_ESCAPE: - SetNextScene(SceneList::MAINMENU); - break; - } + // } void LobbyMenu::KeyUp(SDL_KeyboardEvent const& key) { diff --git a/client/main_menu.cpp b/client/main_menu.cpp index 457bd12..735e2fb 100644 --- a/client/main_menu.cpp +++ b/client/main_menu.cpp @@ -113,11 +113,7 @@ void MainMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) { } void MainMenu::KeyDown(SDL_KeyboardEvent const& key) { - switch(key.keysym.sym) { - case SDLK_ESCAPE: - QuitEvent(); - break; - } + // } void MainMenu::KeyUp(SDL_KeyboardEvent const& key) { diff --git a/client/options_menu.cpp b/client/options_menu.cpp index bc8290c..19b3b9e 100644 --- a/client/options_menu.cpp +++ b/client/options_menu.cpp @@ -90,11 +90,7 @@ void OptionsMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) { } void OptionsMenu::KeyDown(SDL_KeyboardEvent const& key) { - switch(key.keysym.sym) { - case SDLK_ESCAPE: - SetNextScene(SceneList::MAINMENU); - break; - } + // } void OptionsMenu::KeyUp(SDL_KeyboardEvent const& key) { diff --git a/client/restart.cpp b/client/restart.cpp index 66377c1..636a7f7 100644 --- a/client/restart.cpp +++ b/client/restart.cpp @@ -90,9 +90,8 @@ void Restart::Update(double delta) { QuitEvent(); } - while(network.Receive()) { - //EAT INCOMING PACKETS - } + //BUGFIX: Eat incoming packets + while(network.Receive()); } void Restart::RenderFrame() { @@ -112,7 +111,7 @@ void Restart::Render(SDL_Surface* const screen) { //------------------------- void Restart::QuitEvent() { - SetNextScene(SceneList::MAINMENU); + SetNextScene(SceneList::QUIT); } void Restart::MouseMotion(SDL_MouseMotionEvent const& motion) { @@ -125,16 +124,12 @@ void Restart::MouseButtonDown(SDL_MouseButtonEvent const& button) { void Restart::MouseButtonUp(SDL_MouseButtonEvent const& button) { if (backButton.MouseButtonUp(button) == Button::State::HOVER) { - QuitEvent(); + SetNextScene(SceneList::MAINMENU); } } void Restart::KeyDown(SDL_KeyboardEvent const& key) { - switch(key.keysym.sym) { - case SDLK_ESCAPE: - QuitEvent(); - break; - } + // } void Restart::KeyUp(SDL_KeyboardEvent const& key) { diff --git a/common/gameplay/character_data.hpp b/common/gameplay/character_data.hpp index 361788b..46452b4 100644 --- a/common/gameplay/character_data.hpp +++ b/common/gameplay/character_data.hpp @@ -53,10 +53,7 @@ struct CharacterData { //base statistics Statistics stats; - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs + //TODO: gameplay components: equipment, items, buffs, debuffs //methods void Update(double delta); diff --git a/common/gameplay/enemy_data.hpp b/common/gameplay/enemy_data.hpp index 9fd96e2..533add6 100644 --- a/common/gameplay/enemy_data.hpp +++ b/common/gameplay/enemy_data.hpp @@ -41,12 +41,7 @@ struct EnemyData { //gameplay Statistics stats; - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs - - //TODO: rewards + //TODO: gameplay components: equipment, items, buffs, debuffs, rewards //active gameplay members //NOTE: these are lost when unloaded diff --git a/common/network/packet/character_packet.hpp b/common/network/packet/character_packet.hpp index 3b44d9b..b6042f3 100644 --- a/common/network/packet/character_packet.hpp +++ b/common/network/packet/character_packet.hpp @@ -44,10 +44,7 @@ struct CharacterPacket : SerialPacketBase { //gameplay Statistics stats; - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs + //TODO: gameplay components: equipment, items, buffs, debuffs }; #endif \ No newline at end of file diff --git a/common/network/packet/combat_packet.hpp b/common/network/packet/combat_packet.hpp index a95ca25..ea27e8f 100644 --- a/common/network/packet/combat_packet.hpp +++ b/common/network/packet/combat_packet.hpp @@ -40,7 +40,7 @@ struct CombatPacket : SerialPacketBase { int mapIndex; Vector2 origin; - //TODO: rewards + //TODO: gameplay components: rewards }; #endif \ No newline at end of file diff --git a/common/network/packet/enemy_packet.hpp b/common/network/packet/enemy_packet.hpp index 4a3d343..d3fb7c5 100644 --- a/common/network/packet/enemy_packet.hpp +++ b/common/network/packet/enemy_packet.hpp @@ -33,12 +33,7 @@ struct EnemyPacket : SerialPacketBase { //gameplay Statistics stats; - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs - - //TODO: rewards + //TODO: gameplay components: equipment, items, buffs, debuffs, rewards }; #endif \ No newline at end of file diff --git a/common/network/serial/serial_character.cpp b/common/network/serial/serial_character.cpp index 3805702..2754f56 100644 --- a/common/network/serial/serial_character.cpp +++ b/common/network/serial/serial_character.cpp @@ -45,10 +45,7 @@ void serializeCharacter(CharacterPacket* packet, void* buffer) { serializeStatistics(&packet->stats, buffer); buffer = reinterpret_cast(buffer) + sizeof(Statistics); - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs + //TODO: gameplay components: equipment, items, buffs, debuffs } void deserializeCharacter(CharacterPacket* packet, void* buffer) { @@ -73,8 +70,5 @@ void deserializeCharacter(CharacterPacket* packet, void* buffer) { deserializeStatistics(&packet->stats, buffer); buffer = reinterpret_cast(buffer) + sizeof(Statistics); - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs + //TODO: gameplay components: equipment, items, buffs, debuffs } diff --git a/common/network/serial/serial_combat.cpp b/common/network/serial/serial_combat.cpp index 881db97..268d580 100644 --- a/common/network/serial/serial_combat.cpp +++ b/common/network/serial/serial_combat.cpp @@ -40,7 +40,7 @@ void serializeCombat(CombatPacket* packet, void* buffer) { SERIALIZE(buffer, &packet->origin.x, sizeof(double)); SERIALIZE(buffer, &packet->origin.y, sizeof(double)); - //TODO: rewards + //TODO: gameplay components: rewards } void deserializeCombat(CombatPacket* packet, void* buffer) { @@ -60,5 +60,5 @@ void deserializeCombat(CombatPacket* packet, void* buffer) { DESERIALIZE(buffer, &packet->origin.x, sizeof(double)); DESERIALIZE(buffer, &packet->origin.y, sizeof(double)); - //TODO: rewards + //TODO: gameplay components: rewards } diff --git a/common/network/serial/serial_enemy.cpp b/common/network/serial/serial_enemy.cpp index 363ca1f..4861d83 100644 --- a/common/network/serial/serial_enemy.cpp +++ b/common/network/serial/serial_enemy.cpp @@ -37,12 +37,7 @@ void serializeEnemy(EnemyPacket* packet, void* buffer) { serializeStatistics(&packet->stats, buffer); buffer = reinterpret_cast(buffer) + sizeof(Statistics); - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs - - //TODO: rewards + //TODO: gameplay components: equipment, items, buffs, debuffs, rewards } void deserializeEnemy(EnemyPacket* packet, void* buffer) { @@ -57,10 +52,5 @@ void deserializeEnemy(EnemyPacket* packet, void* buffer) { deserializeStatistics(&packet->stats, buffer); buffer = reinterpret_cast(buffer) + sizeof(Statistics); - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs - - //TODO: rewards + //TODO: gameplay components: equipment, items, buffs, debuffs, rewards } diff --git a/server/character_manager.cpp b/server/character_manager.cpp index 21eb99a..0fdd2c0 100644 --- a/server/character_manager.cpp +++ b/server/character_manager.cpp @@ -157,10 +157,7 @@ int CharacterManager::LoadCharacter(int owner, std::string handle, std::string a newChar.stats.evasion = sqlite3_column_double(statement, 20); newChar.stats.luck = sqlite3_column_double(statement, 21); - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs + //TODO: gameplay components: equipment, items, buffs, debuffs //finish the routine sqlite3_finalize(statement); @@ -217,10 +214,7 @@ int CharacterManager::SaveCharacter(int uid) { ret |= sqlite3_bind_double(statement, 17, character.stats.evasion) != SQLITE_OK; ret |= sqlite3_bind_double(statement, 18, character.stats.luck) != SQLITE_OK; - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs + //TODO: gameplay components: equipment, items, buffs, debuffs //check for binding errors if (ret) { diff --git a/server/server_application.cpp b/server/server_application.cpp index 4bc1644..c60da3b 100644 --- a/server/server_application.cpp +++ b/server/server_application.cpp @@ -338,6 +338,7 @@ void ServerApplication::HandleRegionRequest(RegionPacket* const argPacket) { //------------------------- void ServerApplication::HandleCharacterNew(CharacterPacket* const argPacket) { + //BUG: #27 Characters can be created with an invalid account index //NOTE: misnomer, try to load the character first int characterIndex = characterMgr.LoadCharacter(argPacket->accountIndex, argPacket->handle, argPacket->avatar); @@ -413,10 +414,7 @@ void ServerApplication::HandleCharacterUpdate(CharacterPacket* const argPacket) character->stats = argPacket->stats; - //TODO: equipment - //TODO: items - //TODO: buffs - //TODO: debuffs + //TODO: gameplay components: equipment, items, buffs, debuffs PumpPacket(argPacket); } diff --git a/todo.txt b/todo.txt index d9279d1..72cf445 100644 --- a/todo.txt +++ b/todo.txt @@ -2,11 +2,9 @@ TODO: rename restart scene to cleanup scene TODO: encapsulate the data structures TODO: Get the rooms working -TODO: Rejection packets TODO: Authentication TODO: server is slaved to the client -TODO: I need to keep the documentation up to date. Namely, the GDD is getting out of date. TODO: I completely forgot about status ailments TODO: Time delay for requesting region packets TODO: command line parameters overriding config.cfg settings