Skip to content

Commit

Permalink
fix: 🐛 rebuild ship
Browse files Browse the repository at this point in the history
  • Loading branch information
panxuc committed May 11, 2024
1 parent 9f05442 commit dd2011e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion logic/Gaming/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public long ActivateShip(long teamID, ShipType shipType, int birthPointIndex = 0
birthPointIndex = teamList[(int)teamID].BirthPointList.Count - 1;
XY pos = teamList[(int)teamID].BirthPointList[birthPointIndex];
pos += new XY(((random.Next() & 2) - 1) * 1000, ((random.Next() & 2) - 1) * 1000);
if (ShipManager.ActivateShip(ship, pos))
if (shipManager.ActivateShip(ship, pos))
{
GameLogging.logger.ConsoleLogDebug($"Successfully activated {teamID} {shipType} at {pos}");
return ship.PlayerID;
Expand Down
4 changes: 2 additions & 2 deletions logic/Gaming/ShipManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ private class ShipManager(Game game, Map gameMap)
public Ship? AddShip(long teamID, long playerID, ShipType shipType, MoneyPool moneyPool)
{
Ship newShip = new(GameData.ShipRadius, shipType, moneyPool);
gameMap.Add(newShip);
newShip.TeamID.SetROri(teamID);
newShip.PlayerID.SetROri(playerID);
ShipManagerLogging.logger.ConsoleLogDebug(
Expand All @@ -32,12 +31,13 @@ private class ShipManager(Game game, Map gameMap)
+ $"{newShip.WeaponModuleType}");
return newShip;
}
public static bool ActivateShip(Ship ship, XY pos)
public bool ActivateShip(Ship ship, XY pos)
{
if (ship.ShipState != ShipStateType.Deceased)
{
return false;
}
gameMap.Add(ship);
ship.ReSetPos(pos);
ship.SetShipState(RunningStateType.Null, ShipStateType.Null);
ShipManagerLogging.logger.ConsoleLogDebug(
Expand Down

0 comments on commit dd2011e

Please sign in to comment.