Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions code/mission/missionparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,8 @@ void parse_player_info2(mission *pm)

void parse_cutscenes(mission *pm)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

if (optional_string("#Cutscenes"))
{
mission_cutscene scene;
Expand Down Expand Up @@ -1367,6 +1369,8 @@ void parse_music(mission *pm, int flags)
*/
void parse_fiction(mission * /*pm*/)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

if (optional_string("#Fiction Viewer"))
{
bool fiction_viewer_loaded = false;
Expand Down Expand Up @@ -1468,6 +1472,8 @@ void parse_cmd_briefs(mission *pm)
*/
void parse_briefing(mission * /*pm*/, int flags)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

int nt, i, j, stage_num = 0, icon_num = 0;
brief_stage *bs;
brief_icon *bi;
Expand Down Expand Up @@ -3012,6 +3018,8 @@ extern int parse_warp_params(const WarpParams *inherit_from, WarpDirection direc
*/
int parse_object(mission *pm, int /*flag*/, p_object *p_objp)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

int i;
char name[NAME_LENGTH];
ship_info *sip;
Expand Down Expand Up @@ -7075,13 +7083,18 @@ bool sexp_is_locked_false(int node)
{
// dunno why these are different, but they are
if (Fred_running)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");
return (node == Locked_sexp_false);
}
else
return (Sexp_nodes[node].value == SEXP_KNOWN_FALSE);
}

void set_cue_to_false(int *cue)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

free_sexp2(*cue);
*cue = Locked_sexp_false;
}
Expand Down Expand Up @@ -8563,6 +8576,8 @@ int get_warp_in_pos(vec3d *pos, object *objp, float x, float y, float z)
*/
void mission_bring_in_support_ship( object *requester_objp )
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

vec3d center, warp_in_pos;
p_object *pobj;
ship *requester_shipp;
Expand Down
20 changes: 19 additions & 1 deletion code/parse/sexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,10 +1424,15 @@ int alloc_sexp(const char *text, int type, int subtype, int first, int rest)
int sexp_const = get_operator_const(text);

if ((sexp_const == OP_TRUE) && (type == SEXP_ATOM) && (subtype == SEXP_ATOM_OPERATOR))
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");
return Locked_sexp_true;

}
else if ((sexp_const == OP_FALSE) && (type == SEXP_ATOM) && (subtype == SEXP_ATOM_OPERATOR))
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");
return Locked_sexp_false;
}

node = find_free_sexp();

Expand Down Expand Up @@ -1526,6 +1531,8 @@ void sexp_mark_persistent(int n)
return;
}

Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

// total hack because of the true/false locked sexps -- we should make those persistent as well
if ( (n == Locked_sexp_true) || (n == Locked_sexp_false) ){
return;
Expand All @@ -1548,6 +1555,8 @@ void sexp_unmark_persistent(int n)
return;
}

Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

