Skip to content

Commit 49b486a

Browse files
committed
use enum for list types
1 parent 29217cc commit 49b486a

File tree

2 files changed

+112
-2
lines changed

2 files changed

+112
-2
lines changed

code/parse/sexp.h

Lines changed: 111 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,116 @@ struct ship_obj;
2727
#define MAX_SEXP_VARIABLES 250
2828

2929
// Operator argument formats (data types of an argument)
30-
#define OPF_NONE 1 // argument cannot exist at this position if it's this
30+
enum : int {
31+
OPF_NONE, // argument cannot exist at this position if it's this
32+
OPF_NULL, // no value. Can still be used for type matching, however
33+
OPF_BOOL,
34+
OPF_NUMBER,
35+
OPF_SHIP,
36+
OPF_WING,
37+
OPF_SUBSYSTEM,
38+
OPF_POINT, // either a 3d point in space, or a waypoint name
39+
OPF_IFF,
40+
OPF_AI_GOAL, // special to match ai goals
41+
OPF_DOCKER_POINT, // docking point on docker ship
42+
OPF_DOCKEE_POINT, // docking point on dockee ship
43+
OPF_MESSAGE, // the name (id) of a message in Messages[] array
44+
OPF_WHO_FROM, // who sent the message -- doesn't necessarily have to be a ship!!!
45+
OPF_PRIORITY, // priority for messages
46+
OPF_WAYPOINT_PATH, // name of a waypoint
47+
OPF_POSITIVE, // positive number or zero
48+
OPF_MISSION_NAME, // name of a mission for various mission related things
49+
OPF_SHIP_POINT, // a waypoint or a ship
50+
OPF_GOAL_NAME, // name of goal (or maybe event?) from a mission
51+
OPF_SHIP_WING, // either a ship or wing name (they don't conflict)
52+
OPF_SHIP_WING_WHOLETEAM, // Karajorma - Ship, wing or an entire team's worth of ships
53+
OPF_SHIP_WING_SHIPONTEAM_POINT, // name of a ship, wing, any ship on a team, or a point
54+
OPF_SHIP_WING_POINT,
55+
OPF_SHIP_WING_POINT_OR_NONE, // WMC - Ship, wing, point or none
56+
OPF_SHIP_TYPE, // type of ship (fighter/bomber/etc)
57+
OPF_KEYPRESS, // a default key
58+
OPF_EVENT_NAME, // name of an event
59+
OPF_AI_ORDER, // a squadmsg order player can give to a ship
60+
OPF_SKILL_LEVEL, // current skill level of the game
61+
OPF_MEDAL_NAME, // name of medals
62+
OPF_WEAPON_NAME, // name of a weapon
63+
OPF_SHIP_CLASS_NAME, // name of a ship class
64+
OPF_CUSTOM_HUD_GAUGE, // name of custom HUD gauge
65+
OPF_HUGE_WEAPON, // name of a secondary bomb type weapon
66+
OPF_SHIP_NOT_PLAYER, // a ship, but not a player ship
67+
OPF_JUMP_NODE_NAME, // name of a jump node
68+
OPF_VARIABLE_NAME, // variable name
69+
OPF_AMBIGUOUS, // type used with variable
70+
OPF_AWACS_SUBSYSTEM, // an awacs subsystem
71+
OPF_CARGO, // Goober5000 - a cargo string (currently used for set-cargo and is-cargo)
72+
OPF_AI_CLASS, // Goober5000 - an AI class
73+
OPF_SUPPORT_SHIP_CLASS, // Goober5000 - a support ship class
74+
OPF_ARRIVAL_LOCATION, // Goober5000 - a ship arrival location
75+
OPF_ARRIVAL_ANCHOR_ALL, // Goober5000 - all of a ship's possible arrival anchors
76+
OPF_DEPARTURE_LOCATION, // Goober5000 - a ship departure location
77+
OPF_SHIP_WITH_BAY, // Goober5000 - a ship with a fighter bay
78+
OPF_SOUNDTRACK_NAME, // Goober5000 - the name of a music soundtrack
79+
OPF_INTEL_NAME, // Goober5000 - the name of an intel entry in species.tbl
80+
OPF_STRING, // Goober5000 - any old string
81+
OPF_ROTATING_SUBSYSTEM, // Goober5000 - a rotating subsystem
82+
OPF_NAV_POINT, // Kazan - a Nav Point name
83+
OPF_SSM_CLASS, // Goober5000 - an SSM class
84+
OPF_FLEXIBLE_ARGUMENT, // Goober5000 - special to match for when-argument
85+
OPF_ANYTHING, // Goober5000 - anything goes, except containers
86+
OPF_SKYBOX_MODEL_NAME, // taylor - changing skybox model
87+
OPF_SHIP_OR_NONE, // Goober5000 - an "optional" ship argument
88+
OPF_BACKGROUND_BITMAP, // phreak - name of a background bitmap
89+
OPF_SUN_BITMAP, // phreak - name of a background bitmap
90+
OPF_NEBULA_STORM_TYPE, // phreak - name a nebula storm
91+
OPF_NEBULA_POOF, // phreak - name of a nebula poof
92+
OPF_TURRET_TARGET_ORDER, // WMC - name of a turret target type (see aiturret.cpp)
93+
OPF_SUBSYSTEM_OR_NONE, // Goober5000 - an "optional" subsystem argument
94+
OPF_PERSONA, // Karajorma - name of a persona
95+
OPF_SUBSYS_OR_GENERIC, // Karajorma - a subsystem or a generic name (like engine) which covers all subsystems of that type
96+
OPF_ORDER_RECIPIENT, // Karajorma - since orders can go to All Fighters as well as a ship or wing
97+
OPF_SUBSYSTEM_TYPE, // Goober5000 - a generic subsystem type (navigation, engines, etc.) rather than a specific subsystem
98+
OPF_POST_EFFECT, // Hery - type of post-processing effect
99+
OPF_TARGET_PRIORITIES, // FUBAR - Target priority groups
100+
OPF_ARMOR_TYPE, // FUBAR - Armor type or <none>
101+
OPF_FONT, // Goober5000 - a FreeSpace font
102+
OPF_HUD_ELEMENT, // A magic name of a specific HUD element
103+
OPF_SOUND_ENVIRONMENT, // Goober5000 - one of EFX_presets, per Taylor
104+
OPF_SOUND_ENVIRONMENT_OPTION, // Goober5000 - one of Taylor's options
105+
OPF_EXPLOSION_OPTION, // Goober5000
106+
OPF_AUDIO_VOLUME_OPTION, // The E
107+
OPF_WEAPON_BANK_NUMBER, // Karajorma - The number of a primary/secondary/tertiary weapon bank or all of them
108+
OPF_MESSAGE_OR_STRING, // Goober5000 - provides a list of messages like OPF_MESSAGE, but also allows entering arbitrary strings
109+
OPF_BUILTIN_HUD_GAUGE, // The E
110+
OPF_DAMAGE_TYPE, // FUBAR - Damage type or <none>
111+
OPF_SHIP_EFFECT, // The E - per-ship effects, as defined in post-processing.tbl
112+
OPF_ANIMATION_TYPE, // Goober5000 - as defined in modelanim.h
113+
OPF_MISSION_MOOD, // Karajorma - Moods determine which builtin messages will be sent
114+
OPF_SHIP_FLAG, // Karajorma - The name of a ship flag
115+
OPF_TEAM_COLOR, // The E - Color settings as defined in Colors.tbl
116+
OPF_NEBULA_PATTERN, // Axem - Full Nebula Background Patterns, as defined in nebula.tbl
117+
OPF_SKYBOX_FLAGS, // niffiwan - valid skybox flags
118+
OPF_GAME_SND, // m!m - A game sound
119+
OPF_FIREBALL, // Goober5000 - an entry in fireball.tbl
120+
OPF_SPECIES, // Goober5000
121+
OPF_LANGUAGE, // Goober5000
122+
OPF_FUNCTIONAL_WHEN_EVAL_TYPE, // Goober5000
123+
OPF_CONTAINER_NAME, // Karajorma/jg18 - The name of a SEXP container
124+
OPF_LIST_CONTAINER_NAME, // Karajorma/jg18 - The name of a SEXP list container
125+
OPF_MAP_CONTAINER_NAME, // Karajorma/jg18 - The name of a SEXP map container
126+
OPF_ANIMATION_NAME, // Lafiel
127+
OPF_CONTAINER_VALUE, // jg18 - Container data and map container keys
128+
OPF_DATA_OR_STR_CONTAINER, // jg18 - any data, or a container that is accessed via strings
129+
OPF_TRANSLATING_SUBSYSTEM, // Goober5000 - a translating subsystem
130+
OPF_ANY_HUD_GAUGE, // Goober5000 - both custom and builtin
131+
OPF_WING_FLAG, // Goober5000 - The name of a wing flag
132+
OPF_ASTEROID_DEBRIS, // MjnMixael - Debris types as defined in asteroids.tbl
133+
OPF_WING_FORMATION, // Goober5000 - as defined in ships.tbl
134+
135+
First_available_list_id
136+
};
137+
138+
// Operator argument formats (data types of an argument)
139+
/*#define OPF_NONE 1 // argument cannot exist at this position if it's this
31140
#define OPF_NULL 2 // no value. Can still be used for type matching, however
32141
#define OPF_BOOL 3
33142
#define OPF_NUMBER 4
@@ -129,7 +238,7 @@ struct ship_obj;
129238
#define OPF_ANY_HUD_GAUGE 100 // Goober5000 - both custom and builtin
130239
#define OPF_WING_FLAG 101 // Goober5000 - The name of a wing flag
131240
#define OPF_ASTEROID_DEBRIS 102 // MjnMixael - Debris types as defined in asteroids.tbl
132-
#define OPF_WING_FORMATION 103 // Goober5000 - as defined in ships.tbl
241+
#define OPF_WING_FORMATION 103 // Goober5000 - as defined in ships.tbl*/
133242

134243
// Operand return types
135244
#define OPR_NUMBER 1 // returns number

code/parse/sexp/sexp_lookup.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct global_state {
2828
int next_free_operator_id = First_available_operator_id;
2929
int next_free_category_id = First_available_category_id;
3030
int next_free_subcategory_id = First_available_subcategory_id;
31+
int next_free_list_id = First_available_list_id;
3132
};
3233

3334
// Static initialization to avoid initialization order issues

0 commit comments

Comments
 (0)