Skip to content
Open
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
6 changes: 4 additions & 2 deletions code/missioneditor/sexp_tree_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ int SexpTreeModel::save_branch(int cur, int at_root) const
start = node;
} else if (last >= 0) {
Sexp_nodes[last].rest = node;
Sexp_nodes[node].parent = Sexp_nodes[last].parent;
}

last = node;
Expand Down Expand Up @@ -767,8 +768,9 @@ int SexpTreeModel::find_ancestral_argument_number(int parent_op, int child_node)
// which makes the special <argument> string a valid value at this position.
bool SexpTreeModel::is_node_eligible_for_special_argument(int parent_node) const
{
Assertion(parent_node != -1,
"Attempt to access invalid parent node for special arg eligibility check. Please report!");
// if there's no parent, it's certainly not eligible
if (parent_node < 0)
return false;

const int w_arg = find_ancestral_argument_number(OP_WHEN_ARGUMENT, parent_node);
const int e_arg = find_ancestral_argument_number(OP_EVERY_TIME_ARGUMENT, parent_node);
Expand Down
30 changes: 22 additions & 8 deletions code/missioneditor/sexp_tree_opf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,9 @@ sexp_list_item *SexpTreeOPF::get_listing_opf_ai_goal(int parent_node) const
{
sexp_list_item head;

Assertion(parent_node >= 0, "Invalid parent node");
// no parent context, nothing to list
if (parent_node < 0)
return nullptr;
int child = _model.tree_nodes[parent_node].child;
if (child < 0)
return nullptr;
Expand Down Expand Up @@ -414,7 +416,9 @@ sexp_list_item *SexpTreeOPF::get_listing_opf_docker_point(int parent_node, int a
{
sexp_list_item head;

Assertion(parent_node >= 0, "Invalid parent node");
// no parent context, nothing to list
if (parent_node < 0)
return nullptr;
Assertion(!stricmp(_model.tree_nodes[parent_node].text, "ai-dock") || !stricmp(_model.tree_nodes[parent_node].text, "set-docked") ||
get_operator_const(_model.tree_nodes[parent_node].text) >= static_cast<int>(First_available_operator_id), "Invalid node type");

Expand Down Expand Up @@ -479,7 +483,9 @@ sexp_list_item *SexpTreeOPF::get_listing_opf_dockee_point(int parent_node) const
{
sexp_list_item head;

Assertion(parent_node >= 0, "Invalid parent node");
// no parent context, nothing to list
if (parent_node < 0)
return nullptr;
Assertion(!stricmp(_model.tree_nodes[parent_node].text, "ai-dock") || !stricmp(_model.tree_nodes[parent_node].text, "set-docked"), "Invalid node type");

int sh = -1;
Expand Down Expand Up @@ -765,7 +771,9 @@ sexp_list_item *SexpTreeOPF::get_listing_opf_goal_name(int parent_node) const
{
sexp_list_item head;

Assertion(parent_node >= 0, "Invalid parent node");
// no parent context, nothing to list
if (parent_node < 0)
return nullptr;
int child = _model.tree_nodes[parent_node].child;

// reference_name is used by campaign editor to filter goals for a specific mission
Expand Down Expand Up @@ -843,7 +851,9 @@ sexp_list_item *SexpTreeOPF::get_listing_opf_event_name(int parent_node) const
{
sexp_list_item head;

Assertion(parent_node >= 0, "Invalid parent node");
// no parent context, nothing to list
if (parent_node < 0)
return nullptr;
int child = _model.tree_nodes[parent_node].child;

// reference_name is used by campaign editor to filter events for a specific mission
Expand Down Expand Up @@ -1396,7 +1406,9 @@ sexp_list_item *SexpTreeOPF::get_listing_opf_animation_name(int parent_node) con
{
sexp_list_item head;

Assertion(parent_node >= 0, "Invalid parent node");
// no parent context, nothing to list
if (parent_node < 0)
return nullptr;

// get the operator type of the node
const int op = get_operator_const(_model.tree_nodes[parent_node].text);
Expand Down Expand Up @@ -1593,11 +1605,13 @@ enum : int {
sexp_list_item *SexpTreeOPF::get_listing_opf_subsystem(int parent_node, int arg_index) const
{
sexp_list_item head;


// no parent context, nothing to list
if (parent_node < 0)
return nullptr;

// determine if the parent is one of the set subsystem strength items. If so,
// we want to append the "Hull" name onto the end of the menu
Assertion(parent_node >= 0, "Invalid parent node");

// get the operator type of the node
int op = get_operator_const(_model.tree_nodes[parent_node].text);
Expand Down
Loading
Loading