diff --git a/src/npc.cpp b/src/npc.cpp index 3d2900994c..0479821f93 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -479,8 +479,9 @@ bool Npc::canWalkTo(const Position& fromPos, Direction dir) const bool Npc::getRandomStep(Direction& dir) const { std::vector dirList; - const Position& creaturePos = getPosition(); + dirList.reserve(4); + const Position& creaturePos = getPosition(); if (canWalkTo(creaturePos, DIRECTION_NORTH)) { dirList.push_back(DIRECTION_NORTH); }