Skip to content

Commit 30f2a59

Browse files
author
rt
committed
fix #4122
1 parent f5b323f commit 30f2a59

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

rts/Sim/Misc/GroundBlockingObjectMap.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,10 @@ CSolidObject* CGroundBlockingObjectMap::GroundBlockedUnsafe(int mapSquare) const
150150

151151
const BlockingMapCell& cell = groundBlockingMap[mapSquare];
152152

153-
if (cell.empty()) {
153+
if (cell.empty())
154154
return NULL;
155-
}
156155

157-
return cell.begin()->second;
156+
return ((cell.begin())->second);
158157
}
159158

160159

@@ -182,14 +181,14 @@ bool CGroundBlockingObjectMap::GroundBlocked(int x, int z, CSolidObject* ignoreO
182181

183182
GML_STDMUTEX_LOCK(block); // GroundBlockedUnsafe
184183

185-
if (groundBlockingMap[mapSquare].empty()) {
184+
if (groundBlockingMap[mapSquare].empty())
186185
return false;
187-
}
188186

189187
const int objID = GetObjectID(ignoreObj);
190-
191188
const BlockingMapCell& cell = groundBlockingMap[mapSquare];
189+
192190
BlockingMapCellIt it = cell.begin();
191+
193192
if (it != cell.end()) {
194193
if (it->first != objID) {
195194
// there are other objects blocking the square

rts/Sim/MoveTypes/MoveType.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ void AMoveType::SlowUpdate()
7777
owner->losHeight -= agh;
7878
owner->radarHeight -= agh;
7979
}
80-
if (owner->IsOnGround() && owner->unitDef->IsGroundUnit()) {
80+
81+
if ((owner->IsOnGround() || owner->IsInWater()) && owner->unitDef->IsGroundUnit()) {
8182
// always (re-)add us to occupation map if we moved
8283
// (since our last SlowUpdate) and are on the ground
84+
// NOTE: ships are ground units but not on the ground
8385
owner->Block();
8486
}
8587
}

0 commit comments

Comments
 (0)