Vehicles fixes

- Fix boats being saved as horses
- Fix first boat/horse not saving property status in scenario map data
- Game finally supports boats that start outdoors... probably
This commit is contained in:
2015-09-03 03:01:34 -04:00
parent d3b0b26deb
commit 9fd65cd597
7 changed files with 79 additions and 24 deletions

View File

@@ -132,6 +132,8 @@ static void init_party_scen_data() {
if(!univ.party.boats[i].exists) {
univ.party.boats[i] = univ.scenario.boats[i];
univ.party.boats[i].exists = true;
if(univ.party.boats[i].which_town == 200)
univ.party.boats[i].loc_in_sec = univ.party.boats[i].loc;
}
}
}
@@ -140,6 +142,8 @@ static void init_party_scen_data() {
if(!univ.party.horses[i].exists) {
univ.party.horses[i] = univ.scenario.horses[i];
univ.party.horses[i].exists = true;
if(univ.party.horses[i].which_town == 200)
univ.party.horses[i].loc_in_sec = univ.party.horses[i].loc;
}
}
}

View File

@@ -857,14 +857,14 @@ map_data buildOutMapData(location which, cScenario& scenario) {
}
for(size_t i = 0; i < scenario.boats.size(); i++) {
if(scenario.boats[i].which_town == 200 && scenario.boats[i].sector == which) {
int j = i;
int j = i + 1;
if(scenario.boats[i].property) j *= -1;
terrain.addFeature(scenario.boats[i].loc.x, scenario.boats[i].loc.y, eMapFeature::HORSE, j);
terrain.addFeature(scenario.boats[i].loc.x, scenario.boats[i].loc.y, eMapFeature::BOAT, j);
}
}
for(size_t i = 0; i < scenario.horses.size(); i++) {
if(scenario.horses[i].which_town == 200 && scenario.horses[i].sector == which) {
int j = i;
int j = i + 1;
if(scenario.horses[i].property) j *= -1;
terrain.addFeature(scenario.horses[i].loc.x, scenario.horses[i].loc.y, eMapFeature::HORSE, j);
}
@@ -905,14 +905,14 @@ map_data buildTownMapData(size_t which, cScenario& scenario) {
}
for(size_t i = 0; i < scenario.boats.size(); i++) {
if(scenario.boats[i].which_town == which) {
int j = i;
int j = i + 1;
if(scenario.boats[i].property) j *= -1;
terrain.addFeature(scenario.boats[i].loc.x, scenario.boats[i].loc.y, eMapFeature::HORSE, j);
terrain.addFeature(scenario.boats[i].loc.x, scenario.boats[i].loc.y, eMapFeature::BOAT, j);
}
}
for(size_t i = 0; i < scenario.horses.size(); i++) {
if(scenario.horses[i].which_town == which) {
int j = i;
int j = i + 1;
if(scenario.horses[i].property) j *= -1;
terrain.addFeature(scenario.horses[i].loc.x, scenario.horses[i].loc.y, eMapFeature::HORSE, j);
}

View File

@@ -815,7 +815,6 @@ void draw_terrain(){
which_pt.x = cen_x + q - 4;
which_pt.y =cen_y + r - 4;
// TODO: I'm not quite sure whether these should be testing loc or loc_in_sec
if(!editing_town) {
for(i = 0; i < scenario.boats.size(); i++) {
if(scenario.boats[i].which_town == 200 &&

View File

@@ -1865,10 +1865,10 @@ void loadOutMapData(map_data&& data, location which, cScenario& scen) {
case eMapFeature::BOAT:
is_boat = true;
case eMapFeature::HORSE:
what = &(is_boat ? scen.boats : scen.horses)[abs(feat.second)];
what = &(is_boat ? scen.boats : scen.horses)[abs(feat.second) - 1];
what->which_town = 200;
what->sector = which;
what->loc_in_sec = loc(x,y);
what->loc = loc(x,y);
what->property = feat.second < 0;
break;
case eMapFeature::FIELD:
@@ -1913,7 +1913,7 @@ void loadTownMapData(map_data&& data, int which, cScenario& scen) {
case eMapFeature::BOAT:
is_boat = true;
case eMapFeature::HORSE:
what = &(is_boat ? scen.boats : scen.horses)[abs(feat.second)];
what = &(is_boat ? scen.boats : scen.horses)[abs(feat.second) - 1];
what->which_town = which;
what->loc = loc(x,y);
what->property = feat.second < 0;