Skip to content

Commit

Permalink
Merge branch 'release/1.2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bam4d committed Aug 4, 2021
2 parents f358088 + 58310ff commit 307dfb1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Griddly/Core/Grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,10 @@ std::unordered_map<uint32_t, int32_t> Grid::executeAndRecord(uint32_t playerId,
}

std::unordered_map<uint32_t, int32_t> Grid::executeAction(uint32_t playerId, std::shared_ptr<Action> action) {


float executionProbability = 1.0;

auto executionProbabilityIt = actionProbabilities_.find(action->getActionName());
if(executionProbabilityIt != actionProbabilities_.end()) {
if (executionProbabilityIt != actionProbabilities_.end()) {
executionProbability = executionProbabilityIt->second;
}

Expand Down Expand Up @@ -572,9 +570,12 @@ bool Grid::removeObject(std::shared_ptr<Object> object) {
invalidateLocation(location);

// if we are removing a player's avatar
if (playerAvatars_.size() > 0 && playerId != 0 && playerAvatars_.at(playerId) == object) {
spdlog::debug("Removing player {0} avatar {1}", playerId, objectName);
playerAvatars_.erase(playerId);
if (playerAvatars_.size() > 0 && playerId != 0) {
auto playerAvatarIt = playerAvatars_.find(playerId);
if (playerAvatarIt != playerAvatars_.end() && playerAvatarIt->second == object) {
spdlog::debug("Removing player {0} avatar {1}", playerId, objectName);
playerAvatars_.erase(playerId);
}
}

if (collisionDetectors_.size() > 0) {
Expand Down

0 comments on commit 307dfb1

Please sign in to comment.