A little work on template towns (still not sure how they should work though)
This commit is contained in:
@@ -22,7 +22,7 @@ namespace legacy {
|
||||
struct tiny_tr_type;
|
||||
};
|
||||
|
||||
class cBigTown : public cTown { // formerly big_tr_type
|
||||
class cBigTown : public virtual cTown { // formerly big_tr_type
|
||||
ter_num_t ter[64][64];
|
||||
unsigned char light[8][64];
|
||||
public:
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
void readTerrainFrom(std::istream& file);
|
||||
};
|
||||
|
||||
class cMedTown : public cTown { // formerly ave_tr_type
|
||||
class cMedTown : public virtual cTown { // formerly ave_tr_type
|
||||
ter_num_t ter[48][48];
|
||||
unsigned char light[6][48];
|
||||
public:
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
void readTerrainFrom(std::istream& file);
|
||||
};
|
||||
|
||||
class cTinyTown : public cTown { // formerly tiny_tr_type
|
||||
class cTinyTown : public virtual cTown { // formerly tiny_tr_type
|
||||
ter_num_t ter[32][32];
|
||||
unsigned char light[4][32];
|
||||
public:
|
||||
|
@@ -13,9 +13,9 @@
|
||||
|
||||
#include "classes.h"
|
||||
|
||||
ter_num_t& cBigTemplTown::terrain(size_t /*x*/, size_t /*y*/){
|
||||
static ter_num_t dummy;
|
||||
return dummy; // TODO: will need to calculate the terrain somehow
|
||||
ter_num_t& cBigTemplTown::terrain(size_t x, size_t y){
|
||||
location pos(x,y);
|
||||
return cBigTown::terrain(x,y);
|
||||
}
|
||||
|
||||
void cBigTemplTown::writeTerrainTo(std::ostream& /*file*/) {
|
||||
@@ -26,7 +26,3 @@ void cBigTemplTown::readTerrainFrom(std::istream& /*file*/) {
|
||||
// TODO: Read in the terrain somehow
|
||||
}
|
||||
|
||||
size_t cBigTemplTown::max_dim() const {
|
||||
return 0; // not sure what they are yet.
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include "simpletypes.h"
|
||||
#include "regtown.h"
|
||||
|
||||
class cTemplTown {
|
||||
class cTemplTown : public virtual cTown {
|
||||
public:
|
||||
class cCityBlock { // formerly city_block_type
|
||||
public:
|
||||
@@ -30,34 +30,37 @@ public:
|
||||
public:
|
||||
rectangle rect;
|
||||
ter_num_t ter_type;
|
||||
unsigned char hollow;
|
||||
bool hollow;
|
||||
};
|
||||
cCityBlock blocks[15];
|
||||
cTerRect ter_rects[10];
|
||||
long day;
|
||||
virtual bool is_templated() const {return true;}
|
||||
virtual ~cTemplTown() {}
|
||||
};
|
||||
|
||||
class cBigTemplTown : public cBigTown, public cTemplTown {
|
||||
ter_num_t after[64][64];
|
||||
public:
|
||||
ter_num_t& terrain(size_t x, size_t y);
|
||||
size_t max_dim() const;
|
||||
void writeTerrainTo(std::ostream& file);
|
||||
void readTerrainFrom(std::istream& file);
|
||||
explicit cBigTemplTown(cScenario& scenario, bool init_strings = false);
|
||||
};
|
||||
|
||||
class cMedTemplTown : public cMedTown, public cTemplTown {
|
||||
ter_num_t after[48][48];
|
||||
public:
|
||||
ter_num_t& terrain(size_t x, size_t y);
|
||||
size_t max_dim() const;
|
||||
void writeTerrainTo(std::ostream& file);
|
||||
void readTerrainFrom(std::istream& file);
|
||||
explicit cMedTemplTown(cScenario& scenario, bool init_strings = false);
|
||||
};
|
||||
|
||||
class cTinyTemplTown : public cTinyTown, public cTemplTown {
|
||||
ter_num_t after[32][32];
|
||||
public:
|
||||
ter_num_t& terrain(size_t x, size_t y);
|
||||
size_t max_dim() const;
|
||||
void writeTerrainTo(std::ostream& file);
|
||||
void readTerrainFrom(std::istream& file);
|
||||
explicit cTinyTemplTown(cScenario& scenario, bool init_strings = false);
|
||||
|
@@ -110,6 +110,7 @@ public:
|
||||
virtual ter_num_t& terrain(size_t x, size_t y) = 0;
|
||||
virtual unsigned char& lighting(size_t i, size_t r) = 0;
|
||||
virtual size_t max_dim() const = 0;
|
||||
virtual bool is_templated() const {return false;}
|
||||
void init_start();
|
||||
void set_up_lights();
|
||||
short light_obscurity(short x,short y); // Obscurity function used for calculating lighting
|
||||
|
Reference in New Issue
Block a user