Began work on the server's generic entity system
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/* 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.
|
||||
*/
|
||||
#include "entity.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
//This is explicitly a POD
|
||||
static_assert(std::is_pod<Entity>::value, "Entity is not a POD");
|
||||
|
||||
unsigned int Entity::uidCounter;
|
||||
@@ -0,0 +1,47 @@
|
||||
/* 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 ENTITY_HPP_
|
||||
#define ENTITY_HPP_
|
||||
|
||||
//POD members
|
||||
#include "vector2.hpp"
|
||||
#include "bbox.hpp"
|
||||
|
||||
struct Entity {
|
||||
enum Type {
|
||||
PLAYER,
|
||||
PORTAL,
|
||||
ITEMS,
|
||||
CHEST,
|
||||
DOOR,
|
||||
};
|
||||
|
||||
Type type;
|
||||
int mapIndex;
|
||||
Vector2 position;
|
||||
Vector2 motion;
|
||||
BBox bbox;
|
||||
unsigned int uid;
|
||||
static unsigned int uidCounter;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
/* 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 PLAYERENTITY_HPP_
|
||||
#define PLAYERENTITY_HPP_
|
||||
|
||||
struct PlayerEntity {
|
||||
//TODO: stuff
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -53,7 +53,8 @@ void ServerApplication::Init(int argc, char** argv) {
|
||||
cout << "Beginning startup" << endl;
|
||||
int ret = 0;
|
||||
|
||||
//load config
|
||||
//initial setup
|
||||
Entity::uidCounter = 0;
|
||||
config.Load("rsc\\config.cfg");
|
||||
|
||||
//Init SDL
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#ifndef SERVERAPPLICATION_HPP_
|
||||
#define SERVERAPPLICATION_HPP_
|
||||
|
||||
//server specific stuff
|
||||
#include "entity.hpp"
|
||||
#include "player_entity.hpp"
|
||||
|
||||
//maps
|
||||
#include "map_generator.hpp"
|
||||
#include "map_file_format.hpp"
|
||||
|
||||
Reference in New Issue
Block a user