Skip to content

Commit 586d6d6

Browse files
committed
Fix setMarkerType not restoring position (fixes #2194)
1 parent 146bd15 commit 586d6d6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Client/mods/deathmatch/logic/CClientMarker.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,27 +180,31 @@ void CClientMarker::SetMarkerType(CClientMarker::eMarkerType eType)
180180
{
181181
// Just change the type
182182
static_cast<CClientCheckpoint*>(m_pMarker)->SetCheckpointType(CClientCheckpoint::TYPE_RING);
183+
return;
183184
}
184185

185186
// Or current type is a ring and new type is a checkpoint?
186187
if (eCurrentType == MARKER_RING && eType == MARKER_CHECKPOINT)
187188
{
188189
// Just change the type
189190
static_cast<CClientCheckpoint*>(m_pMarker)->SetCheckpointType(CClientCheckpoint::TYPE_NORMAL);
191+
return;
190192
}
191193

192194
// Current type is a cylinder and new type is an arrow
193195
if (eCurrentType == MARKER_CYLINDER && eType == MARKER_ARROW)
194196
{
195197
// Just change the type
196198
static_cast<CClient3DMarker*>(m_pMarker)->Set3DMarkerType(CClient3DMarker::TYPE_ARROW);
199+
return;
197200
}
198201

199202
// Current type is an arrow and new type is an cylinder
200203
if (eCurrentType == MARKER_ARROW && eType == MARKER_CYLINDER)
201204
{
202205
// Just change the type
203206
static_cast<CClient3DMarker*>(m_pMarker)->Set3DMarkerType(CClient3DMarker::TYPE_CYLINDER);
207+
return;
204208
}
205209

206210
// No easy way of changing the type. Different classes. Remember position and color and recreate it.
@@ -218,6 +222,9 @@ void CClientMarker::SetMarkerType(CClientMarker::eMarkerType eType)
218222
// Create a new one of the correct type
219223
CreateOfType(eType);
220224

225+
// Reset stored position to re-apply last position (fixes issue #2194)
226+
m_vecPosition = {};
227+
221228
// Set the properties back
222229
SetPosition(vecPosition);
223230
SetSize(fSize);

0 commit comments

Comments
 (0)