Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: CommanderDJ on November 03, 2011, 06:32:34 pm
-
Link is here. (http://scp.indiegames.us/mantis/view.php?id=2369)
This has been sitting there waiting to be committed for days. It's been reviewed by both niffiwan and Karajorma. So instead of trying to badger people on IRC I figured I'd make a thread!
For completeness, here's the patch (which is also available on the mantis ticket):
Index: ship/ship.cpp
===================================================================
--- ship/ship.cpp (revision 7936)
+++ ship/ship.cpp (working copy)
@@ -1296,6 +1296,7 @@
int i, j, num_allowed;
int allowed_weapons[MAX_WEAPON_TYPES];
int pbank_capacity_count, sbank_capacity_count;
+ bool sbank_defaults_specified = false;
int rtn = 0;
char name_tmp[NAME_LENGTH];
@@ -2315,21 +2316,33 @@
}
// Get default secondary bank weapons
-
if(optional_string("$Default SBanks:"))
{
+ sbank_defaults_specified = true;
strcat_s(parse_error_text,"'s default secondary banks");
sip->num_secondary_banks = stuff_int_list(sip->secondary_bank_weapons, MAX_SHIP_SECONDARY_BANKS, WEAPON_LIST_TYPE);
strcpy_s(parse_error_text, temp_error);
+ }
- // Get the capacity of each secondary bank
- required_string("$SBank Capacity:");
+ //Get secondary bank capacities
+ if(optional_string("$SBank Capacity:"))
+ {
strcat_s(parse_error_text,"'s secondary banks capacities");
sbank_capacity_count = stuff_int_list(sip->secondary_bank_ammo_capacity, MAX_SHIP_SECONDARY_BANKS, RAW_INTEGER_TYPE);
strcpy_s(parse_error_text, temp_error);
- if ( sbank_capacity_count != sip->num_secondary_banks )
+
+ //if defaults were specified, use them to double check number of secondary banks
+ if(sbank_defaults_specified)
+ {
+ if(sbank_capacity_count != sip->num_secondary_banks)
+ {
+ Warning(LOCATION, "Number of default secondary banks and number of bank capacities do not match for ship class %s... fix this!!", sip->name);
+ }
+ }
+ //otherwise, set the number of banks using the capacities
+ else
{
- Warning(LOCATION, "Secondary bank capacities have not been completely specified for ship class %s... fix this!!", sip->name);
+ sip->num_secondary_banks = sbank_capacity_count;
}
}
-
I have posted a question in the ticket.
-
Wait, this triggers several red flags. I'm posting on the ticket.