+
+void update_condition(void)
+{
+ if (docked)
+ condition = COND_DOCKED;
+ else if (energy < 50 || myship.altitude < 32 || myship.cabtemp > 224)
+ condition = COND_ALERT;
+ else if (energy < 128 || myship.altitude < 64 || myship.cabtemp > 192)
+ condition = COND_RED;
+ else {
+ int i;
+ condition = COND_GREEN;
+ if (myship.altitude < 128 || myship.cabtemp >= 128)
+ condition = COND_YELLOW;
+ for (i = 0; i < MAX_UNIV_OBJECTS; i++) {
+ struct univ_object *un = &universe[i];
+ if (un->type <= 0)
+ continue;
+ if (un->flags & FLG_HOSTILE) {
+ condition = COND_RED;
+ break;
+ }
+ if (condition == COND_GREEN &&
+ un->type != SHIP_ASTEROID && un->type != SHIP_CARGO &&
+ un->type != SHIP_ALLOY && un->type != SHIP_ROCK &&
+ un->type != SHIP_BOULDER && un->type != SHIP_ESCAPE_CAPSULE &&
+ un->type != SHIP_CORIOLIS && un->type != SHIP_DODEC)
+ condition = COND_YELLOW;
+ }
+ }
+}