Added mapType to BaseGenerator

This commit is contained in:
Kayne Ruse
2014-06-21 18:10:57 +10:00
parent 8afd0e7c8a
commit 3662a97475
13 changed files with 20 additions and 22 deletions
+2 -1
View File
@@ -21,7 +21,8 @@
*/
#include "base_generator.hpp"
BaseGenerator::BaseGenerator() {
BaseGenerator::BaseGenerator(MapType t) {
mapType = t;
for (int i = 0; i < MAP_WIDTH; i++) {
for (int j = 0; j < MAP_HEIGHT; j++) {
chunks[i][j].type = TerrainType::NONE;
+7 -1
View File
@@ -22,6 +22,7 @@
#ifndef BASEGENERATOR_HPP_
#define BASEGENERATOR_HPP_
#include "map_type.hpp"
#include "chunk_data.hpp"
#include "lua/lua.hpp"
@@ -31,17 +32,22 @@ constexpr int MAP_HEIGHT = 256;
class BaseGenerator {
public:
BaseGenerator();
virtual ~BaseGenerator();
//accessors and mutators
virtual ChunkData* GetChunk(int x, int y) { return &chunks[x][y]; }
MapType GetMapType() { return mapType; }
lua_State* SetLuaState(lua_State* L) { return luaState = L; }
lua_State* GetLuaState() { return luaState; }
protected:
BaseGenerator() = delete;
BaseGenerator(MapType t);
ChunkData chunks[MAP_WIDTH][MAP_HEIGHT];
MapType mapType = MapType::NONE;
lua_State* luaState = nullptr;
};
+1 -1
View File
@@ -21,7 +21,7 @@
*/
#include "caves_generator.hpp"
CavesGenerator::CavesGenerator() {
CavesGenerator::CavesGenerator() : BaseGenerator(MapType::CAVES) {
//
}
@@ -24,8 +24,6 @@
#include "base_generator.hpp"
#define CAVES_GENERATOR_PSEUDOINDEX "CavesGenerator"
class CavesGenerator : public BaseGenerator {
public:
CavesGenerator();
@@ -21,7 +21,7 @@
*/
#include "forests_generator.hpp"
ForestsGenerator::ForestsGenerator() {
ForestsGenerator::ForestsGenerator() : BaseGenerator(MapType::FORESTS) {
//
}
@@ -24,8 +24,6 @@
#include "base_generator.hpp"
#define FORESTS_GENERATOR_PSEUDOINDEX "ForestsGenerator"
class ForestsGenerator : public BaseGenerator {
public:
ForestsGenerator();
@@ -21,7 +21,7 @@
*/
#include "overworld_generator.hpp"
OverworldGenerator::OverworldGenerator() {
OverworldGenerator::OverworldGenerator() : BaseGenerator(MapType::OVERWORLD) {
//
}
@@ -24,8 +24,6 @@
#include "base_generator.hpp"
#define OVERWORLD_GENERATOR_PSEUDOINDEX "OverworldGenerator"
class OverworldGenerator : public BaseGenerator {
public:
OverworldGenerator();
+1 -1
View File
@@ -21,7 +21,7 @@
*/
#include "ruins_generator.hpp"
RuinsGenerator::RuinsGenerator() {
RuinsGenerator::RuinsGenerator() : BaseGenerator(MapType::RUINS) {
//
}
@@ -24,8 +24,6 @@
#include "base_generator.hpp"
#define RUINS_GENERATOR_PSEUDOINDEX "RuinsGenerator"
class RuinsGenerator : public BaseGenerator {
public:
RuinsGenerator();
@@ -21,7 +21,7 @@
*/
#include "towers_generator.hpp"
TowersGenerator::TowersGenerator() {
TowersGenerator::TowersGenerator() : BaseGenerator(MapType::TOWERS) {
//
}
@@ -24,8 +24,6 @@
#include "base_generator.hpp"
#define TOWERS_GENERATOR_PSEUDOINDEX "TowersGenerator"
class TowersGenerator : public BaseGenerator {
public:
TowersGenerator();
+6 -5
View File
@@ -23,11 +23,12 @@
#define MAPTYPE_HPP_
enum class MapType {
OVERWORLD = 0,
RUINS = 1,
TOWERS = 2,
FORESTS = 3,
CAVES = 4,
NONE,
OVERWORLD,
RUINS,
TOWERS,
FORESTS,
CAVES,
};
#endif