Skip to content

Commit 911639d

Browse files
committed
Add missing asteroid debris argument type error checking
1 parent 29217cc commit 911639d

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

code/parse/sexp.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3933,6 +3933,16 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
39333933
break;
39343934
}
39353935

3936+
case OPF_ASTEROID_DEBRIS:
3937+
if (type2 != SEXP_ATOM_STRING) {
3938+
return SEXP_CHECK_TYPE_MISMATCH;
3939+
}
3940+
3941+
if (get_asteroid_position(CTEXT(node)) < 0) {
3942+
return SEXP_CHECK_INVALID_ASTEROID;
3943+
}
3944+
break;
3945+
39363946
case OPF_WING_FORMATION:
39373947
if (type2 != SEXP_ATOM_STRING) {
39383948
return SEXP_CHECK_TYPE_MISMATCH;
@@ -32438,6 +32448,9 @@ const char *sexp_error_message(int num)
3243832448
case SEXP_CHECK_INVALID_SPECIAL_ARG_TYPE:
3243932449
return "Invalid special argument type";
3244032450

32451+
case SEXP_CHECK_INVALID_ASTEROID:
32452+
return "Invalid asteroid debris type";
32453+
3244132454
case SEXP_CHECK_INVALID_WING_FORMATION:
3244232455
return "Invalid wing formation";
3244332456

code/parse/sexp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,7 @@ enum sexp_error_check
11581158
SEXP_CHECK_INVALID_ANY_HUD_GAUGE,
11591159
SEXP_CHECK_INVALID_WING_FLAG,
11601160
SEXP_CHECK_INVALID_WING_FORMATION,
1161+
SEXP_CHECK_INVALID_ASTEROID,
11611162
};
11621163

11631164

fred2/sexp_tree.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3498,6 +3498,12 @@ int sexp_tree::query_default_argument_available(int op, int i)
34983498
}
34993499
return 0;
35003500

3501+
case OPF_ASTEROID_DEBRIS:
3502+
if ((Asteroid_info.size() - 3) > 0) {
3503+
return 1;
3504+
}
3505+
return 0;
3506+
35013507
default:
35023508
Int3();
35033509

0 commit comments

Comments
 (0)