Browse Source

null check

combat-2
FatBoy-DOTC 1 year ago
parent
commit
c3e206e3b1
  1. 25
      src/engine/net/client/handlers/MoveToPointHandler.java

25
src/engine/net/client/handlers/MoveToPointHandler.java

@ -37,19 +37,20 @@ public class MoveToPointHandler extends AbstractClientMsgHandler { @@ -37,19 +37,20 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
Enum.GameObjectType targetType;
targetType = Enum.GameObjectType.values()[msg.getTargetType()];
switch(targetType){
case Building:
target = BuildingManager.getBuilding(msg.getTargetID());
if(target == null)
return true;// early exit for no building pulled
Building targetBuilding = (Building) target;
if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0)
return true;// cannot attack destroyed building or protected building
break;
case NPC:
return true;//cannot attack anything other than the 3 above
if(targetType != null) {
switch (targetType) {
case Building:
target = BuildingManager.getBuilding(msg.getTargetID());
if (target == null)
return true;// early exit for no building pulled
Building targetBuilding = (Building) target;
if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0)
return true;// cannot attack destroyed building or protected building
break;
case NPC:
return true;//cannot attack anything other than the 3 above
}
}
MovementManager.movement(msg, pc);
return true;
}

Loading…
Cancel
Save