Fix deleting vehicles re-numbering other vehicles

This commit is contained in:
2025-06-11 16:26:29 -05:00
parent 3810fd0250
commit 0dfddae5f2
2 changed files with 9 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ public:
// If they demand different member functions, I'll derive from this class.
location loc;
location sector;
short which_town;
short which_town = -1;
bool exists;
bool property;
pic_num_t pic = 0;

View File

@@ -1123,8 +1123,14 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
iter->exists = false;
if(!editing_town) iter->sector = cur_out;
}
if(!edit_vehicle(*iter, iter - all.begin(), overall_mode == MODE_PLACE_BOAT))
all.erase(iter);
if(!edit_vehicle(*iter, iter - all.begin(), overall_mode == MODE_PLACE_BOAT)){
if(iter == (all.end() - 1)){
all.erase(iter);
}else{
*iter = cVehicle();
iter->is_boat = (overall_mode == MODE_PLACE_BOAT);
}
}
overall_mode = MODE_DRAWING;
break;
}