New toolbar buttons for placing boats and horses; replaces the edit boats/horses dialogs
This commit is contained in:
@@ -72,7 +72,7 @@ ePalBtn out_buttons[6][10] = {
|
||||
{PAL_PENCIL, PAL_BRUSH_LG, PAL_BRUSH_SM, PAL_SPRAY_LG, PAL_SPRAY_SM, PAL_ERASER, PAL_DROPPER, PAL_RECT_HOLLOW, PAL_RECT_FILLED, PAL_BUCKET},
|
||||
{PAL_EDIT_TOWN, PAL_ERASE_TOWN, PAL_BLANK, PAL_BLANK, PAL_EDIT_SIGN, PAL_TEXT_AREA, PAL_WANDER, PAL_CHANGE, PAL_ZOOM, PAL_BLANK},
|
||||
{PAL_SPEC, PAL_COPY_SPEC, PAL_PASTE_SPEC, PAL_ERASE_SPEC, PAL_EDIT_SPEC, PAL_SPEC_SPOT, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
||||
{PAL_BLANK, PAL_ROAD, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
||||
{PAL_BOAT, PAL_HORSE, PAL_ROAD, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
||||
{PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
||||
{PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
||||
};
|
||||
@@ -81,7 +81,7 @@ ePalBtn town_buttons[6][10] = {
|
||||
{PAL_PENCIL, PAL_BRUSH_LG, PAL_BRUSH_SM, PAL_SPRAY_LG, PAL_SPRAY_SM, PAL_ERASER, PAL_DROPPER, PAL_RECT_HOLLOW, PAL_RECT_FILLED, PAL_BUCKET},
|
||||
{PAL_ENTER_N, PAL_ENTER_W, PAL_ENTER_S, PAL_ENTER_E, PAL_EDIT_SIGN, PAL_TEXT_AREA, PAL_WANDER, PAL_CHANGE, PAL_ZOOM, PAL_TERRAIN},
|
||||
{PAL_SPEC, PAL_COPY_SPEC, PAL_PASTE_SPEC, PAL_ERASE_SPEC, PAL_EDIT_SPEC, PAL_SPEC_SPOT, PAL_EDIT_ITEM, PAL_SAME_ITEM, PAL_ERASE_ITEM, PAL_ITEM},
|
||||
{PAL_BLANK, PAL_ROAD, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_EDIT_MONST, PAL_SAME_MONST, PAL_ERASE_MONST, PAL_MONST},
|
||||
{PAL_BOAT, PAL_HORSE, PAL_ROAD, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_EDIT_MONST, PAL_SAME_MONST, PAL_ERASE_MONST, PAL_MONST},
|
||||
{PAL_WEB, PAL_CRATE, PAL_BARREL, PAL_BLOCK, PAL_FIRE_BARR, PAL_FORCE_BARR, PAL_QUICKFIRE, PAL_FORCECAGE, PAL_ERASE_FIELD, PAL_BLANK},
|
||||
{PAL_SFX_SB, PAL_SFX_MB, PAL_SFX_LB, PAL_SFX_SS, PAL_SFX_LS, PAL_SFX_ASH, PAL_SFX_BONE, PAL_SFX_ROCK, PAL_BLANK, PAL_BLANK},
|
||||
};
|
||||
@@ -132,6 +132,7 @@ static cursor_type get_edit_cursor() {
|
||||
case MODE_PLACE_STONE_BLOCK: case MODE_PLACE_FIRE_BARRIER:
|
||||
case MODE_PLACE_FORCE_BARRIER: case MODE_PLACE_QUICKFIRE:
|
||||
case MODE_PLACE_FORCECAGE: case MODE_PLACE_SFX:
|
||||
case MODE_PLACE_HORSE: case MODE_PLACE_BOAT:
|
||||
case MODE_TOGGLE_SPECIAL_DOT: case MODE_TOGGLE_ROAD:
|
||||
|
||||
case MODE_DRAWING:
|
||||
@@ -1131,6 +1132,32 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
||||
overall_mode = MODE_DRAWING;
|
||||
change_made = true;
|
||||
break;
|
||||
case MODE_PLACE_BOAT: case MODE_PLACE_HORSE: {
|
||||
auto& all = overall_mode == MODE_PLACE_BOAT ? scenario.boats : scenario.horses;
|
||||
auto iter = std::find_if(all.begin(), all.end(), [](const cVehicle& what) {
|
||||
if(editing_town && cur_town != what.which_town) return false;
|
||||
else if(!editing_town && what.which_town != 200) return false;
|
||||
return what.loc == spot_hit;
|
||||
});
|
||||
if(iter == all.end()) {
|
||||
iter = std::find_if(all.begin(), all.end(), [](const cVehicle& what) {
|
||||
return what.which_town < 0;
|
||||
});
|
||||
if(iter == all.end()) {
|
||||
all.emplace_back();
|
||||
iter = all.end() - 1;
|
||||
}
|
||||
iter->loc = spot_hit;
|
||||
iter->which_town = editing_town ? cur_town : 200;
|
||||
iter->property = false;
|
||||
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);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
}
|
||||
case MODE_INTRO_SCREEN:
|
||||
case MODE_EDIT_TYPES:
|
||||
case MODE_MAIN_SCREEN:
|
||||
@@ -1507,6 +1534,14 @@ static bool handle_toolpal_action(location cur_point2) {
|
||||
draw_mode = DRAW_MONST;
|
||||
set_up_terrain_buttons(true);
|
||||
break;
|
||||
case PAL_BOAT:
|
||||
set_string("Place/edit boat","Select boat location");
|
||||
overall_mode = MODE_PLACE_BOAT;
|
||||
break;
|
||||
case PAL_HORSE:
|
||||
set_string("Place/edit horse","Select horse location");
|
||||
overall_mode = MODE_PLACE_HORSE;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user