public void saveState(Session s) throws Exception {
    
    s.saveInt(homeworld == null ? -1 : homeworld.ID) ;
    s.saveInt(partners.size()) ;
    for (System p : partners) s.saveInt(p.ID) ;
    
    for (int i = NUM_J ; i-- > 0 ;) {
      s.saveFloat(jobSupply[i]) ;
      s.saveFloat(jobDemand[i]) ;
    }
    
    shortages.saveState(s) ;
    surpluses.saveState(s) ;
    for (Service type : ALL_COMMODITIES) {
      s.saveFloat(importPrices.get(type)) ;
      s.saveFloat(exportPrices.get(type)) ;
    }
    
    s.saveObjects(candidates) ;
    s.saveObjects(migrantsIn) ;
    s.saveObject(ship) ;
    s.saveFloat(nextVisitTime) ;
  }