Oolite 1.91.0.7646-241128-10e222e
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.

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