Clarify thread safety in update methods

Updated comments in GameScreen.cs to indicate that StatusEffect.UpdateAll and Character.UpdateAnimAll are not thread-safe and must be executed on the main thread. Also removed a non-English comment from MapEntity.cs for consistency.
This commit is contained in:
eero
2025-12-22 18:07:17 +08:00
parent b146fa326d
commit 5b823d8684
2 changed files with 4 additions and 3 deletions
@@ -638,7 +638,7 @@ namespace Barotrauma
} }
/// <summary> /// <summary>
/// Call Update() on every object in Entity.list - 完全并行版本 /// Call Update() on every object in Entity.list
/// </summary> /// </summary>
public static void UpdateAll(float deltaTime, Camera cam , ParallelOptions parallelOptions) public static void UpdateAll(float deltaTime, Camera cam , ParallelOptions parallelOptions)
{ {
@@ -276,8 +276,9 @@ namespace Barotrauma
MapEntity.UpdateAll((float)deltaTime, cam, parallelOptions); MapEntity.UpdateAll((float)deltaTime, cam, parallelOptions);
#elif SERVER #elif SERVER
// TODO: Move both UpdateAll() method to this file
MapEntity.UpdateAll((float)deltaTime, Camera.Instance, parallelOptions); MapEntity.UpdateAll((float)deltaTime, Camera.Instance, parallelOptions);
//StatusEffect.UpdateAll is not thread-safe and must be executed on the main thread
StatusEffect.UpdateAll((float)deltaTime); StatusEffect.UpdateAll((float)deltaTime);
#endif #endif
@@ -287,7 +288,7 @@ namespace Barotrauma
GameMain.PerformanceCounter.AddElapsedTicks("Update:MapEntity", sw.ElapsedTicks); GameMain.PerformanceCounter.AddElapsedTicks("Update:MapEntity", sw.ElapsedTicks);
sw.Restart(); sw.Restart();
#endif #endif
//Character.UpdateAnimAll is not thread-safe and must be executed on the main thread
Character.UpdateAnimAll((float)deltaTime); Character.UpdateAnimAll((float)deltaTime);
#if CLIENT #if CLIENT