Skip to content

Commit 74dad95

Browse files
authored
Merge pull request scp-fs2open#7479 from Goober5000/fix/more_misc_bugs
miscellaneous fixes
2 parents a715542 + 11a58f4 commit 74dad95

3 files changed

Lines changed: 20 additions & 14 deletions

File tree

code/cfile/cfilesystem.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,9 @@ int cf_create_default_path_string(SCP_string& path, int pathtype, const char* fi
24372437
}
24382438

24392439
if (!root) {
2440-
Assert( filename != NULL );
2440+
if (filename == nullptr) {
2441+
return 0;
2442+
}
24412443
path.assign(filename);
24422444
return 1;
24432445
}

code/mission/missionparse.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5702,19 +5702,23 @@ void parse_event(mission *pm)
57025702

57035703
if ( optional_string("+Trigger Count:")){
57045704
stuff_int( &(event->trigger_count) );
5705-
event->flags |= MEF_USING_TRIGGER_COUNT;
57065705

5707-
// if we have a trigger count but no repeat count, we want the event to loop until it has triggered enough times
5708-
if (event->repeat_count == 1) {
5709-
event->repeat_count = -1;
5710-
}
5711-
5712-
// sanity check on the trigger count variable
5706+
// sanity check on the trigger count variable; do this first so the != 1 check below is correct
57135707
// negative trigger count is also legal
57145708
if ( event->trigger_count == 0 ){
57155709
parse_warning_or_record("Trigger count for mission event %s is 0 — must be >= 1 or negative; corrected to 1.", event->name.c_str());
57165710
event->trigger_count = 1;
57175711
}
5712+
5713+
// a trigger count of 1 is the default, so the field only has runtime effect when it's something else
5714+
if (event->trigger_count != 1) {
5715+
event->flags |= MEF_USING_TRIGGER_COUNT;
5716+
5717+
// if we have a trigger count but no repeat count, we want the event to loop until it has triggered enough times
5718+
if (event->repeat_count == 1) {
5719+
event->repeat_count = -1;
5720+
}
5721+
}
57185722
}
57195723

57205724
if ( optional_string("+Interval:")){

code/weapon/weapons.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9802,12 +9802,12 @@ SCP_map<SCP_string, weapon_stat_value> weapon_get_stats(const weapon_info &wi)
98029802
stats["is_beam"] = is_beam;
98039803
stats["allowed_for_player"] = (bool)wi.wi_flags[Weapon::Info_Flags::Player_allowed];
98049804

9805-
// Velocity and range
9805+
// max_speed and range
98069806
if (is_beam) {
9807-
stats["velocity"] = 0.0f;
9807+
stats["max_speed"] = 0.0f;
98089808
stats["standard_range"] = wi.b_info.range;
98099809
} else {
9810-
stats["velocity"] = wi.max_speed;
9810+
stats["max_speed"] = wi.max_speed;
98119811
stats["standard_range"] = wi.max_speed * wi.lifetime;
98129812
}
98139813

@@ -9914,7 +9914,7 @@ SCP_string weapon_get_stats_text(const weapon_info &wi)
99149914
if (is_beam) {
99159915
sprintf(buf, "\tVelocity: N/A Range: %.0f\n", std::get<float>(stats["standard_range"]));
99169916
} else {
9917-
sprintf(buf, "\tVelocity: %-11.0fRange: %.0f\n", std::get<float>(stats["velocity"]), std::get<float>(stats["standard_range"]));
9917+
sprintf(buf, "\tVelocity: %-11.0fRange: %.0f\n", std::get<float>(stats["max_speed"]), std::get<float>(stats["standard_range"]));
99189918
}
99199919
result += buf;
99209920

@@ -9981,7 +9981,7 @@ void weapon_spew_stats(WeaponSpewType type)
99819981
static const csv_column columns[] = {
99829982
{"Name", nullptr},
99839983
{"Type", "type"},
9984-
{"Velocity", "velocity"},
9984+
{"Velocity", "max_speed"},
99859985
{"Range", "standard_range"},
99869986
{"Damage Hull", "damage_hull"},
99879987
{"DPS Hull", "dps_hull"},
@@ -10018,7 +10018,7 @@ void weapon_spew_stats(WeaponSpewType type)
1001810018
auto is_blank = [](const char *key, bool primary, bool is_beam) -> bool {
1001910019
if (!key)
1002010020
return false;
10021-
if (is_beam && !strcmp(key, "velocity"))
10021+
if (is_beam && !strcmp(key, "max_speed"))
1002210022
return true;
1002310023
if (primary && (!strcmp(key, "reload_rate") || !strcmp(key, "reload_rate_reciprocal")))
1002410024
return true;

0 commit comments

Comments
 (0)