Skip to content

Commit 5394b49

Browse files
committed
Change warning from too many ship/weapon classes to an error.
If a modular table broke the weapons limit, it would warn about too many weapon classes, and then not actually skip the entry, because of the "if(!replace)" conditional around it, resulting in nonsensical parsing errors. Rather than just fix this error, it was suggested on IRC (by The_E) that these problems should instead cause immediate errors. Upon reflection, this makes more sense: if the mod exceeds the limits, there's little point in loading it anyway and having things be missing. Hopefully, eventually, these limits will be removed altogether, but until then, exceeding them should not just be a dismissible warning.
1 parent e117719 commit 5394b49

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

code/ship/ship.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,6 @@ static int Ship_cargo_check_timer;
402402

403403
static int Thrust_anim_inited = 0;
404404

405-
bool warning_too_many_ship_classes = false;
406-
407405
int ship_get_subobj_model_num(ship_info* sip, char* subobj_name);
408406

409407
SCP_vector<ship_effect> Ship_effects;
@@ -1743,15 +1741,7 @@ int parse_ship(const char *filename, bool replace)
17431741

17441742
//Check if there are too many ship classes
17451743
if(Ship_info.size() >= MAX_SHIP_CLASSES) {
1746-
if (!warning_too_many_ship_classes) {
1747-
Warning(LOCATION, "Too many ship classes before '%s'; maximum is %d, so only the first " SIZE_T_ARG " will be used\nPlease check also the debug log as it may contain other ship classes which are over the limit", buf, MAX_SHIP_CLASSES, Ship_info.size());
1748-
warning_too_many_ship_classes = true;
1749-
} else {
1750-
mprintf(("Warning: Too many ship classes before '%s'\n", buf));
1751-
}
1752-
1753-
skip_to_start_of_string_either("$Name:", "#End");
1754-
return -1;
1744+
Error(LOCATION, "Too many ship classes before '%s'; maximum is %d.\n", buf, MAX_SHIP_CLASSES);
17551745
}
17561746

17571747
//Init vars

code/weapon/weapons.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,15 +1183,7 @@ int parse_weapon(int subtype, bool replace, const char *filename)
11831183
}
11841184

11851185
if(Num_weapon_types >= MAX_WEAPON_TYPES) {
1186-
Warning(LOCATION, "Too many weapon classes before '%s'; maximum is %d, so only the first %d will be used", fname, MAX_WEAPON_TYPES, Num_weapon_types);
1187-
1188-
//Skip the rest of the ships in non-modular tables, since we can't add them.
1189-
if(!replace) {
1190-
if ( !skip_to_start_of_string_either("$Name:", "#End")) {
1191-
Int3();
1192-
}
1193-
}
1194-
return -1;
1186+
Error(LOCATION, "Too many weapon classes before '%s'; maximum is %d.\n", fname, MAX_WEAPON_TYPES);
11951187
}
11961188

11971189
wip = &Weapon_info[Num_weapon_types];

0 commit comments

Comments
 (0)