Browse Source

Update to ordering of logic

feature-workorder
MagicBot 1 year ago
parent
commit
c93e3bc947
  1. 16
      src/engine/gameManager/BuildingManager.java

16
src/engine/gameManager/BuildingManager.java

@ -310,11 +310,9 @@ public enum BuildingManager {
public static void removeHireling(Building building, AbstractCharacter hireling) { public static void removeHireling(Building building, AbstractCharacter hireling) {
Mob guardCaptain = null;
if (hireling.getObjectType().equals(GameObjectType.Mob)) { if (hireling.getObjectType().equals(GameObjectType.Mob)) {
guardCaptain = (Mob) hireling; Mob guardCaptain = (Mob) hireling;
// Clear minions from database if a guard captain // Clear minions from database if a guard captain
@ -338,6 +336,12 @@ public enum BuildingManager {
building.getHirelings().remove(hireling); building.getHirelings().remove(hireling);
// Unload hireling from world
DbManager.removeFromCache(hireling);
WorldGrid.RemoveWorldObject(hireling);
WorldGrid.removeObject(hireling);
// Delete hireling from database // Delete hireling from database
if (hireling.getObjectType().equals(GameObjectType.Mob)) if (hireling.getObjectType().equals(GameObjectType.Mob))
@ -345,12 +349,6 @@ public enum BuildingManager {
else else
DbManager.NPCQueries.DELETE_NPC((NPC) hireling); DbManager.NPCQueries.DELETE_NPC((NPC) hireling);
// Unload hireling from world
DbManager.removeFromCache(hireling);
WorldGrid.RemoveWorldObject(hireling);
WorldGrid.removeObject(hireling);
} }

Loading…
Cancel
Save