Implemented SharedParameters system in the client (read more)
Here are more tweaks: * InWorld's quit event now exits to the main menu, bypassing a relayed disconnect message * InWorld's disconnect hander no longer throws exceptions (dropped creation packet bugfix) * CombatData's internals now point to std::pair objects * Enemies are stored in a global list
This commit is contained in:
@@ -119,13 +119,13 @@ void ClientApplication::LoadScene(SceneList sceneIndex) {
|
|||||||
activeScene = new OptionsMenu(&config);
|
activeScene = new OptionsMenu(&config);
|
||||||
break;
|
break;
|
||||||
case SceneList::LOBBYMENU:
|
case SceneList::LOBBYMENU:
|
||||||
activeScene = new LobbyMenu(&config, &network, &clientIndex, &accountIndex, &characterIndex);
|
activeScene = new LobbyMenu(&config, &network, ¶ms);
|
||||||
break;
|
break;
|
||||||
case SceneList::INWORLD:
|
case SceneList::INWORLD:
|
||||||
activeScene = new InWorld(&config, &network, &clientIndex, &accountIndex, &characterIndex);
|
activeScene = new InWorld(&config, &network, ¶ms);
|
||||||
break;
|
break;
|
||||||
case SceneList::INCOMBAT:
|
case SceneList::INCOMBAT:
|
||||||
activeScene = new InCombat();
|
activeScene = new InCombat(&config, &network, ¶ms);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw(std::logic_error("Failed to recognize the scene index"));
|
throw(std::logic_error("Failed to recognize the scene index"));
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright: (c) Kayne Ruse 2013
|
/* Copyright: (c) Kayne Ruse 2013, 2014
|
||||||
*
|
*
|
||||||
* This software is provided 'as-is', without any express or implied
|
* This software is provided 'as-is', without any express or implied
|
||||||
* warranty. In no event will the authors be held liable for any damages
|
* warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "scene_list.hpp"
|
#include "scene_list.hpp"
|
||||||
#include "base_scene.hpp"
|
#include "base_scene.hpp"
|
||||||
|
|
||||||
|
#include "shared_parameters.hpp"
|
||||||
#include "config_utility.hpp"
|
#include "config_utility.hpp"
|
||||||
#include "udp_network_utility.hpp"
|
#include "udp_network_utility.hpp"
|
||||||
|
|
||||||
@@ -47,9 +48,7 @@ private:
|
|||||||
//shared parameters
|
//shared parameters
|
||||||
ConfigUtility config;
|
ConfigUtility config;
|
||||||
UDPNetworkUtility network;
|
UDPNetworkUtility network;
|
||||||
int clientIndex = -1;
|
SharedParameters params;
|
||||||
int accountIndex = -1;
|
|
||||||
int characterIndex = -1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -25,7 +25,11 @@
|
|||||||
//Public access members
|
//Public access members
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
InCombat::InCombat() {
|
InCombat::InCombat(ConfigUtility* const argConfig, UDPNetworkUtility* const argNetwork, SharedParameters* const argParams):
|
||||||
|
config(*argConfig),
|
||||||
|
network(*argNetwork),
|
||||||
|
params(*argParams)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +61,10 @@ void InCombat::Render(SDL_Surface* const screen) {
|
|||||||
//Event handlers
|
//Event handlers
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
|
void InCombat::QuitEvent() {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
void InCombat::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
void InCombat::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -80,3 +88,7 @@ void InCombat::KeyDown(SDL_KeyboardEvent const& key) {
|
|||||||
void InCombat::KeyUp(SDL_KeyboardEvent const& key) {
|
void InCombat::KeyUp(SDL_KeyboardEvent const& key) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InCombat::HandlePacket(SerialPacket& packet) {
|
||||||
|
//
|
||||||
|
}
|
||||||
@@ -22,12 +22,25 @@
|
|||||||
#ifndef INCOMBAT_HPP_
|
#ifndef INCOMBAT_HPP_
|
||||||
#define INCOMBAT_HPP_
|
#define INCOMBAT_HPP_
|
||||||
|
|
||||||
|
//graphics & utilities
|
||||||
|
#include "image.hpp"
|
||||||
|
#include "raster_font.hpp"
|
||||||
|
#include "button.hpp"
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
#include "shared_parameters.hpp"
|
||||||
|
|
||||||
|
//network
|
||||||
|
#include "udp_network_utility.hpp"
|
||||||
|
#include "serial_packet.hpp"
|
||||||
|
#include "serial.hpp"
|
||||||
|
|
||||||
|
//client
|
||||||
#include "base_scene.hpp"
|
#include "base_scene.hpp"
|
||||||
|
|
||||||
class InCombat : public BaseScene {
|
class InCombat : public BaseScene {
|
||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
InCombat();
|
InCombat(ConfigUtility* const, UDPNetworkUtility* const, SharedParameters* const);
|
||||||
~InCombat();
|
~InCombat();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -38,11 +51,20 @@ protected:
|
|||||||
void Render(SDL_Surface* const);
|
void Render(SDL_Surface* const);
|
||||||
|
|
||||||
//Event handlers
|
//Event handlers
|
||||||
|
void QuitEvent();
|
||||||
void MouseMotion(SDL_MouseMotionEvent const&);
|
void MouseMotion(SDL_MouseMotionEvent const&);
|
||||||
void MouseButtonDown(SDL_MouseButtonEvent const&);
|
void MouseButtonDown(SDL_MouseButtonEvent const&);
|
||||||
void MouseButtonUp(SDL_MouseButtonEvent const&);
|
void MouseButtonUp(SDL_MouseButtonEvent const&);
|
||||||
void KeyDown(SDL_KeyboardEvent const&);
|
void KeyDown(SDL_KeyboardEvent const&);
|
||||||
void KeyUp(SDL_KeyboardEvent const&);
|
void KeyUp(SDL_KeyboardEvent const&);
|
||||||
|
|
||||||
|
//Network handlers
|
||||||
|
void HandlePacket(SerialPacket&);
|
||||||
|
|
||||||
|
//shared parameters
|
||||||
|
ConfigUtility& config;
|
||||||
|
UDPNetworkUtility& network;
|
||||||
|
SharedParameters& params;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+26
-31
@@ -31,12 +31,10 @@
|
|||||||
//Public access members
|
//Public access members
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
InWorld::InWorld(ConfigUtility* const argConfig, UDPNetworkUtility* const argNetwork, int* const argClientIndex, int* const argAccountIndex, int* const argCharacterIndex):
|
InWorld::InWorld(ConfigUtility* const argConfig, UDPNetworkUtility* const argNetwork, SharedParameters* const argParams):
|
||||||
config(*argConfig),
|
config(*argConfig),
|
||||||
network(*argNetwork),
|
network(*argNetwork),
|
||||||
clientIndex(*argClientIndex),
|
params(*argParams)
|
||||||
accountIndex(*argAccountIndex),
|
|
||||||
characterIndex(*argCharacterIndex)
|
|
||||||
{
|
{
|
||||||
//setup the utility objects
|
//setup the utility objects
|
||||||
buttonImage.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
buttonImage.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||||
@@ -68,9 +66,9 @@ InWorld::InWorld(ConfigUtility* const argConfig, UDPNetworkUtility* const argNet
|
|||||||
SerialPacket packet;
|
SerialPacket packet;
|
||||||
char buffer[PACKET_STRING_SIZE];
|
char buffer[PACKET_STRING_SIZE];
|
||||||
packet.meta.type = SerialPacket::Type::SYNCHRONIZE;
|
packet.meta.type = SerialPacket::Type::SYNCHRONIZE;
|
||||||
packet.clientInfo.clientIndex = clientIndex;
|
packet.clientInfo.clientIndex = params.clientIndex;
|
||||||
packet.clientInfo.accountIndex = accountIndex;
|
packet.clientInfo.accountIndex = params.accountIndex;
|
||||||
packet.clientInfo.characterIndex = characterIndex;
|
packet.clientInfo.characterIndex = params.characterIndex;
|
||||||
serialize(&packet, buffer);
|
serialize(&packet, buffer);
|
||||||
network.Send(Channels::SERVER, buffer, PACKET_BUFFER_SIZE);
|
network.Send(Channels::SERVER, buffer, PACKET_BUFFER_SIZE);
|
||||||
|
|
||||||
@@ -151,6 +149,7 @@ void InWorld::Render(SDL_Surface* const screen) {
|
|||||||
void InWorld::QuitEvent() {
|
void InWorld::QuitEvent() {
|
||||||
//exit the game AND the server
|
//exit the game AND the server
|
||||||
RequestDisconnect();
|
RequestDisconnect();
|
||||||
|
SetNextScene(SceneList::MAINMENU);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InWorld::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
void InWorld::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||||
@@ -273,17 +272,15 @@ void InWorld::HandlePacket(SerialPacket packet) {
|
|||||||
|
|
||||||
void InWorld::HandleDisconnect(SerialPacket packet) {
|
void InWorld::HandleDisconnect(SerialPacket packet) {
|
||||||
network.Unbind(Channels::SERVER);
|
network.Unbind(Channels::SERVER);
|
||||||
clientIndex = -1;
|
params.clientIndex = -1;
|
||||||
accountIndex = -1;
|
params.accountIndex = -1;
|
||||||
characterIndex = -1;
|
params.characterIndex = -1;
|
||||||
SetNextScene(SceneList::MAINMENU);
|
SetNextScene(SceneList::MAINMENU);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InWorld::HandleRegionContent(SerialPacket packet) {
|
void InWorld::HandleRegionContent(SerialPacket packet) {
|
||||||
//replace existing regions
|
//replace existing regions
|
||||||
if (regionPager.FindRegion(packet.regionInfo.x, packet.regionInfo.y)) {
|
regionPager.UnloadRegion(packet.regionInfo.x, packet.regionInfo.y);
|
||||||
regionPager.UnloadRegion(packet.regionInfo.x, packet.regionInfo.y);
|
|
||||||
}
|
|
||||||
regionPager.PushRegion(packet.regionInfo.region);
|
regionPager.PushRegion(packet.regionInfo.region);
|
||||||
packet.regionInfo.region = nullptr;
|
packet.regionInfo.region = nullptr;
|
||||||
}
|
}
|
||||||
@@ -295,7 +292,7 @@ void InWorld::HandleCharacterUpdate(SerialPacket packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//update only if the message didn't originate from here
|
//update only if the message didn't originate from here
|
||||||
if (packet.characterInfo.clientIndex != clientIndex) {
|
if (packet.characterInfo.clientIndex != params.clientIndex) {
|
||||||
playerCharacters[packet.characterInfo.characterIndex].SetPosition(packet.characterInfo.position);
|
playerCharacters[packet.characterInfo.characterIndex].SetPosition(packet.characterInfo.position);
|
||||||
playerCharacters[packet.characterInfo.characterIndex].SetMotion(packet.characterInfo.motion);
|
playerCharacters[packet.characterInfo.characterIndex].SetMotion(packet.characterInfo.motion);
|
||||||
}
|
}
|
||||||
@@ -308,14 +305,15 @@ void InWorld::HandleCharacterNew(SerialPacket packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO: set the player's handle
|
//TODO: set the player's handle
|
||||||
|
//TODO: use a reference, don't use a lookup for every call
|
||||||
playerCharacters[packet.characterInfo.characterIndex].GetSprite()->LoadSurface(config["dir.sprites"] + packet.characterInfo.avatar, 4, 4);
|
playerCharacters[packet.characterInfo.characterIndex].GetSprite()->LoadSurface(config["dir.sprites"] + packet.characterInfo.avatar, 4, 4);
|
||||||
playerCharacters[packet.characterInfo.characterIndex].SetPosition(packet.characterInfo.position);
|
playerCharacters[packet.characterInfo.characterIndex].SetPosition(packet.characterInfo.position);
|
||||||
playerCharacters[packet.characterInfo.characterIndex].SetMotion(packet.characterInfo.motion);
|
playerCharacters[packet.characterInfo.characterIndex].SetMotion(packet.characterInfo.motion);
|
||||||
playerCharacters[packet.characterInfo.characterIndex].ResetDirection();
|
playerCharacters[packet.characterInfo.characterIndex].ResetDirection();
|
||||||
|
|
||||||
//catch this client's player object
|
//catch this client's player object
|
||||||
if (packet.characterInfo.characterIndex == characterIndex && !localCharacter) {
|
if (packet.characterInfo.characterIndex == params.characterIndex && !localCharacter) {
|
||||||
localCharacter = &playerCharacters[characterIndex];
|
localCharacter = &playerCharacters[params.characterIndex];
|
||||||
|
|
||||||
//setup the camera
|
//setup the camera
|
||||||
camera.width = GetScreen()->w;
|
camera.width = GetScreen()->w;
|
||||||
@@ -327,16 +325,13 @@ void InWorld::HandleCharacterNew(SerialPacket packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InWorld::HandleCharacterDelete(SerialPacket packet) {
|
void InWorld::HandleCharacterDelete(SerialPacket packet) {
|
||||||
//TODO: authenticate
|
//TODO: authenticate when own character is being deleted
|
||||||
if (playerCharacters.find(packet.characterInfo.characterIndex) == playerCharacters.end()) {
|
|
||||||
throw(std::runtime_error("Cannot delete non-existant characters"));
|
|
||||||
}
|
|
||||||
|
|
||||||
playerCharacters.erase(packet.characterInfo.characterIndex);
|
playerCharacters.erase(packet.characterInfo.characterIndex);
|
||||||
|
|
||||||
//catch this client's player object
|
//catch this client's player object
|
||||||
if (packet.characterInfo.characterIndex == characterIndex) {
|
if (packet.characterInfo.characterIndex == params.characterIndex) {
|
||||||
characterIndex = -1;
|
params.characterIndex = -1;
|
||||||
localCharacter = nullptr;
|
localCharacter = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,9 +346,9 @@ void InWorld::SendPlayerUpdate() {
|
|||||||
|
|
||||||
//pack the packet
|
//pack the packet
|
||||||
packet.meta.type = SerialPacket::Type::CHARACTER_UPDATE;
|
packet.meta.type = SerialPacket::Type::CHARACTER_UPDATE;
|
||||||
packet.characterInfo.clientIndex = clientIndex;
|
packet.characterInfo.clientIndex = params.clientIndex;
|
||||||
packet.characterInfo.accountIndex = accountIndex;
|
packet.characterInfo.accountIndex = params.accountIndex;
|
||||||
packet.characterInfo.characterIndex = characterIndex;
|
packet.characterInfo.characterIndex = params.characterIndex;
|
||||||
packet.characterInfo.position = localCharacter->GetPosition();
|
packet.characterInfo.position = localCharacter->GetPosition();
|
||||||
packet.characterInfo.motion = localCharacter->GetMotion();
|
packet.characterInfo.motion = localCharacter->GetMotion();
|
||||||
|
|
||||||
@@ -367,9 +362,9 @@ void InWorld::RequestDisconnect() {
|
|||||||
|
|
||||||
//send a disconnect request
|
//send a disconnect request
|
||||||
packet.meta.type = SerialPacket::Type::DISCONNECT;
|
packet.meta.type = SerialPacket::Type::DISCONNECT;
|
||||||
packet.clientInfo.clientIndex = clientIndex;
|
packet.clientInfo.clientIndex = params.clientIndex;
|
||||||
packet.clientInfo.accountIndex = accountIndex;
|
packet.clientInfo.accountIndex = params.accountIndex;
|
||||||
packet.clientInfo.characterIndex = characterIndex;
|
packet.clientInfo.characterIndex = params.characterIndex;
|
||||||
serialize(&packet, buffer);
|
serialize(&packet, buffer);
|
||||||
network.Send(Channels::SERVER, buffer, PACKET_BUFFER_SIZE);
|
network.Send(Channels::SERVER, buffer, PACKET_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
@@ -380,9 +375,9 @@ void InWorld::RequestShutDown() {
|
|||||||
|
|
||||||
//send a shutdown request
|
//send a shutdown request
|
||||||
packet.meta.type = SerialPacket::Type::SHUTDOWN;
|
packet.meta.type = SerialPacket::Type::SHUTDOWN;
|
||||||
packet.clientInfo.clientIndex = clientIndex;
|
packet.clientInfo.clientIndex = params.clientIndex;
|
||||||
packet.clientInfo.accountIndex = accountIndex;
|
packet.clientInfo.accountIndex = params.accountIndex;
|
||||||
packet.clientInfo.characterIndex = characterIndex;
|
packet.clientInfo.characterIndex = params.characterIndex;
|
||||||
serialize(&packet, buffer);
|
serialize(&packet, buffer);
|
||||||
network.Send(Channels::SERVER, buffer, PACKET_BUFFER_SIZE);
|
network.Send(Channels::SERVER, buffer, PACKET_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
//client
|
//client
|
||||||
#include "base_scene.hpp"
|
#include "base_scene.hpp"
|
||||||
#include "player_character.hpp"
|
#include "player_character.hpp"
|
||||||
|
#include "shared_parameters.hpp"
|
||||||
|
|
||||||
//STL
|
//STL
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -52,7 +53,7 @@
|
|||||||
class InWorld : public BaseScene {
|
class InWorld : public BaseScene {
|
||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
InWorld(ConfigUtility* const, UDPNetworkUtility* const, int* const, int* const, int* const);
|
InWorld(ConfigUtility* const, UDPNetworkUtility* const, SharedParameters* const);
|
||||||
~InWorld();
|
~InWorld();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -91,9 +92,7 @@ protected:
|
|||||||
//shared parameters
|
//shared parameters
|
||||||
ConfigUtility& config;
|
ConfigUtility& config;
|
||||||
UDPNetworkUtility& network;
|
UDPNetworkUtility& network;
|
||||||
int& clientIndex;
|
SharedParameters& params;
|
||||||
int& accountIndex;
|
|
||||||
int& characterIndex;
|
|
||||||
|
|
||||||
//graphics
|
//graphics
|
||||||
Image buttonImage;
|
Image buttonImage;
|
||||||
|
|||||||
@@ -30,12 +30,10 @@
|
|||||||
//Public access members
|
//Public access members
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
LobbyMenu::LobbyMenu(ConfigUtility* const argConfig, UDPNetworkUtility* const argNetwork, int* const argClientIndex, int* const argAccountIndex, int* const argCharacterIndex):
|
LobbyMenu::LobbyMenu(ConfigUtility* const argConfig, UDPNetworkUtility* const argNetwork, SharedParameters* const argParams):
|
||||||
config(*argConfig),
|
config(*argConfig),
|
||||||
network(*argNetwork),
|
network(*argNetwork),
|
||||||
clientIndex(*argClientIndex),
|
params(*argParams)
|
||||||
accountIndex(*argAccountIndex),
|
|
||||||
characterIndex(*argCharacterIndex)
|
|
||||||
{
|
{
|
||||||
//setup the utility objects
|
//setup the utility objects
|
||||||
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||||
@@ -94,6 +92,7 @@ void LobbyMenu::FrameEnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LobbyMenu::Render(SDL_Surface* const screen) {
|
void LobbyMenu::Render(SDL_Surface* const screen) {
|
||||||
|
//TODO: this needs rewriting
|
||||||
//TODO: I need a proper UI system for the entire client and the editor
|
//TODO: I need a proper UI system for the entire client and the editor
|
||||||
//UI
|
//UI
|
||||||
search.DrawTo(screen);
|
search.DrawTo(screen);
|
||||||
@@ -221,9 +220,9 @@ void LobbyMenu::HandlePacket(SerialPacket packet) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SerialPacket::Type::JOIN_RESPONSE:
|
case SerialPacket::Type::JOIN_RESPONSE:
|
||||||
clientIndex = packet.clientInfo.clientIndex;
|
params.clientIndex = packet.clientInfo.clientIndex;
|
||||||
accountIndex = packet.clientInfo.accountIndex;
|
params.accountIndex = packet.clientInfo.accountIndex;
|
||||||
characterIndex = packet.clientInfo.characterIndex;
|
params.characterIndex = packet.clientInfo.characterIndex;
|
||||||
network.Bind(&packet.meta.srcAddress, Channels::SERVER);
|
network.Bind(&packet.meta.srcAddress, Channels::SERVER);
|
||||||
SetNextScene(SceneList::INWORLD);
|
SetNextScene(SceneList::INWORLD);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "raster_font.hpp"
|
#include "raster_font.hpp"
|
||||||
#include "button.hpp"
|
#include "button.hpp"
|
||||||
#include "config_utility.hpp"
|
#include "config_utility.hpp"
|
||||||
|
#include "shared_parameters.hpp"
|
||||||
|
|
||||||
//network
|
//network
|
||||||
#include "udp_network_utility.hpp"
|
#include "udp_network_utility.hpp"
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
class LobbyMenu : public BaseScene {
|
class LobbyMenu : public BaseScene {
|
||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
LobbyMenu(ConfigUtility* const, UDPNetworkUtility* const, int* const, int* const, int* const);
|
LobbyMenu(ConfigUtility* const, UDPNetworkUtility* const, SharedParameters* const);
|
||||||
~LobbyMenu();
|
~LobbyMenu();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -64,9 +65,7 @@ protected:
|
|||||||
//shared parameters
|
//shared parameters
|
||||||
ConfigUtility& config;
|
ConfigUtility& config;
|
||||||
UDPNetworkUtility& network;
|
UDPNetworkUtility& network;
|
||||||
int& clientIndex;
|
SharedParameters& params;
|
||||||
int& accountIndex;
|
|
||||||
int& characterIndex;
|
|
||||||
|
|
||||||
//members
|
//members
|
||||||
Image image;
|
Image image;
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/* Copyright: (c) Kayne Ruse 2014
|
||||||
|
*
|
||||||
|
* This software is provided 'as-is', without any express or implied
|
||||||
|
* warranty. In no event will the authors be held liable for any damages
|
||||||
|
* arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
|
* including commercial applications, and to alter it and redistribute it
|
||||||
|
* freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
* claim that you wrote the original software. If you use this software
|
||||||
|
* in a product, an acknowledgment in the product documentation would be
|
||||||
|
* appreciated but is not required.
|
||||||
|
*
|
||||||
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
* misrepresented as being the original software.
|
||||||
|
*
|
||||||
|
* 3. This notice may not be removed or altered from any source
|
||||||
|
* distribution.
|
||||||
|
*/
|
||||||
|
#ifndef SHAREDPARAMETERS_HPP_
|
||||||
|
#define SHAREDPARAMETERS_HPP_
|
||||||
|
|
||||||
|
struct SharedParameters {
|
||||||
|
int clientIndex = -1;
|
||||||
|
int accountIndex = -1;
|
||||||
|
int characterIndex = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -30,13 +30,14 @@
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
struct CombatData {
|
struct CombatData {
|
||||||
typedef std::chrono::steady_clock Clock;
|
typedef std::chrono::steady_clock Clock;
|
||||||
|
|
||||||
//combatants
|
//combatants, point to the std::map's internal pairs
|
||||||
std::list<CharacterData*> characterList;
|
std::list<std::pair<const int, CharacterData>*> characterList;
|
||||||
std::list<EnemyData> enemyList;
|
std::list<std::pair<const int, EnemyData>*> enemyList;
|
||||||
|
|
||||||
//world interaction
|
//world interaction
|
||||||
int mapIndex = 0;
|
int mapIndex = 0;
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ struct EnemyData {
|
|||||||
//NOTE: these are lost when unloaded
|
//NOTE: these are lost when unloaded
|
||||||
int tableIndex;
|
int tableIndex;
|
||||||
int atbGauge = 0;
|
int atbGauge = 0;
|
||||||
|
|
||||||
|
static int uidCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ private:
|
|||||||
std::map<int, AccountData> accountMap;
|
std::map<int, AccountData> accountMap;
|
||||||
std::map<int, CharacterData> characterMap;
|
std::map<int, CharacterData> characterMap;
|
||||||
std::map<int, CombatData> combatMap;
|
std::map<int, CombatData> combatMap;
|
||||||
|
std::map<int, EnemyData> enemyMap;
|
||||||
|
|
||||||
//maps
|
//maps
|
||||||
//TODO: I need to handle multiple map objects
|
//TODO: I need to handle multiple map objects
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
int ClientData::uidCounter = 0;
|
int ClientData::uidCounter = 0;
|
||||||
int CombatData::uidCounter = 0;
|
int CombatData::uidCounter = 0;
|
||||||
|
int EnemyData::uidCounter = 0;
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
//Define the public members
|
//Define the public members
|
||||||
|
|||||||
Reference in New Issue
Block a user