49
49
CONNECTS_EAST = 13,
50
50
CONNECTS_SOUTH = 14,
52
static std::string roadTypeToString(const Road::Type type);
53
static Road::Type roadTypeFromString(const std::string str);
55
53
//! Default constructor.
57
55
* @param pos The location of the road.
58
56
* @param type The type of road.
60
Road(Vector<int> pos, int type = 7);
58
Road(Vector<int> pos, int type = CONNECTS_ALL_DIRECTIONS);
62
60
//! Copy constructor.
63
//! Alternative copy constructor that changes the road's position.
64
Road(const Road&, Vector<int> pos);
64
66
//! Loading constructor.
66
68
* Make a new road object by reading lordsawar.roadlist.road XML
69
71
* @param helper The opened saved-game file to load the road from.
71
73
Road(XML_Helper* helper);
75
81
//! Returns the type of the road.
76
int getType() {return d_type;};
82
int getType() const {return d_type;};
78
87
//! Sets the type of the road.
79
88
void setType(int type) {d_type = type;};
91
// Methods that operate on class data but do not modify the class
81
93
//! Save the road data to an opened saved-game file.
82
94
bool save(XML_Helper* helper) const;
99
//! Convert a Road::Type enumerated value to a string.
100
static std::string roadTypeToString(const Road::Type type);
102
//! Convert a string containing a Road::Type to it's enumerated value.
103
static Road::Type roadTypeFromString(const std::string str);
85
109
//! The type of the road.
87
111
* The type of road refers to the look of the road on the map. It
88
* can be any one of the following values:
89
* 0 = a road that connects to other roads to the east and the west.
90
* 1 = a road that connects to other roads to the north and the south.
91
* 2 = a road that connects to other roads to all directions.
92
* 3 = a road that connects to other roads to the north and the west.
93
* 4 = a road that connects to other roads to the north and the east.
94
* 5 = a road that connects to other roads to the south and the east.
95
* 6 = a road that connects to other roads to the west and the south.
96
* 7 = a road that connects to roads to the north, south and east.
97
* 8 = a road that connects to roads to east, west and north.
98
* 9 = a road that connects to roads to the east, west, and south.
99
* 10 = a road that connects to roads to the north, south and west.
112
* can be any one of the values found in Road::Type.
101
* The Roadlist::calculateType method can sometimes set this value.
114
* The Roadlist::calculateType method can calculate this value.