mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-22 20:55:52 +12:00
Fix Arena TOCTOU
This commit is contained in:
parent
ab05db6cbf
commit
51223172c4
4 changed files with 35 additions and 11 deletions
|
@ -157,7 +157,7 @@ namespace HISP.Game.Horse
|
|||
|
||||
public void Escape()
|
||||
{
|
||||
while(true)
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
int tryX = X + GameServer.RandomNumberGenerator.Next(-5, 5);
|
||||
int tryY = Y + GameServer.RandomNumberGenerator.Next(-5, 5);
|
||||
|
@ -168,10 +168,11 @@ namespace HISP.Game.Horse
|
|||
{
|
||||
X = tryX;
|
||||
Y = tryY;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Logger.ErrorPrint("Horse is stuck (cannot move after 1000 tries) " + Instance.Breed.Name + " at X" + X + " Y" + Y);
|
||||
}
|
||||
|
||||
public void Capture(User forUser)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue