Skip to content

Commit

Permalink
KOTORBASE: Remove redundant calls to isLocationReached
Browse files Browse the repository at this point in the history
  • Loading branch information
vkremianskii authored and DrMcCoy committed Jul 7, 2019
1 parent 379b592 commit 60a90ed
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/engines/kotorbase/actionexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,9 @@ void ActionExecutor::executeFollowLeader(const Action &action, const ExecutionCo
void ActionExecutor::executeOpenLock(const Action &action, const ExecutionContext &ctx) {
float x, y, _;
action.object->getPosition(x, y, _);
glm::vec2 location(x, y);

bool locReached = isLocationReached(location, action.range, ctx);
if (!locReached) {
moveTo(location, action.range, ctx);
if (!moveTo(glm::vec2(x, y), action.range, ctx))
return;
}

ctx.creature->popAction();

Expand Down Expand Up @@ -112,13 +108,9 @@ void ActionExecutor::executeOpenLock(const Action &action, const ExecutionContex
void ActionExecutor::executeUseObject(const Action &action, const ExecutionContext &ctx) {
float x, y, _;
action.object->getPosition(x, y, _);
glm::vec2 location(x, y);

bool locReached = isLocationReached(location, action.range, ctx);
if (!locReached) {
moveTo(location, action.range, ctx);
if (!moveTo(glm::vec2(x, y), action.range, ctx))
return;
}

ctx.creature->popAction();

Expand Down

0 comments on commit 60a90ed

Please sign in to comment.