// see sexp_mark_persistent
if ( (n == Locked_sexp_true) || (n == Locked_sexp_false) ){
return;
Expand All @@ -1570,6 +1579,8 @@ int free_one_sexp(int num)
Assert(Sexp_nodes[num].type != SEXP_NOT_USED); // make sure it is actually used
Assert(!(Sexp_nodes[num].type & SEXP_FLAG_PERSISTENT));

Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

// never free these nodes
if ((num == Locked_sexp_true) || (num == Locked_sexp_false))
return 0;
Expand All @@ -1594,6 +1605,8 @@ int free_sexp(int num, int calling_node)
Assert(Sexp_nodes[num].type != SEXP_NOT_USED); // make sure it is actually used
Assert(!(Sexp_nodes[num].type & SEXP_FLAG_PERSISTENT));

Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

// never free these nodes
if ((num == -1) || (num == Locked_sexp_true) || (num == Locked_sexp_false))
return 0;
Expand Down Expand Up @@ -4725,6 +4738,7 @@ int get_sexp()
} else {
const char *message = nullptr;
Assert(last != -1);
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

// Locked_sexp_true and Locked_sexp_false are only meant to represent operator
// nodes with no arguments, i.e. (true) and (false). If they appear as "bare"
Expand Down Expand Up @@ -10953,6 +10967,8 @@ int eval_perform_actions(int n, int op_num)
bool retval_first;
Assert( n >= 0 );

Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

if (op_num == OP_PERFORM_ACTIONS_BOOL_FIRST)
{
return_cond = CAR(n);
Expand Down Expand Up @@ -12198,6 +12214,8 @@ int sexp_num_valid_arguments( int n )
if (arg_handler < 0)
return 0;

Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

// the for-* sexps require special handling: they don't list their arguments explicitly but rather generate them on-the-fly
auto op_const = get_operator_const(arg_handler);
switch (op_const)
Expand Down
2 changes: 2 additions & 0 deletions code/ship/ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7355,6 +7355,8 @@ static void ship_set(int ship_index, int objnum, int ship_type)
ship_weapon *swp = &shipp->weapons;
polymodel *pm = model_get(sip->model_num);

Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

Assert(strlen(shipp->ship_name) <= NAME_LENGTH - 1);
shipp->ship_info_index = ship_type;
shipp->objnum = objnum;
Expand Down
2 changes: 2 additions & 0 deletions fred2/FictionViewerDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ BOOL FictionViewerDlg::OnInitDialog()

void FictionViewerDlg::OnOK()
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

UpdateData(TRUE);

// remove whitespace
Expand Down
2 changes: 2 additions & 0 deletions fred2/briefingeditordlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,8 @@ void briefing_editor_dlg::OnInsertStage()

void briefing_editor_dlg::copy_stage(int from, int to)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

if ((from < 0) || (from >= Briefing->num_stages)) {
Briefing->stages[to].text = "<Text here>";
strcpy_s(Briefing->stages[to].voice, "none.wav");
Expand Down
6 changes: 6 additions & 0 deletions fred2/campaigntreeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,8 @@ void campaign_tree_view::OnLButtonUp(UINT nFlags, CPoint point)

int campaign_tree_view::add_link(int from, int to)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

if (Total_links >= MAX_CAMPAIGN_TREE_LINKS)
return -1;

Expand Down Expand Up @@ -892,6 +894,8 @@ DROPEFFECT campaign_tree_view::OnDragOver(COleDataObject* pDataObject, DWORD dwK

BOOL campaign_tree_view::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

int i, level, pos;
cmission *cm;
HGLOBAL hGlobal;
Expand Down Expand Up @@ -999,6 +1003,8 @@ BOOL campaign_tree_view::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffe

void campaign_tree_view::drop_mission(int m, CPoint point)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

char name[MAX_FILENAME_LEN + 1];
int i, item, level, pos;
cmission *cm;
Expand Down
2 changes: 2 additions & 0 deletions fred2/campaigntreewnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ void campaign_tree_wnd::OnErrorChecker()

int campaign_tree_wnd::error_checker()
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

int i, j, z;
int mcount[MAX_CAMPAIGN_MISSIONS], true_at[MAX_CAMPAIGN_MISSIONS];

Expand Down
2 changes: 2 additions & 0 deletions fred2/freddoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ void CFREDDoc::editor_init_mission() {
}

bool CFREDDoc::load_mission(const char *pathname, int flags) {
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

// make sure we're in the correct working directory!!!!!!
chdir(Fred_base_dir);

Expand Down
2 changes: 2 additions & 0 deletions fred2/fredview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3083,6 +3083,8 @@ int CFREDView::global_error_check_mixed_player_wing(int w)

int CFREDView::global_error_check_player_wings(int multi)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

int i, z, err;
int starting_wing_count[MAX_STARTING_WINGS];
int tvt_wing_count[MAX_TVT_WINGS];
Expand Down
6 changes: 6 additions & 0 deletions fred2/initialstatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,8 @@ void initial_status::dock(object *objp, int dockpoint, object *other_objp, int o

void initial_status::undock(object *objp1, object *objp2)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

vec3d v;
int ship_num, other_ship_num;

Expand Down Expand Up @@ -1004,6 +1006,8 @@ void initial_status::undock(object *objp1, object *objp2)

bool set_cue_to_false(int *cue)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

// if the cue is not false, make it false. Be sure to set all ship editor dialog functions
// to update data before and after we modify the cue.
if (*cue != Locked_sexp_false)
Expand Down Expand Up @@ -1057,6 +1061,8 @@ void reset_arrival_to_false(int shipnum, bool reset_wing)
// group with a non-false arrival cue
void initial_status_mark_dock_leader_helper(object *objp, dock_function_info *infop)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

ship *shipp = &Ships[objp->instance];
int cue_to_check;

Expand Down
2 changes: 2 additions & 0 deletions fred2/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,8 @@ int create_object(vec3d *pos, int waypoint_instance)

int create_player(vec3d *pos, matrix *orient, int type)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

int obj;

if (type == -1){
Expand Down
2 changes: 2 additions & 0 deletions fred2/missionsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,8 @@ int CFred_mission_save::save_events()

int CFred_mission_save::save_fiction()
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

if (mission_has_fiction()) {
if (Mission_save_format != FSO_FORMAT_RETAIL) {
if (optional_string_fred("#Fiction Viewer"))
Expand Down
2 changes: 2 additions & 0 deletions fred2/reinforcementeditordlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ int reinforcement_editor_dlg::query_modified()

void reinforcement_editor_dlg::OnOK()
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

int i, j;

save_data();
Expand Down
2 changes: 2 additions & 0 deletions fred2/wing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ int check_wing_dependencies(int wing_num) {
}

int create_wing() {
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

char msg[1024];
int i, ship, wing = -1, waypoints = 0, count = 0, illegal_ships = 0;
int leader, leader_team;
Expand Down
4 changes: 4 additions & 0 deletions fred2/wing_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ void wing_editor::OnClose()
// initialize everything that update_data_safe() saves.
void wing_editor::initialize_data_safe(int full_update)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

int i, enable = TRUE, player_wing = 0, player_enabled = 1;
CComboBox *arrival_box, *departure_box;

Expand Down Expand Up @@ -574,6 +576,8 @@ void wing_editor::initialize_data(int full_update)
// Once the error no longer occurs, bypass mode is cleared and data is updated.
int wing_editor::update_data(int redraw)
{
Assertion(Locked_sexp_true >= 0 && Locked_sexp_false >= 0, "SEXPs are not yet initialized!");

char *str, old_name[255], buf[512];
int i, z;
object *ptr;
Expand Down
Loading