DEADSOFTWARE

game: clean up TPlayer.GetRespawnPoint()
[d2df-sdl.git] / src / game / g_map.pas
index e99d47b19186dd65974751d9a2dd3e90539e3439..20bfa3bf1bee93ff29bc5471cb86a60cf214941a 100644 (file)
@@ -89,6 +89,7 @@ function  g_Map_IsSpecialTexture(Texture: String): Boolean;
 
 function  g_Map_GetPoint(PointType: Byte; var RespawnPoint: TRespawnPoint): Boolean;
 function  g_Map_GetPointCount(PointType: Byte): Word;
+function  g_Map_GetRandomPointType(): Byte;
 
 function  g_Map_HaveFlagPoints(): Boolean;
 
@@ -3122,6 +3123,14 @@ begin
       Result := Result + 1;
 end;
 
+function g_Map_GetRandomPointType(): Byte;
+begin
+  if RespawnPoints = nil then
+    Result := 255
+  else
+    Result := RespawnPoints[Random(Length(RespawnPoints))].PointType;
+end;
+
 function g_Map_HaveFlagPoints(): Boolean;
 begin
   Result := (FlagPoints[FLAG_RED] <> nil) and (FlagPoints[FLAG_BLUE] <> nil);