Skip to content

Commit 5a3cfa5

Browse files
committed
add ability to parse fireball type using its ID
1 parent afcb487 commit 5a3cfa5

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

code/fireball/fireballs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ int fireball_get_count()
12961296

12971297
void stuff_fireball_index_list(SCP_vector<int> &list, const char *name)
12981298
{
1299-
stuff_int_list(list, ParseLookupType::RAW_INTEGER_TYPE);
1299+
stuff_int_list(list, ParseLookupType::FIREBALL_INFO_TYPE);
13001300

13011301
list.erase(std::remove_if(list.begin(), list.end(), [&](int index) {
13021302
if (!SCP_vector_inbounds(Fireball_info, index)) {

code/parse/parselo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3203,6 +3203,8 @@ const char* get_lookup_type_name(ParseLookupType lookup_type)
32033203
return "Weapon Types";
32043204
case ParseLookupType::WEAPON_POOL_TYPE:
32053205
return "Weapon Pool";
3206+
case ParseLookupType::FIREBALL_INFO_TYPE:
3207+
return "Fireball Types";
32063208
case ParseLookupType::MISSION_LOADOUT_SHIP_LIST:
32073209
return "Mission Loadout Ships";
32083210
case ParseLookupType::MISSION_LOADOUT_WEAPON_LIST:
@@ -3260,6 +3262,12 @@ struct StuffIntListParser
32603262
error_display(0, "Unable to find weapon class %s in stuff_int_list!", str.c_str());
32613263
break;
32623264

3265+
case ParseLookupType::FIREBALL_INFO_TYPE:
3266+
num = fireball_info_lookup(str.c_str());
3267+
if (num < 0 && warn_on_lookup_failure)
3268+
error_display(0, "Unable to find fireball type %s in stuff_int_list!", str.c_str());
3269+
break;
3270+
32633271
case ParseLookupType::RAW_INTEGER_TYPE:
32643272
num = atoi(str.c_str());
32653273
valid_negative = true;

code/parse/parselo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ enum class ParseLookupType
6363
SHIP_INFO_TYPE,
6464
WEAPON_LIST_TYPE, // to parse an int_list of weapons
6565
WEAPON_POOL_TYPE,
66+
FIREBALL_INFO_TYPE,
6667
MISSION_LOADOUT_SHIP_LIST,
6768
MISSION_LOADOUT_WEAPON_LIST,
6869
CAMPAIGN_LOADOUT_SHIP_LIST,

0 commit comments

Comments
 (0)