Renamed the Restart scene to CleanUp
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
*/
|
*/
|
||||||
#include "restart.hpp"
|
#include "clean_up.hpp"
|
||||||
|
|
||||||
#include "channels.hpp"
|
#include "channels.hpp"
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
//Public access members
|
//Public access members
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
Restart::Restart(
|
CleanUp::CleanUp(
|
||||||
ConfigUtility* const argConfig,
|
ConfigUtility* const argConfig,
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
@@ -77,7 +77,7 @@ Restart::Restart(
|
|||||||
startTick = std::chrono::steady_clock::now();
|
startTick = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
Restart::~Restart() {
|
CleanUp::~CleanUp() {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ Restart::~Restart() {
|
|||||||
//Frame loop
|
//Frame loop
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
void Restart::Update(double delta) {
|
void CleanUp::Update(double delta) {
|
||||||
if (std::chrono::steady_clock::now() - startTick > std::chrono::duration<int>(10)) {
|
if (std::chrono::steady_clock::now() - startTick > std::chrono::duration<int>(10)) {
|
||||||
QuitEvent();
|
QuitEvent();
|
||||||
}
|
}
|
||||||
@@ -94,14 +94,14 @@ void Restart::Update(double delta) {
|
|||||||
while(network.Receive());
|
while(network.Receive());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::RenderFrame() {
|
void CleanUp::RenderFrame() {
|
||||||
SDL_FillRect(GetScreen(), 0, 0);
|
SDL_FillRect(GetScreen(), 0, 0);
|
||||||
Render(GetScreen());
|
Render(GetScreen());
|
||||||
SDL_Flip(GetScreen());
|
SDL_Flip(GetScreen());
|
||||||
fps.Calculate();
|
fps.Calculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::Render(SDL_Surface* const screen) {
|
void CleanUp::Render(SDL_Surface* const screen) {
|
||||||
backButton.DrawTo(screen);
|
backButton.DrawTo(screen);
|
||||||
font.DrawStringTo("You have been disconnected.", screen, 50, 30);
|
font.DrawStringTo("You have been disconnected.", screen, 50, 30);
|
||||||
}
|
}
|
||||||
@@ -110,28 +110,28 @@ void Restart::Render(SDL_Surface* const screen) {
|
|||||||
//Event handlers
|
//Event handlers
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
void Restart::QuitEvent() {
|
void CleanUp::QuitEvent() {
|
||||||
SetNextScene(SceneList::QUIT);
|
SetNextScene(SceneList::QUIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
void CleanUp::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||||
backButton.MouseMotion(motion);
|
backButton.MouseMotion(motion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::MouseButtonDown(SDL_MouseButtonEvent const& button) {
|
void CleanUp::MouseButtonDown(SDL_MouseButtonEvent const& button) {
|
||||||
backButton.MouseButtonDown(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) {
|
if (backButton.MouseButtonUp(button) == Button::State::HOVER) {
|
||||||
SetNextScene(SceneList::MAINMENU);
|
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) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
*/
|
*/
|
||||||
#ifndef RESTART_HPP_
|
#ifndef CLEANUP_HPP_
|
||||||
#define RESTART_HPP_
|
#define CLEANUP_HPP_
|
||||||
|
|
||||||
//network
|
//network
|
||||||
#include "udp_network_utility.hpp"
|
#include "udp_network_utility.hpp"
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
//std namespace
|
//std namespace
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
class Restart : public BaseScene {
|
class CleanUp : public BaseScene {
|
||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
Restart(
|
CleanUp(
|
||||||
ConfigUtility* const argConfig,
|
ConfigUtility* const argConfig,
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
std::map<int, CharacterData>* argCharacterMap,
|
std::map<int, CharacterData>* argCharacterMap,
|
||||||
std::map<int, EnemyData>* argEnemyMap
|
std::map<int, EnemyData>* argEnemyMap
|
||||||
);
|
);
|
||||||
~Restart();
|
~CleanUp();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//Frame loop
|
//Frame loop
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "lobby_menu.hpp"
|
#include "lobby_menu.hpp"
|
||||||
#include "in_world.hpp"
|
#include "in_world.hpp"
|
||||||
#include "in_combat.hpp"
|
#include "in_combat.hpp"
|
||||||
#include "restart.hpp"
|
#include "clean_up.hpp"
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
//Public access members
|
//Public access members
|
||||||
@@ -132,8 +132,8 @@ void ClientApplication::LoadScene(SceneList sceneIndex) {
|
|||||||
case SceneList::INCOMBAT:
|
case SceneList::INCOMBAT:
|
||||||
activeScene = new InCombat(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
|
activeScene = new InCombat(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
|
||||||
break;
|
break;
|
||||||
case SceneList::RESTART:
|
case SceneList::CLEANUP:
|
||||||
activeScene = new Restart(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
|
activeScene = new CleanUp(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw(std::logic_error("Failed to recognize the scene index"));
|
throw(std::logic_error("Failed to recognize the scene index"));
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ void InCombat::HandlePacket(SerialPacket* const argPacket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InCombat::HandleDisconnect(SerialPacket* const) {
|
void InCombat::HandleDisconnect(SerialPacket* const) {
|
||||||
SetNextScene(SceneList::RESTART);
|
SetNextScene(SceneList::CLEANUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: more network handlers
|
//TODO: more network handlers
|
||||||
|
|||||||
+1
-1
@@ -277,7 +277,7 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InWorld::HandleDisconnect(SerialPacket* const argPacket) {
|
void InWorld::HandleDisconnect(SerialPacket* const argPacket) {
|
||||||
SetNextScene(SceneList::RESTART);
|
SetNextScene(SceneList::CLEANUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InWorld::HandleCharacterNew(CharacterPacket* const argPacket) {
|
void InWorld::HandleCharacterNew(CharacterPacket* const argPacket) {
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ void LobbyMenu::HandleBroadcastResponse(ServerPacket* const argPacket) {
|
|||||||
server.playerCount = argPacket->playerCount;
|
server.playerCount = argPacket->playerCount;
|
||||||
server.version = argPacket->version;
|
server.version = argPacket->version;
|
||||||
|
|
||||||
//NOTE: Check compatibility here
|
//Checking compatibility
|
||||||
server.compatible = server.version == NETWORK_VERSION;
|
server.compatible = server.version == NETWORK_VERSION;
|
||||||
|
|
||||||
//push
|
//push
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ enum class SceneList {
|
|||||||
LOBBYMENU,
|
LOBBYMENU,
|
||||||
INWORLD,
|
INWORLD,
|
||||||
INCOMBAT,
|
INCOMBAT,
|
||||||
RESTART,
|
CLEANUP,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ void deserializePacket(SerialPacketBase* packet, void* buffer) {
|
|||||||
case SerialPacketType::COMBAT_DELETE:
|
case SerialPacketType::COMBAT_DELETE:
|
||||||
case SerialPacketType::COMBAT_UPDATE:
|
case SerialPacketType::COMBAT_UPDATE:
|
||||||
|
|
||||||
//TODO: is this the best fit?
|
|
||||||
case SerialPacketType::COMBAT_ENTER_REQUEST:
|
case SerialPacketType::COMBAT_ENTER_REQUEST:
|
||||||
case SerialPacketType::COMBAT_ENTER_RESPONSE:
|
case SerialPacketType::COMBAT_ENTER_RESPONSE:
|
||||||
case SerialPacketType::COMBAT_EXIT_REQUEST:
|
case SerialPacketType::COMBAT_EXIT_REQUEST:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
//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
|
//NOTE: don't confuse SerialPacket with UDPpacket
|
||||||
|
|
||||||
void UDPNetworkUtility::Open(int port) {
|
void UDPNetworkUtility::Open(int port) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ static const char* DELETE_CHARACTER = "DELETE FROM Characters WHERE uid = ?;";
|
|||||||
//Define the methods
|
//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) {
|
int CharacterManager::CreateCharacter(int owner, std::string handle, std::string avatar) {
|
||||||
//Create the character, failing if it exists
|
//Create the character, failing if it exists
|
||||||
sqlite3_stmt* statement = nullptr;
|
sqlite3_stmt* statement = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user