Skip to content

Commit

Permalink
#5972: Leave player start entity selected after placement
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jun 16, 2022
1 parent dad54bb commit ba96f62
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions radiantcore/selection/algorithm/Entity.cpp
Expand Up @@ -326,6 +326,7 @@ void placePlayerStart(const cmd::ArgumentList& args)
EntityNodeFindByClassnameWalker walker(PLAYERSTART_CLASSNAME);
GlobalSceneGraph().root()->traverse(walker);

auto playerStartNode = walker.getEntityNode();
auto playerStartEntity = walker.getEntity();

if (playerStartEntity == nullptr)
Expand All @@ -334,16 +335,19 @@ void placePlayerStart(const cmd::ArgumentList& args)
auto eclass = GlobalEntityClassManager().findClass(PLAYERSTART_CLASSNAME);
if (!eclass) throw cmd::ExecutionNotPossible(_("Could not find the info_player_start entityDef"));

auto playerStartNode = GlobalEntityModule().createEntity(eclass);
playerStartNode = GlobalEntityModule().createEntity(eclass);
scene::addNodeToContainer(playerStartNode, GlobalSceneGraph().root());

playerStartEntity = &playerStartNode->getEntity();
playerStartEntity = Node_getEntity(playerStartNode);

// Set a default angle
playerStartEntity->setKeyValue(ANGLE_KEY_NAME, DEFAULT_ANGLE);
}

playerStartEntity->setKeyValue("origin", string::to_string(position));

// #5972: Leave player start selected after placement
Node_setSelected(playerStartNode, true);
}

} // namespace algorithm
Expand Down

0 comments on commit ba96f62

Please sign in to comment.