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
|
||||
* 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<int>(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) {
|
||||
//
|
||||
}
|
||||
@@ -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 <chrono>
|
||||
|
||||
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<int, CharacterData>* argCharacterMap,
|
||||
std::map<int, EnemyData>* argEnemyMap
|
||||
);
|
||||
~Restart();
|
||||
~CleanUp();
|
||||
|
||||
protected:
|
||||
//Frame loop
|
||||
@@ -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"));
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -35,7 +35,7 @@ enum class SceneList {
|
||||
LOBBYMENU,
|
||||
INWORLD,
|
||||
INCOMBAT,
|
||||
RESTART,
|
||||
CLEANUP,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#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
|
||||
|
||||
void UDPNetworkUtility::Open(int port) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user