Get road connections working, and convert grass/hill road crossings from old scenarios
In classic BoE, to make a road cross the boundary of grass and hills, you would place a "road on hill" terrain where the boundary should be, and the game would automatically convert it to the correct type of boundary before drawing the road on top. Now, the game expects you to place the proper boundary there instead, meaning there is some more complicated logic to determine when it needs to draw a road across a boundary, or, in some cases, two consecutive boundaries. It works for the surface world of Valley of the Dying Things; there may still be some edge cases that need fixing.
This commit is contained in:
@@ -25,6 +25,33 @@ cOutdoors& cOutdoors::operator = (legacy::outdoor_record_type& old){
|
||||
if(scenario.ter_types[terrain[i][j]].i == 3000) // marker to indicate it used to be a special spot
|
||||
special_spot[i][j] = true;
|
||||
else special_spot[i][j] = false;
|
||||
// Convert roads that crossed grass/hill boundaries
|
||||
// It won't catch ones that sit exactly at the edge, though; in that case they'd need manual fixing
|
||||
// For simplicity we assume the non-hill space is either a city or a grass road
|
||||
// Terrain types used here:
|
||||
// 80 - grass road 81 - hill road
|
||||
// 38 - hill/grass 40 - hill|grass 42 - grass/hill 44 - grass|hill
|
||||
// where / means "over" and | means "beside"
|
||||
// Not going to do it for town since roads in town are uncommon. Maybe later.
|
||||
if(old.terrain[i][j] == 81 && i > 0 && i < 47 && j > 0 && j < 47) {
|
||||
if(old.terrain[i+1][j] == 81) {
|
||||
ter_num_t connect = old.terrain[i-1][j];
|
||||
if(connect == 80 || scenario.ter_types[connect].trim_type == TRIM_CITY)
|
||||
terrain[i][j] = 44;
|
||||
} else if(old.terrain[i-1][j] == 81) {
|
||||
ter_num_t connect = old.terrain[i+1][j];
|
||||
if(connect == 80 || scenario.ter_types[connect].trim_type == TRIM_CITY)
|
||||
terrain[i][j] = 40;
|
||||
} else if(old.terrain[i][j+1] == 81) {
|
||||
ter_num_t connect = old.terrain[i][j-1];
|
||||
if(connect == 80 || scenario.ter_types[connect].trim_type == TRIM_CITY)
|
||||
terrain[i][j] = 42;
|
||||
} else if(old.terrain[i][j-1] == 81) {
|
||||
ter_num_t connect = old.terrain[i][j+1];
|
||||
if(connect == 80 || scenario.ter_types[connect].trim_type == TRIM_CITY)
|
||||
terrain[i][j] = 38;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i = 0; i < 18; i++){
|
||||
special_locs[i].x = old.special_locs[i].x;
|
||||
|
Reference in New Issue
Block a user