I investigated a bit further and it looks like we might actually not dealing with a bug here. Additional info I added to the log messages indicate that those ships had no name, no owner, no design, all stats zero, no nothing. Looking at the code of Ship::Copy...
Code: Select all
if (vis >= VIS_BASIC_VISIBILITY) {
if (this->m_fleet_id != copied_ship->m_fleet_id) {
// as with other containers, removal from the old container is triggered by the contained Object; removal from System is handled by UniverseObject::Copy
if (TemporaryPtr<Fleet> oldFleet = GetFleet(this->m_fleet_id))
oldFleet->RemoveShip(this->ID());
this->m_fleet_id = copied_ship->m_fleet_id; // as with other containers (Systems), actual insertion into fleet ships set is handled by the fleet
}
if (vis >= VIS_PARTIAL_VISIBILITY) {
if (this->Unowned())
this->m_name = copied_ship->m_name;
this->m_design_id = copied_ship->m_design_id;
But apparently now and then it does happen that an empire can "see" a ship with only basic visibility, so it basically only knows that it's there, but that's it - no stats, no info about the owner or the design, nothing. Causing errors whenever the AI code tries to access the design of such a ship of course. As far as I can tell this currently happens in two places, the one in AIstate.py Morlic fixed in the PR mentioned above, and the other one in GetEffectsAndTargets, which apparently gets called when the AI client runs meter estimates:
Code: Select all
2015-12-28 18:24:29.868592 [debug] AI : Universe::InitMeterEstimatesAndDiscrepancies
2015-12-28 18:24:29.868618 [debug] AI : IMEAD: updating meter estimates
2015-12-28 18:24:29.877236 [error] AI : Universe.cpp:2092 : GetEffectsAndTargets couldn't get ShipDesign
2015-12-28 18:24:29.877289 [error] AI : Universe.cpp:2093 : OBJ_SHIP 1122: at: Hewish γ owner: (Unowned) created on turn: 65 specials: Meters: Target Industry: Cur: 0 Init: 0 Target Research: Cur: 0 Init: 0 Target Trade: Cur: 0 Init: 0 Max Fuel: Cur: 0 Init: 0 Max Shield: Cur: 0 Init: 0 Max Structure: Cur: 0 Init: 0 Industry: Cur: 0 Init: 0 Research: Cur: 0 Init: 0 Trade: Cur: 0 Init: 0 Fuel: Cur: 0 Init: 0 Shield: Cur: 0 Init: 0 Structure: Cur: 0 Init: 0 Stealth: Cur: 0 Init: 65536 Detection Range: Cur: 0 Init: 0 Speed: Cur: 0 Init: 0 design id: -1 fleet id: 1123 species name: produced by empire id: -1 fighters: part meters: