Connect new plan lines to end of previous line when ctrl pressed
This commit is contained in:
@@ -162,6 +162,7 @@ struct Plan : PlanPool::PoolItem<&_plan_pool> {
|
|||||||
Owner owner;
|
Owner owner;
|
||||||
PlanLineVector lines;
|
PlanLineVector lines;
|
||||||
PlanLine *temp_line;
|
PlanLine *temp_line;
|
||||||
|
TileIndex last_tile;
|
||||||
bool visible;
|
bool visible;
|
||||||
bool visible_by_all;
|
bool visible_by_all;
|
||||||
bool show_lines;
|
bool show_lines;
|
||||||
@@ -178,6 +179,7 @@ struct Plan : PlanPool::PoolItem<&_plan_pool> {
|
|||||||
this->show_lines = false;
|
this->show_lines = false;
|
||||||
this->colour = COLOUR_WHITE;
|
this->colour = COLOUR_WHITE;
|
||||||
this->temp_line = new PlanLine();
|
this->temp_line = new PlanLine();
|
||||||
|
this->last_tile = INVALID_TILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Plan()
|
~Plan()
|
||||||
@@ -236,6 +238,7 @@ struct Plan : PlanPool::PoolItem<&_plan_pool> {
|
|||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
this->temp_line->MarkDirty();
|
this->temp_line->MarkDirty();
|
||||||
|
this->last_tile = this->temp_line->tiles.back();
|
||||||
this->temp_line->Clear();
|
this->temp_line->Clear();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -381,6 +381,10 @@ struct PlansWindow : Window {
|
|||||||
const Point p = GetTileBelowCursor();
|
const Point p = GetTileBelowCursor();
|
||||||
const TileIndex tile = TileVirtXY(p.x, p.y);
|
const TileIndex tile = TileVirtXY(p.x, p.y);
|
||||||
if (_current_plan && tile < MapSize()) {
|
if (_current_plan && tile < MapSize()) {
|
||||||
|
if (_ctrl_pressed && _current_plan->temp_line->tiles.empty() && _current_plan->last_tile != INVALID_TILE) {
|
||||||
|
_current_plan->StoreTempTile(_current_plan->last_tile);
|
||||||
|
_current_plan->last_tile = INVALID_TILE;
|
||||||
|
}
|
||||||
_current_plan->StoreTempTile(tile);
|
_current_plan->StoreTempTile(tile);
|
||||||
_thd.selstart = _thd.selend;
|
_thd.selstart = _thd.selend;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user