Oolite
Loading...
Searching...
No Matches
Entity(OOPrivate) Category Reference

Instance Methods

(BOOL) - checkLinkedLists
 

Detailed Description

Definition at line 59 of file Entity.m.

Method Documentation

◆ checkLinkedLists

- (BOOL) checkLinkedLists

Extends class Entity.

Definition at line 55 of file Entity.m.

335{
336 // DEBUG check for loops
337 if (UNIVERSE->n_entities > 0)
338 {
339 int n;
340 Entity *check, *last;
341 //
342 last = nil;
343 //
344 n = UNIVERSE->n_entities;
345 check = UNIVERSE->x_list_start;
346 while ((n--)&&(check))
347 {
348 last = check;
349 check = check->x_next;
350 }
351 if ((check)||(n > 0))
352 {
353 OOLog(kOOLogEntityVerificationError, @"Broken x_next %@ list (%d) ***", UNIVERSE->x_list_start, n);
354 return NO;
355 }
356 //
357 n = UNIVERSE->n_entities;
358 check = last;
359 while ((n--)&&(check)) check = check->x_previous;
360 if ((check)||(n > 0))
361 {
362 OOLog(kOOLogEntityVerificationError, @"Broken x_previous %@ list (%d) ***", UNIVERSE->x_list_start, n);
363 return NO;
364 }
365 //
366 n = UNIVERSE->n_entities;
367 check = UNIVERSE->y_list_start;
368 while ((n--)&&(check))
369 {
370 last = check;
371 check = check->y_next;
372 }
373 if ((check)||(n > 0))
374 {
375 OOLog(kOOLogEntityVerificationError, @"Broken y_next %@ list (%d) ***", UNIVERSE->y_list_start, n);
376 return NO;
377 }
378 //
379 n = UNIVERSE->n_entities;
380 check = last;
381 while ((n--)&&(check)) check = check->y_previous;
382 if ((check)||(n > 0))
383 {
384 OOLog(kOOLogEntityVerificationError, @"Broken y_previous %@ list (%d) ***", UNIVERSE->y_list_start, n);
385 return NO;
386 }
387 //
388 n = UNIVERSE->n_entities;
389 check = UNIVERSE->z_list_start;
390 while ((n--)&&(check))
391 {
392 last = check;
393 check = check->z_next;
394 }
395 if ((check)||(n > 0))
396 {
397 OOLog(kOOLogEntityVerificationError, @"Broken z_next %@ list (%d) ***", UNIVERSE->z_list_start, n);
398 return NO;
399 }
400 //
401 n = UNIVERSE->n_entities;
402 check = last;
403 while ((n--)&&(check)) check = check->z_previous;
404 if ((check)||(n > 0))
405 {
406 OOLog(kOOLogEntityVerificationError, @"Broken z_previous %@ list (%d) ***", UNIVERSE->z_list_start, n);
407 return NO;
408 }
409 }
410 return YES;
411}
static NSString *const kOOLogEntityVerificationError
Definition Entity.m:55
#define OOLog(class, format,...)
Definition OOLogging.h:88
return nil
#define UNIVERSE
Definition Universe.h:842
Entity * z_next
Definition Entity.h:122
Entity * z_previous
Definition Entity.h:122
Entity * x_previous
Definition Entity.h:120
Entity * x_next
Definition Entity.h:120
Entity * y_next
Definition Entity.h:121
Entity * y_previous
Definition Entity.h:121

The documentation for this category was generated from the following file: