79 :(NSMutableDictionary *)context
80{
81 NSMutableDictionary *result = [NSMutableDictionary dictionary];
82 if (context ==
nil) context = [NSMutableDictionary dictionary];
83
84 [result setObject:_shipKey forKey:KEY_SHIP_KEY];
85
86 NSMutableDictionary *updatedShipInfo = [NSMutableDictionary dictionaryWithDictionary:shipinfoDictionary];
87
88 [updatedShipInfo setObject:[[self roleSet] roleString] forKey:KEY_ROLES];
89 [updatedShipInfo oo_setUnsignedInteger:fuel forKey:KEY_FUEL];
90 [updatedShipInfo oo_setUnsignedLongLong:bounty forKey:KEY_BOUNTY];
91 [updatedShipInfo setObject:OOStringFromWeaponType(forward_weapon_type) forKey:KEY_FORWARD_WEAPON];
92 [updatedShipInfo setObject:OOStringFromWeaponType(aft_weapon_type) forKey:KEY_AFT_WEAPON];
93 [updatedShipInfo setObject:OOStringFromScanClass(scanClass) forKey:KEY_SCAN_CLASS];
94
95 NSArray *deletes =
nil;
96 [self simplifyShipdata:updatedShipInfo andGetDeletes:&deletes];
97
98 [result setObject:updatedShipInfo forKey:KEY_SHIPDATA_OVERRIDES];
99 if (deletes !=
nil) [result setObject:deletes forKey:KEY_SHIPDATA_DELETES];
100
102 {
103 [result oo_setHPVector:[self position] forKey:KEY_POSITION];
104 }
106 {
107 [result oo_setQuaternion:[self normalOrientation] forKey:KEY_ORIENTATION];
108 }
109
110 if (energy != maxEnergy) [result oo_setFloat:energy / maxEnergy forKey:KEY_ENERGY_LEVEL];
111
112 [result setObject:[self primaryRole] forKey:KEY_PRIMARY_ROLE];
113
114
115 NSArray *equipment = [[self equipmentEnumerator] allObjects];
116 if ([equipment
count] != 0) [result setObject:equipment forKey:KEY_EQUIPMENT];
117
118
119 if (missiles > 0)
120 {
121 NSMutableArray *missileArray = [NSMutableArray array];
122 unsigned i;
123 for (i = 0; i < missiles; i++)
124 {
125 NSString *missileType = [missile_list[i] identifier];
126 if (missileType !=
nil) [missileArray addObject:missileType];
127 }
128 [result setObject:missileArray forKey:KEY_MISSILES];
129 }
130
131
133 {
134 [result oo_setUnsignedInteger:GroupIDForGroup(_group, context) forKey:KEY_GROUP_ID];
135 if ([_group leader] == self) [result oo_setBool:YES forKey:KEY_IS_GROUP_LEADER];
136 NSString *groupName = [_group name];
137 if (groupName !=
nil)
138 {
139 [result setObject:groupName forKey:KEY_GROUP_NAME];
140 }
141 }
142 if (_escortGroup !=
nil)
143 {
144 [result oo_setUnsignedInteger:GroupIDForGroup(_escortGroup, context) forKey:KEY_ESCORT_GROUP_ID];
145 }
146
147
148
149
150 else if (_group !=
nil && [_group leader] ==
self)
151 {
152 [result oo_setUnsignedInteger:GroupIDForGroup(_group, context) forKey:KEY_ESCORT_GROUP_ID];
153 }
154
155
156
157
158 if ([[[self getAI] name] isEqualToString:@"nullAI.plist"])
159 {
160
161 [result setObject:[[self getAI] associatedJS] forKey:KEY_AI];
162
163 }
164 else
165 {
166 [result setObject:[[self getAI] name] forKey:KEY_AI];
167 }
168
169 return result;
170}
const HPVector kZeroHPVector
const Quaternion kIdentityQuaternion