mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
Road|river patterns are trivial compared to terrain patterns - no need to use json, just define them as a constatnt
This commit is contained in:
parent
877634b3a3
commit
b1d4ce0474
@ -11,6 +11,124 @@
|
||||
#include "StdInc.h"
|
||||
#include "CDrawRoadsOperation.h"
|
||||
|
||||
const std::vector<CDrawRoadsOperation::RoadPattern> CDrawRoadsOperation::rules =
|
||||
{
|
||||
//single tile. fallback patern
|
||||
{
|
||||
{
|
||||
"-","-","-",
|
||||
"-","+","-",
|
||||
"-","-","-"
|
||||
},
|
||||
{14,14},
|
||||
{9,9},
|
||||
false,
|
||||
false
|
||||
},
|
||||
//Road straight with angle
|
||||
{
|
||||
{
|
||||
"?","-","+",
|
||||
"-","+","+",
|
||||
"+","+","?"
|
||||
},
|
||||
{2,5},
|
||||
{-1,-1},
|
||||
true,
|
||||
true
|
||||
},
|
||||
//Turn
|
||||
{
|
||||
{
|
||||
"?","-","?",
|
||||
"-","+","+",
|
||||
"?","+","?"
|
||||
},
|
||||
{0,1},
|
||||
{0,3},
|
||||
true,
|
||||
true
|
||||
},
|
||||
//Dead end horizontal
|
||||
{
|
||||
{
|
||||
"?","-","?",
|
||||
"-","+","+",
|
||||
"?","-","?"
|
||||
},
|
||||
{15,15},{11,12},
|
||||
false,
|
||||
true
|
||||
},
|
||||
//Dead end vertical
|
||||
{
|
||||
{
|
||||
"?","-","?",
|
||||
"-","+","-",
|
||||
"?","+","?"
|
||||
},
|
||||
{14,14},{9,10},
|
||||
true,
|
||||
false
|
||||
},
|
||||
//T-cross horizontal
|
||||
{
|
||||
{
|
||||
"?","+","?",
|
||||
"-","+","+",
|
||||
"?","+","?"
|
||||
},
|
||||
{6,7},{7,8},
|
||||
false,
|
||||
true
|
||||
},
|
||||
//T-cross vertical
|
||||
{
|
||||
{
|
||||
"?","-","?",
|
||||
"+","+","+",
|
||||
"?","+","?"
|
||||
},
|
||||
{8,9},{5,6},
|
||||
true,
|
||||
false
|
||||
},
|
||||
//Straight Horizontal
|
||||
{
|
||||
{
|
||||
"?","-","?",
|
||||
"+","+","+",
|
||||
"?","-","?"
|
||||
},
|
||||
{12,13},{11,12},
|
||||
false,
|
||||
false
|
||||
},
|
||||
//Straight Vertical
|
||||
{
|
||||
{
|
||||
"?","+","?",
|
||||
"-","+","-",
|
||||
"?","+","?"
|
||||
},
|
||||
{10,11},{9,10},
|
||||
false,
|
||||
false
|
||||
},
|
||||
//X-cross
|
||||
{
|
||||
{
|
||||
"?","+","?",
|
||||
"+","+","+",
|
||||
"?","+","?"
|
||||
},
|
||||
{16,16},{4,4},
|
||||
false,
|
||||
false
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
///CDrawRoadsOperation
|
||||
CDrawRoadsOperation::CDrawRoadsOperation(CMap * map, const CTerrainSelection & terrainSel, ERoadType::ERoadType roadType, CRandomGenerator * gen):
|
||||
CMapOperation(map),terrainSel(terrainSel), roadType(roadType), gen(gen)
|
||||
|
@ -24,6 +24,16 @@ public:
|
||||
void redo() override;
|
||||
std::string getLabel() const override;
|
||||
private:
|
||||
|
||||
struct RoadPattern
|
||||
{
|
||||
std::string rules[9];
|
||||
std::pair<int, int> roadMapping, riverMapping;
|
||||
bool hasHFlip, hasBFlip;
|
||||
};
|
||||
|
||||
static const std::vector<RoadPattern> rules;
|
||||
|
||||
CTerrainSelection terrainSel;
|
||||
ERoadType::ERoadType roadType;
|
||||
CRandomGenerator * gen;
|
||||
|
Loading…
x
Reference in New Issue
Block a user