Definition at line 34 of file OORoleSet.m.
◆ initWithRolesAndProbabilities:
| - (id) initWithRolesAndProbabilities: |
|
(NSDictionary*) | dict |
|
Extends class OORoleSet.
Definition at line 239 of file OORoleSet.m.
239 :(NSDictionary*)dict
240{
241 NSString* role =
nil;
242 float prob;
243
245 [self release];
247 }
248
249 self = [super init];
252
253
254
255
256
257 assert(_roles ==
nil && _roleString ==
nil);
258
259 NSMutableDictionary* tDict = [[dict mutableCopy] autorelease];
260 float thargProb = [dict oo_floatForKey:@"thargon" defaultValue:0.0f];
261
262 if (thargProb > 0.0f && [dict objectForKey:
@"EQ_THARGON"] ==
nil) {
263 [tDict setObject:[NSNumber numberWithFloat:thargProb] forKey:@"EQ_THARGON"];
264 [tDict removeObjectForKey:@"thargon"];
265 }
266
267 _rolesAndProbabilities = [tDict copy];
268
270 {
271 prob = [dict oo_floatForKey:role defaultValue:-1];
272 if (prob < 0) {
273 OOLog(
@"roleSet.badValue",
@"Attempt to create a role set with negative or non-numerical probability for role %@.", role);
274 [self release];
276 }
277
278 _totalProb += prob;
279 }
280
281 return self;
282}
#define foreachkey(VAR, DICT)
#define OOLog(class, format,...)
References foreachkey, nil, and OOLog.
The documentation for this category was generated from the following file: