Skip to content

Commit 8979ae4

Browse files
committed
1 parent e8a2855 commit 8979ae4

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/game/server/tf/workshop/maps_workshop.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,20 +217,33 @@ void CTFWorkshopMap::Steam_OnQueryUGCDetails( SteamUGCQueryCompleted_t *pResult,
217217
}
218218

219219
uint32 state = steamUGC->GetItemState( m_nFileID );
220-
if (( state & k_EItemStateNeedsUpdate ) ||
221-
!( state & ( k_EItemStateDownloading | k_EItemStateDownloadPending | k_EItemStateInstalled ) ) )
220+
#ifdef BDSBASE
221+
if (!(state & k_EItemStateDownloading))
222+
#else
223+
if ((state & k_EItemStateNeedsUpdate) ||
224+
!(state & (k_EItemStateDownloading | k_EItemStateDownloadPending | k_EItemStateInstalled)) )
225+
#endif
222226
{
223227
// Either out of date or not installed, downloading, or queued to download, ask UGC to do so. The latter happens
224228
// for maps added not from subscriptions that have no reason for UGC to initiate downloads on its own.
229+
230+
// For some reason GetItemState returns stale data, the k_EItemStateNeedsUpdate flag is not set
231+
// In the past this behaviour was already done for dedicated servers but not for clients, causing clients to be out-of-date when the map updated
232+
// DownloadItem does an update check, no unnecessary downloads are done
225233
if ( !steamUGC->DownloadItem( m_nFileID, m_bHighPriority ) )
226234
{
227235
TFWorkshopWarning( "DownloadItem failed for file, map will not be usable [ %s ]\n", m_strCanonicalName.Get() );
228236
return;
229237
}
230238

231-
TFWorkshopMsg( "New version available for map, download queued [ %s ]\n", m_strCanonicalName.Get() );
239+
#ifdef BDSBASE
240+
TFWorkshopMsg("Map update queued [ %s ]\n", m_strCanonicalName.Get());
241+
#else
242+
TFWorkshopMsg("New version available for map, download queued [ %s ]\n", m_strCanonicalName.Get());
243+
#endif
232244
m_eState = eState_Downloading;
233245
}
246+
#ifndef BDSBASE
234247
else if ( engine->IsDedicatedServer() &&
235248
( state & k_EItemStateInstalled ) &&
236249
!( state & k_EItemStateDownloading ) &&
@@ -254,8 +267,9 @@ void CTFWorkshopMap::Steam_OnQueryUGCDetails( SteamUGCQueryCompleted_t *pResult,
254267
TFWorkshopMsg( "Got updated information for map [ %s ]\n", m_strCanonicalName.Get() );
255268
m_eState = Downloaded() ? eState_Downloaded : eState_Downloading;
256269
}
270+
#endif
257271

258-
// Notify gamerules of the udpate
272+
// Notify gamerules of the update
259273
TFGameRules()->OnWorkshopMapUpdated( m_nFileID );
260274
}
261275

0 commit comments

Comments
 (0)