/* v1.1 * * ship.h: Ship definition. * * This program is free software and may be freely redistributed as * specified in the GNU General Public License. Please see the file * 'COPYING' for details. */ #ifdef ENABLE_TIME_TRACKER #include #endif #ifdef ENABLE_SHIELD_CLASSES #include "output.h" #include "scm/scm.h" #endif /* * Ship fields - update the ship field definitions in object.c too */ enum ship_fields { shipclass, type, owner_name, owner_num, hull, tractor_present, tractor_effect, door_present, door_size, door_side, reactor_output_max, max_overload_points, reactor_setting_limit, reactor_stress_level, reactor_overload_penalty, battery_capacity, battery_discharge_max, warp_factor, warp_rated_max, warp_accel, cloak_present, cloak_cost, scanner_range, transmitter_range, receiver_sensitivity, shield_config, shield_factor, shield_power, shield_max_charge, gun_string, gun_qty, gun_power, gun_range, gun_range_percent, gun_charge_rate, gun_arc, torp_string, torp_qty, torp_loaders, torp_ammo, torp_power, torp_range, torp_accuracy, torp_charge_rate, damcon_teams, hull_status, system_status, shipflags, docked_at, dbref_bridge, dbref_eng, turn_factor, roll_factor, odometer, time_active, consoles }; struct channel_entry { unsigned frequency; int send_status; int receive_status; char label[17]; }; struct torp_entry { int range; float base_accuracy; int power; int charge; int time_to_reload; int turns_charged; int status; int charge_per_turn; }; struct gun_entry { int range; int power; float range_percent; /* deliverable percent at max range */ int charge; int old_charge; int status; int charge_per_turn; int arc; }; struct damage_entry { char status; int teams; int maxteams; int time_to_fix; }; struct console_entry { dbref dbref; unsigned int flags; }; #define MAX_CONSOLES 8 #define CONS_NAV 0x0001 #define CONS_TAC 0x0002 #define CONS_ENG 0x0004 #define CONS_SHD 0x0008 #define CONS_TRANS 0x0010 #define CONS_DAM 0x0020 #define CONS_COMM 0x0040 /* Invalid is used when creating the ship. Lets user know everything that's wrong with the console in one go, rather than incremental errors. */ #define CONS_INVALID 0x4000 #define CONS_ACTIVE 0x8000 #define CONS_ISNAV(ship, num) ((ship->consoles[num].type & CONS_NAV) ? 1:0) #define CONS_ISTAC(ship, num) ((ship->consoles[num].type & CONS_TAC) ? 1:0) #define CONS_ISENG(ship, num) ((ship->consoles[num].type & CONS_ENG) ? 1:0) #define CONS_ISSHD(ship, num) ((ship->consoles[num].type & CONS_SHD) ? 1:0) #define CONS_ISTRANS(ship, num) ((ship->consoles[num].type & CONS_TRANS) ? 1:0) #define CONS_ISDAM(ship, num) ((ship->consoles[num].type & CONS_DAM) ? 1:0) #define CONS_ISCOMM(ship, num) ((ship->consoles[num].type & CONS_COMM) ? 1:0) #define CONS_ISACTIVE(ship, num) ((ship->consoles[num].type & CONS_ACTIVE)? 1:0) #define CONS_DBREF(ship, num) (ship->consoles[num].dbref) struct ship_entry { Record *rec; /* Dbrefs of consoles */ struct console_entry consoles[MAX_CONSOLES]; int num_consoles; dbref dbref_bridge; dbref dbref_eng; unsigned int shipflags; /* Hull damage */ int current_integrity; int permanent_hull_damage; /* Reactor fields */ int current_reactor_output_max; int reactor_output; int reactor_setting; int reactor_drain; int overload_points; /* Battery fields */ int battery_level; int battery_discharge; char battery_status; /* Engineering fields */ int eng_warnings; int eng_safeties; /* Engine fields */ float warp_set_speed; /* Current set speed */ float warp_speed; /* Current speed */ /* Communications fields */ struct channel_entry channel[MAX_COMM_CHANNELS]; /* Shield/door fields */ int shield_level[NUM_SHIELDS]; int shield_alloc[NUM_SHIELDS]; int shield_status[NUM_SHIELDS]; int shield_action[NUM_SHIELDS]; int door_status; /* 1 = open, 0 = closed, -1 = no docking */ /* Cloak fields */ int cloak_status; int time_to_cloak; #ifdef ENABLE_SHIELD_CLASSES int sc_num; /* Number of shield layers on this ship */ SCDATA sc[SCM_MAX_LAYERS]; /* Shield layer data structure */ #else /* Eventually the shield class code will replace these, but not yet */ int shield_max[NUM_SHIELDS]; int shield_max_charge[NUM_SHIELDS]; /* max that can be added per turn */ int shield_number; /* Number of shields for this config */ #endif /* Engineering Allocations */ int alloc_nav; int alloc_shields; int alloc_tac; int alloc_batt; /* Tactical allocations */ int talloc_guns; int talloc_torps; int talloc_tractor; /* Tractor beam */ TAG *tractor_target; int tractor_status; int tractor_power; /* Weapons system fields */ int free_torp_loaders; int num_torps_online; int num_guns_online; int auto_online; int auto_reload; struct torp_entry torp[MAX_TORPS]; struct gun_entry gun[MAX_GUNS]; /* Damage control fields */ struct damage_entry damage[NUM_SYSTEMS]; int team[MAX_TEAMS]; /* shows what each team is up to */ #ifdef ENABLE_TIME_TRACKER time_t time_start; /* time() the object was added to space */ #endif }; #define INVINCIBLE 0x00000001 #define SPEEDY 0x00000002 #define POKEY 0x00000004 #define NAKED 0x00000008 #define DISABLED 0x00000010 #define PACIFIST 0x00000020 #define CAN_LAND 0x00000040 #define Invincible(x) ((x->shipflags & INVINCIBLE) != 0) #define Speedy(x) ((x->shipflags & SPEEDY) != 0) #define Pokey(x) ((x->shipflags & POKEY) != 0) #define Naked(x) ((x->shipflags & NAKED) != 0) #define Disabled(x) ((x->shipflags & DISABLED) != 0) #define Pacifist(x) ((x->shipflags & PACIFIST) != 0) #define CanLand(x) ((x->shipflags & CAN_LAND) != 0) /* torp tube status values */ #define TORP_EMPTY 0 #define TORP_LOADING 1 #define TORP_LOADED 2 #define TORP_ONLINE 3 #define TORP_ARMED 4 #define TORP_DAMAGED 5 /* gun status values */ #define GUN_ONLINE 0 #define GUN_OFFLINE 1 #define GUN_DAMAGED 4 /* cloak status values */ #define CLOAK_NONE 0 #define CLOAK_OFF 1 #define CLOAK_ON 2 #define CLOAKING 3 #define DECLOAKING 4 /* tractor beam status values */ #define TRACTOR_NONE 0 #define TRACTOR_OFF 1 #define TRACTOR_ON 2 #define TRACTOR_DRAW 3 #define TRACTOR_DAMAGED 4 /* shield status values */ #define SHLD_READY 0 #define SHLD_UP 1 #define SHLD_DAMAGED 2 #define SHLD_STABLE 3 #define SHLD_CHARGING 4 #define SHLD_FALLING 5 #define SHLD_OVERLOADED 6 #define NUM_SHIELD_CONFIGS 7 #define SHIELD_CONFIG_ORIG4 0 /* Original shield setup */ #define SHIELD_CONFIG_ORIG6 1 /* 6 shield setup 1*/ #define SHIELD_CONFIG_CUBE 2 /* 6 shield setup 2*/ #define SHIELD_CONFIG_ORANGE1 3 /* 4 shield setup P,V,S,D */ #define SHIELD_CONFIG_ORANGE2 4 /* 4 shield setup */ #define SHIELD_CONFIG_NONE 5 /* No shields */ #define SHIELD_CONFIG_ONE 6 /* A single shield */ /* docking bay door values */ #define DOORS_NONE -1 #define DOORS_CLOSED 0 #define DOORS_OPEN 1 #define CS_COMM_ONLY 0 #define CS_BRIDGE_AUDIO 1 #define CS_VISUALS 2 #define CR_COMM_ONLY 0 #define CR_BRIDGE_AUDIO 1 #define CR_ON_SCREEN 2