Skip to content

Commit f3aa1df

Browse files
committed
minor cleanup and remove arbitrary limit. Still limited to 500 objects.
1 parent 4c53677 commit f3aa1df

File tree

4 files changed

+6
-17
lines changed

4 files changed

+6
-17
lines changed

code/globalincs/globals.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
#define MAX_SHIPS 500 // max number of ship instances there can be.DTP; bumped from 200 to 400, then to 500 in 2022
3535
#define SHIPS_LIMIT 500 // what MAX_SHIPS will be at release time (for error checking in debug mode); dtp Bumped from 200 to 400, then to 500 in 2022
3636

37-
// from prop.h
38-
#define MAX_PROPS 200 // Arbitrary guess
39-
4037
// from missionparse.h and then redefined to the same value in sexp.h
4138
#define TOKEN_LENGTH 32
4239

code/mission/missionparse.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4997,7 +4997,6 @@ void parse_props(mission* pm)
49974997
{
49984998
if (optional_string("#Props")) {
49994999
while (required_string_either("#Events", "$Name:")) {
5000-
Assert(Parse_props.size() < MAX_PROPS);
50015000
parse_prop(pm);
50025001
}
50035002
}

code/prop/prop.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,6 @@ int prop_create(matrix* orient, vec3d* pos, int prop_type, const char* name)
251251
prop_info* pip;
252252
prop* propp;
253253

254-
if (Props.size() >= MAX_PROPS) {
255-
if (!Fred_running) {
256-
Error(LOCATION,
257-
"There is a limit of %d props in the mission at once. Please be sure that you do not have more "
258-
"than %d props present in the mission at the same time.",
259-
MAX_PROPS,
260-
MAX_PROPS);
261-
}
262-
return -1;
263-
}
264-
265254
Assertion((prop_type >= 0) && (prop_type < static_cast<int>(Prop_info.size())),
266255
"Invalid prop_type %d passed to prop_create() (expected value in the range 0-%d)\n",
267256
prop_type,
@@ -834,7 +823,7 @@ int prop_check_collision(object* prop_obj, object* other_obj, vec3d* hitpos, col
834823
asteroid* astp = &Asteroids[instance];
835824
mc.model_instance_num = astp->model_instance_num;
836825
mc.model_num = Asteroid_info[astp->asteroid_type].subtypes[astp->asteroid_subtype].model_number;
837-
mc.submodel_num - 1; // Typo from asteroth?
826+
mc.submodel_num = -1;
838827
}
839828

840829
mc.orient = &heavy_obj->orient; // The object's orient

code/prop/prop.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ typedef struct parsed_prop {
4747

4848
extern bool Props_inited;
4949

50-
// Global prop info array
50+
// Global prop info
5151
extern SCP_vector<prop_info> Prop_info;
5252

53+
// Global prop objects. Vector of optionals so that we can have stable indices
54+
// and still be able to remove props. Deleted props are set to std::nullopt
55+
// so any access should check if the optional has a value first.
56+
// The vector is cleared at the end of each mission, never during.
5357
extern SCP_vector<std::optional<prop>> Props;
5458

5559
inline int prop_info_size()

0 commit comments

Comments
 (0)