Fix Arena TOCTOU

This commit is contained in:
SilicaAndPina 2021-05-12 22:14:22 +12:00
parent ab05db6cbf
commit 51223172c4
4 changed files with 35 additions and 11 deletions

View file

@ -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)