Definition at line 35 of file OORoleSet.m.
◆ initWithRolesAndProbabilities:
| - (id) initWithRolesAndProbabilities: |
|
(NSDictionary *) |
dict |
|
Definition at line 312 of file OORoleSet.m.
262 :(NSDictionary *)dict
263{
264 NSString *role =
nil;
265 float prob;
266
268 {
269 [self release];
271 }
272
273 self = [super init];
274 if (
self ==
nil)
return nil;
275
276
277
278
279
280 assert(_roles ==
nil && _roleString ==
nil);
281
282 NSMutableDictionary *tDict = [[dict mutableCopy] autorelease];
283 float thargProb = [dict oo_floatForKey:@"thargon" defaultValue:0.0f];
284
285 if ( thargProb > 0.0f && [dict objectForKey:
@"EQ_THARGON"] ==
nil)
286 {
287 [tDict setObject:[NSNumber numberWithFloat:thargProb] forKey:@"EQ_THARGON"];
288 [tDict removeObjectForKey:@"thargon"];
289 }
290
291 _rolesAndProbabilities = [tDict copy];
292
294 {
295 prob = [dict oo_floatForKey:role defaultValue:-1];
296 if (prob < 0)
297 {
298 OOLog(
@"roleSet.badValue",
@"Attempt to create a role set with negative or non-numerical probability for role %@.", role);
299 [self release];
301 }
302
303 _totalProb += prob;
304 }
305
306 return self;
307}
#define foreachkey(VAR, DICT)
#define OOLog(class, format,...)
The documentation for this category was generated from the following file: