Skip to content

Commit

Permalink
Merge pull request #195 from GuoWQ222/dev
Browse files Browse the repository at this point in the history
fix small bugs
  • Loading branch information
asdawej authored Apr 10, 2024
2 parents f7c65bc + 9d8894f commit 1da1a81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions logic/Gaming/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public bool MoveShip(long teamID, long shipID, int moveTimeInMilliseconds, doubl
if (!gameMap.Timer.IsGaming)
return false;
Ship? ship = gameMap.FindShipInPlayerID(teamID, shipID);
if (ship != null)
if (ship != null && ship.IsRemoved == false)
{
return actionManager.MoveShip(ship, moveTimeInMilliseconds, angle);
}
Expand All @@ -145,7 +145,7 @@ public bool Produce(long teamID, long shipID)
if (!gameMap.Timer.IsGaming)
return false;
Ship? ship = gameMap.FindShipInPlayerID(teamID, shipID);
if (ship != null)
if (ship != null && ship.IsRemoved == false)
return actionManager.Produce(ship);
return false;
}
Expand All @@ -154,7 +154,7 @@ public bool Construct(long teamID, long shipID, ConstructionType constructionTyp
if (!gameMap.Timer.IsGaming)
return false;
Ship? ship = gameMap.FindShipInPlayerID(teamID, shipID);
if (ship != null)
if (ship != null && ship.IsRemoved == false)
{
return actionManager.Construct(ship, constructionType);
}
Expand All @@ -165,7 +165,7 @@ public bool InstallModule(long teamID, long shipID, ModuleType moduleType)
if (!gameMap.Timer.IsGaming)
return false;
Ship? ship = gameMap.FindShipInPlayerID(teamID, shipID);
if (ship != null)
if (ship != null && ship.IsRemoved == false)
return moduleManager.InstallModule(ship, moduleType);
return false;
}
Expand All @@ -174,7 +174,7 @@ public bool Recover(long teamID, long shipID, long recover)
if (!gameMap.Timer.IsGaming)
return false;
Ship? ship = gameMap.FindShipInPlayerID(teamID, shipID);
if (ship != null)
if (ship != null && ship.IsRemoved == false)
{
bool validRecoverPoint = false;
foreach (XY recoverPoint in teamList[(int)ship.TeamID].BirthPointList)
Expand All @@ -197,7 +197,7 @@ public bool Recycle(long teamID, long shipID)
if (!gameMap.Timer.IsGaming)
return false;
Ship? ship = gameMap.FindShipInPlayerID(teamID, shipID);
if (ship != null)
if (ship != null && ship.IsRemoved == false)
{
bool validRecyclePoint = false;
foreach (XY recyclePoint in teamList[(int)ship.TeamID].BirthPointList)
Expand Down Expand Up @@ -238,7 +238,7 @@ public bool Attack(long teamID, long shipID, double angle)
if (!gameMap.Timer.IsGaming)
return false;
Ship? ship = gameMap.FindShipInPlayerID(teamID, shipID);
if (ship != null)
if (ship != null && ship.IsRemoved == false)
return attackManager.Attack(ship, angle);
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions logic/Server/CopyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public static class CopyInfo
{
public static MessageOfObj? Auto(GameObj gameObj, long time)
{
if (gameObj.IsRemoved == true)
return null;
switch (gameObj.Type)
{
case GameObjType.Ship:
Expand Down

0 comments on commit 1da1a81

Please sign in to comment.