UDPNetworkUtility is a singleton, disabled InCombat scene
I found incombat to be way too finicky to keep up to date, so I disabled it for now.
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
#include "options_menu.hpp"
|
||||
#include "lobby_menu.hpp"
|
||||
#include "in_world.hpp"
|
||||
#include "in_combat.hpp"
|
||||
//#include "in_combat.hpp"
|
||||
#include "clean_up.hpp"
|
||||
|
||||
//-------------------------
|
||||
@@ -66,7 +66,7 @@ void ClientApplication::Init(int argc, char** argv) {
|
||||
if (SDLNet_Init()) {
|
||||
throw(std::runtime_error("Failed to initialize SDL_net"));
|
||||
}
|
||||
network.Open(0);
|
||||
UDPNetworkUtility::GetSingleton().Open(0);
|
||||
std::cout << "Initialized SDL_net" << std::endl;
|
||||
|
||||
//-------------------------
|
||||
@@ -151,7 +151,7 @@ void ClientApplication::Proc() {
|
||||
|
||||
void ClientApplication::Quit() {
|
||||
std::cout << "Shutting down" << std::endl;
|
||||
network.Close();
|
||||
UDPNetworkUtility::GetSingleton().Close();
|
||||
SDLNet_Quit();
|
||||
SDL_Quit();
|
||||
std::cout << "Clean exit" << std::endl;
|
||||
@@ -176,16 +176,16 @@ void ClientApplication::LoadScene(SceneList sceneIndex) {
|
||||
activeScene = new OptionsMenu();
|
||||
break;
|
||||
case SceneList::LOBBYMENU:
|
||||
activeScene = new LobbyMenu(&network, &clientIndex, &accountIndex);
|
||||
activeScene = new LobbyMenu(&clientIndex, &accountIndex);
|
||||
break;
|
||||
case SceneList::INWORLD:
|
||||
activeScene = new InWorld(&network, &clientIndex, &accountIndex, &characterIndex, &characterMap);
|
||||
break;
|
||||
case SceneList::INCOMBAT:
|
||||
activeScene = new InCombat(&network, &clientIndex, &accountIndex, &characterIndex, &characterMap);
|
||||
activeScene = new InWorld(&clientIndex, &accountIndex, &characterIndex, &characterMap);
|
||||
break;
|
||||
// case SceneList::INCOMBAT:
|
||||
// activeScene = new InCombat(&clientIndex, &accountIndex, &characterIndex, &characterMap);
|
||||
// break;
|
||||
case SceneList::CLEANUP:
|
||||
activeScene = new CleanUp(&network, &clientIndex, &accountIndex, &characterIndex, &characterMap);
|
||||
activeScene = new CleanUp(&clientIndex, &accountIndex, &characterIndex, &characterMap);
|
||||
break;
|
||||
default:
|
||||
throw(std::logic_error("Failed to recognize the scene index"));
|
||||
|
||||
@@ -52,7 +52,6 @@ private:
|
||||
BaseScene* activeScene = nullptr;
|
||||
|
||||
//shared parameters
|
||||
UDPNetworkUtility network;
|
||||
int clientIndex = -1;
|
||||
int accountIndex = -1;
|
||||
int characterIndex = -1;
|
||||
|
||||
+7
-2
@@ -23,6 +23,7 @@
|
||||
|
||||
//singletons
|
||||
#include "config_utility.hpp"
|
||||
#include "udp_network_utility.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
@@ -32,18 +33,22 @@ using namespace std;
|
||||
int main(int argc, char** argv) {
|
||||
try {
|
||||
//create the singletons
|
||||
ClientApplication::Create();
|
||||
ConfigUtility::Create();
|
||||
UDPNetworkUtility::Create();
|
||||
|
||||
//call the server's routines
|
||||
ClientApplication::Create();
|
||||
ClientApplication& app = ClientApplication::GetSingleton();
|
||||
|
||||
app.Init(argc, argv);
|
||||
app.Proc();
|
||||
app.Quit();
|
||||
|
||||
ClientApplication::Delete();
|
||||
|
||||
//delete the singletons
|
||||
ConfigUtility::Delete();
|
||||
ClientApplication::Delete();
|
||||
UDPNetworkUtility::Delete();
|
||||
}
|
||||
catch(exception& e) {
|
||||
cerr << "Fatal exception thrown: " << e.what() << endl;
|
||||
|
||||
@@ -31,13 +31,11 @@
|
||||
//-------------------------
|
||||
|
||||
CleanUp::CleanUp(
|
||||
UDPNetworkUtility* const argNetwork,
|
||||
int* const argClientIndex,
|
||||
int* const argAccountIndex,
|
||||
int* const argCharacterIndex,
|
||||
CharacterMap* argCharacterMap
|
||||
):
|
||||
network(*argNetwork),
|
||||
clientIndex(*argClientIndex),
|
||||
accountIndex(*argAccountIndex),
|
||||
characterIndex(*argCharacterIndex),
|
||||
|
||||
@@ -45,7 +45,6 @@ class CleanUp : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
CleanUp(
|
||||
UDPNetworkUtility* const argNetwork,
|
||||
int* const argClientIndex,
|
||||
int* const argAccountIndex,
|
||||
int* const argCharacterIndex,
|
||||
@@ -68,7 +67,7 @@ protected:
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
|
||||
//shared parameters
|
||||
UDPNetworkUtility& network;
|
||||
UDPNetworkUtility& network = UDPNetworkUtility::GetSingleton();
|
||||
int& clientIndex;
|
||||
int& accountIndex;
|
||||
int& characterIndex;
|
||||
|
||||
@@ -35,13 +35,11 @@
|
||||
//-------------------------
|
||||
|
||||
InWorld::InWorld(
|
||||
UDPNetworkUtility* const argNetwork,
|
||||
int* const argClientIndex,
|
||||
int* const argAccountIndex,
|
||||
int* const argCharacterIndex,
|
||||
CharacterMap* argCharacterMap
|
||||
):
|
||||
network(*argNetwork),
|
||||
clientIndex(*argClientIndex),
|
||||
accountIndex(*argAccountIndex),
|
||||
characterIndex(*argCharacterIndex),
|
||||
|
||||
@@ -49,7 +49,6 @@ class InWorld : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
InWorld(
|
||||
UDPNetworkUtility* const argNetwork,
|
||||
int* const argClientIndex,
|
||||
int* const argAccountIndex,
|
||||
int* const argCharacterIndex,
|
||||
@@ -92,7 +91,7 @@ protected:
|
||||
void UpdateMap();
|
||||
|
||||
//shared parameters
|
||||
UDPNetworkUtility& network;
|
||||
UDPNetworkUtility& network = UDPNetworkUtility::GetSingleton();
|
||||
int& clientIndex;
|
||||
int& accountIndex;
|
||||
int& characterIndex;
|
||||
|
||||
@@ -30,12 +30,7 @@
|
||||
//Public access members
|
||||
//-------------------------
|
||||
|
||||
LobbyMenu::LobbyMenu(
|
||||
UDPNetworkUtility* const argNetwork,
|
||||
int* const argClientIndex,
|
||||
int* const argAccountIndex
|
||||
):
|
||||
network(*argNetwork),
|
||||
LobbyMenu::LobbyMenu(int* const argClientIndex, int* const argAccountIndex):
|
||||
clientIndex(*argClientIndex),
|
||||
accountIndex(*argAccountIndex)
|
||||
{
|
||||
|
||||
@@ -40,11 +40,7 @@
|
||||
class LobbyMenu : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
LobbyMenu(
|
||||
UDPNetworkUtility* const argNetwork,
|
||||
int* const argClientIndex,
|
||||
int* const argAccountIndex
|
||||
);
|
||||
LobbyMenu(int* const argClientIndex, int* const argAccountIndex);
|
||||
~LobbyMenu();
|
||||
|
||||
protected:
|
||||
@@ -68,7 +64,7 @@ protected:
|
||||
|
||||
//shared parameters
|
||||
ConfigUtility& config = ConfigUtility::GetSingleton();
|
||||
UDPNetworkUtility& network;
|
||||
UDPNetworkUtility& network = UDPNetworkUtility::GetSingleton();
|
||||
int& clientIndex;
|
||||
int& accountIndex;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user