Skip to content

Commit

Permalink
fix: 💩 fix the bug temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
shangfengh committed Apr 28, 2023
1 parent 749c3e6 commit 0bf5781
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
4 changes: 3 additions & 1 deletion docs/QandA.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ A:
2. 不要点重新生成,要点生成
3. 开启下图选项
![CompileFaster](https://raw.githubusercontent.com/shangfengh/THUAI6/new/resource/CompileFaster.png)


Q:这是什么错误啊
![vector](https://raw.githubusercontent.com/shangfengh/THUAI6/new/resource/vector.png)

## Python

Expand Down
6 changes: 3 additions & 3 deletions logic/GameClass/GameObj/Map/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,14 @@ public bool Remove(GameObj gameObj)
break;
}
}
if (ToDel != null)
GameObjDict[gameObj.Type].Remove(ToDel);
}
finally
{
GameObjLockDict[gameObj.Type].ExitWriteLock();
}
if (ToDel == null) return false;
GameObjDict[gameObj.Type].Remove(ToDel);
return true;
return ToDel != null;
}
public bool RemoveJustFromMap(GameObj gameObj)
{
Expand Down
12 changes: 8 additions & 4 deletions logic/GameEngine/MoveEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,16 @@ public void MoveObj(IMoveable obj, int moveTime, double direction)
isDestroyed = true;
return false;
case AfterCollision.MoveMax:
MoveMax(obj, res);
if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum)
MoveMax(obj, res);
moveVecLength = 0;
res = new XY(direction, moveVecLength);
break;
}
} while (flag);

deltaLen += moveVecLength - Math.Sqrt(obj.MovingSetPos(res, GetPlaceType(obj.Position + res)));
if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum)
deltaLen += moveVecLength - Math.Sqrt(obj.MovingSetPos(res, GetPlaceType(obj.Position + res)));

return true;
},
Expand All @@ -172,7 +174,8 @@ public void MoveObj(IMoveable obj, int moveTime, double direction)
res = new XY(direction, moveVecLength);
if ((collisionObj = collisionChecker.CheckCollisionWhenMoving(obj, res)) == null)
{
obj.MovingSetPos(res, GetPlaceType(obj.Position + res));
if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum)
obj.MovingSetPos(res, GetPlaceType(obj.Position + res));
}
else
{
Expand All @@ -186,7 +189,8 @@ public void MoveObj(IMoveable obj, int moveTime, double direction)
isDestroyed = true;
break;
case AfterCollision.MoveMax:
MoveMax(obj, res);
if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum)
MoveMax(obj, res);
moveVecLength = 0;
res = new XY(direction, moveVecLength);
break;
Expand Down
2 changes: 1 addition & 1 deletion logic/Server/CopyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private static MessageOfObj Chest(Chest chest, int time)
Y = chest.Position.y
}
};
int progress = (chest.WhoOpen!=null) ? ((time - chest.OpenStartTime) * chest.WhoOpen.SpeedOfOpenChest) : 0;
int progress = (chest.WhoOpen != null) ? ((time - chest.OpenStartTime) * chest.WhoOpen.SpeedOfOpenChest) : 0;
msg.ChestMessage.Progress = (progress > GameData.degreeOfOpenedChest) ? GameData.degreeOfOpenedChest : progress;
return msg;
}
Expand Down
2 changes: 1 addition & 1 deletion logic/cmd/gameServerAndClient.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --studentCount 4 --trickerCount 1 --gameTimeInSecond 600 --fileName test
start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --studentCount 0 --trickerCount 1 --gameTimeInSecond 600 --fileName test

ping -n 2 127.0.0.1 > NUL

Expand Down
Binary file added resource/vector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0bf5781

Please sign in to comment.