From f53b295a58c8306c744d2f04035a44410cdfbbc9 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 16 Nov 2021 00:02:08 +0000 Subject: [PATCH] Fix overuse of _current_plan in struct Plan methods --- src/plans_base.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plans_base.h b/src/plans_base.h index 7a5f8482d7..6e3e4b27fb 100644 --- a/src/plans_base.h +++ b/src/plans_base.h @@ -231,11 +231,11 @@ struct Plan : PlanPool::PoolItem<&_plan_pool> { uint buffer_length = 0; const TileIndex *buffer = this->temp_line->Export(&buffer_length); if (buffer) { - _current_plan->SetVisibility(true, false); - ret = DoCommandPEx(0, _current_plan->index, (uint32) this->temp_line->tiles.size(), 0, CMD_ADD_PLAN_LINE, nullptr, (const char *) buffer, buffer_length); + this->SetVisibility(true, false); + ret = DoCommandPEx(0, this->index, (uint32) this->temp_line->tiles.size(), 0, CMD_ADD_PLAN_LINE, nullptr, (const char *) buffer, buffer_length); free(buffer); } - _current_plan->temp_line->MarkDirty(); + this->temp_line->MarkDirty(); this->temp_line->Clear(); } return ret; @@ -259,13 +259,13 @@ struct Plan : PlanPool::PoolItem<&_plan_pool> { bool ToggleVisibilityByAll() { - if (_current_plan->owner == _local_company) DoCommandP(0, _current_plan->index, !this->visible_by_all, CMD_CHANGE_PLAN_VISIBILITY); + if (this->owner == _local_company) DoCommandP(0, this->index, !this->visible_by_all, CMD_CHANGE_PLAN_VISIBILITY); return this->visible_by_all; } void SetPlanColour(Colours colour) { - if (_current_plan->owner == _local_company) DoCommandP(0, _current_plan->index, colour, CMD_CHANGE_PLAN_COLOUR); + if (this->owner == _local_company) DoCommandP(0, this->index, colour, CMD_CHANGE_PLAN_COLOUR); } const std::string &GetName() const