Skip to content

Commit 4e71535

Browse files
committed
Increment int strikes per CSG warning, as done in PLR code
* Use ReleaseWarnring instead of Warning * Use correct upper boundry check logic on HUD_config::mail_color
1 parent f44cfa0 commit 4e71535

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

code/pilotfile/csg.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -981,25 +981,28 @@ void pilotfile::csg_read_hud()
981981
HUD_config.rp_flags = cfread_int(cfp);
982982
HUD_config.rp_dist = cfread_int(cfp);
983983
if (HUD_config.rp_dist < 0 || HUD_config.rp_dist >= RR_MAX_RANGES) {
984-
Warning(LOCATION, "Campaign file has invalid radar range %d, setting to default.\n", HUD_config.rp_dist);
984+
ReleaseWarning(LOCATION, "Campaign file has invalid radar range %d, setting to default.\n", HUD_config.rp_dist);
985985
HUD_config.rp_dist = RR_INFINITY;
986+
strikes++;
986987
}
987988

988989
// basic colors
989990
HUD_config.main_color = cfread_int(cfp);
990-
if (HUD_config.main_color < 0 || HUD_config.main_color > HUD_COLOR_SIZE) {
991-
Warning(LOCATION, "Campaign file has invalid main color selection %i, setting to default.\n", HUD_config.main_color);
991+
if (HUD_config.main_color < 0 || HUD_config.main_color >= HUD_COLOR_SIZE) {
992+
ReleaseWarning(LOCATION, "Campaign file has invalid main color selection %i, setting to default.\n", HUD_config.main_color);
992993
HUD_config.main_color = HUD_COLOR_GREEN;
994+
strikes++;
993995
}
994996

995997
HUD_color_alpha = cfread_int(cfp);
996998
if (HUD_color_alpha < HUD_COLOR_ALPHA_USER_MIN || HUD_color_alpha > HUD_COLOR_ALPHA_USER_MAX) {
997-
Warning(LOCATION, "Campaign file has invalid alpha color %i, setting to default.\n", HUD_color_alpha);
999+
ReleaseWarning(LOCATION, "Campaign file has invalid alpha color %i, setting to default.\n", HUD_color_alpha);
9981000
HUD_color_alpha = HUD_COLOR_ALPHA_DEFAULT;
1001+
strikes++;
9991002
}
10001003

10011004
if (strikes == 3) {
1002-
Warning(LOCATION, "Campaign file has too many hud config errors, and is likely corrupted. Please verify and save your settings in the hud config menu.");
1005+
ReleaseWarning(LOCATION, "Campaign file has too many hud config errors, and is likely corrupted. Please verify and save your settings in the hud config menu.");
10031006
}
10041007

10051008
hud_config_record_color(HUD_config.main_color);

code/pilotfile/plr.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,28 +186,28 @@ void pilotfile::plr_read_hud()
186186
HUD_config.rp_flags = handler->readInt("rp_flags");
187187
HUD_config.rp_dist = handler->readInt("rp_dist");
188188
if (HUD_config.rp_dist < 0 || HUD_config.rp_dist >= RR_MAX_RANGES) {
189-
Warning(LOCATION, "Player file has invalid radar range %d, setting to default.\n", HUD_config.rp_dist);
189+
ReleaseWarning(LOCATION, "Player file has invalid radar range %d, setting to default.\n", HUD_config.rp_dist);
190190
HUD_config.rp_dist = RR_INFINITY;
191191
strikes++;
192192
}
193193

194194
// basic colors
195195
HUD_config.main_color = handler->readInt("main_color");
196-
if (HUD_config.main_color < 0 || HUD_config.main_color > HUD_COLOR_SIZE) {
197-
Warning(LOCATION, "Player file has invalid main color selection %i, setting to default.\n", HUD_config.main_color);
196+
if (HUD_config.main_color < 0 || HUD_config.main_color >= HUD_COLOR_SIZE) {
197+
ReleaseWarning(LOCATION, "Player file has invalid main color selection %i, setting to default.\n", HUD_config.main_color);
198198
HUD_config.main_color = HUD_COLOR_GREEN;
199199
strikes++;
200200
}
201201

202202
HUD_color_alpha = handler->readInt("color_alpha");
203203
if (HUD_color_alpha < HUD_COLOR_ALPHA_USER_MIN || HUD_color_alpha > HUD_COLOR_ALPHA_USER_MAX) {
204-
Warning(LOCATION, "Player file has invalid alpha color %i, setting to default.\n", HUD_color_alpha);
204+
ReleaseWarning(LOCATION, "Player file has invalid alpha color %i, setting to default.\n", HUD_color_alpha);
205205
HUD_color_alpha = HUD_COLOR_ALPHA_DEFAULT;
206206
strikes++;
207207
}
208208

209209
if (strikes == 3) {
210-
Warning(LOCATION, "Player file has too many hud config errors, and is likely corrupted. Please verify and save your settings in the hud config menu.");
210+
ReleaseWarning(LOCATION, "Player file has too many hud config errors, and is likely corrupted. Please verify and save your settings in the hud config menu.");
211211
}
212212

213213
hud_config_set_color(HUD_config.main_color);

0 commit comments

Comments
 (0)