Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: [0.9a RC10] ClassCastException with ShipAPI.getShipAI() during transfer command  (Read 890 times)

Nick XR

  • Admiral
  • *****
  • Posts: 713
    • View Profile

Only happens when attempting to transfer command during combat.

Here's the line that causes it (s is a ShipAPI objet)
Code
f(s == null || s.getName() == null || s.getShipAI() == null || s.getId() == null){


Here's the full stack:

Code
java.lang.ClassCastException: com.fs.starfarer.combat.ai.movement.maneuvers.TransferCommandAI cannot be cast to com.fs.starfarer.api.combat.ShipAIPlugin
at com.fs.starfarer.combat.entities.Ship.getShipAI(Unknown Source)
at data.scripts.coopcombat.CoOpEveryFrameCombatPlugin.renderInWorldCoords(CoOpEveryFrameCombatPlugin.java:45)
at com.fs.starfarer.title.C.K$Oo.new(Unknown Source)
at com.fs.starfarer.combat.super.OoOO.new(Unknown Source)
at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24143
    • View Profile

Hmm - so this maybe shouldn't crash, but also, I don't think there's anything to gain from getting the AI of a shuttlepod. I think adding !s.isShuttlePod() to the if statement should get around this.
Logged