mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
Call CheckHogfile() instead of copy pasting code
The main motivation behind this commit is to make it easier to create a future commit. That future commit will modify code in CheckHogFile(). If I don’t deduplicate the code now, then I’ll have to edit the same lines of code in multiple different places.
This commit is contained in:
parent
72852bce3d
commit
491af3c469
@ -1628,35 +1628,9 @@ void StartLevel() {
|
||||
|
||||
// Loads a level and starts everything up
|
||||
bool LoadAndStartCurrentLevel() {
|
||||
char hogpath[_MAX_PATH * 2];
|
||||
// This is a bit redundant because we just did it in most cases, but we need to be sure that it always happens,
|
||||
// and this code is here for weird systems, like save/load and demo, etc.
|
||||
if (Current_mission.filename && (stricmp(Current_mission.filename, "d3.mn3") == 0) &&
|
||||
(Current_mission.cur_level > 4)) {
|
||||
// close the mission hog file and open d3_2.mn3
|
||||
mn3_Close();
|
||||
ddio_MakePath(hogpath, D3MissionsDir, "d3_2.mn3", nullptr);
|
||||
if (cfexist(hogpath)) {
|
||||
mn3_Open(hogpath);
|
||||
mem_free(Current_mission.filename);
|
||||
Current_mission.filename = mem_strdup("d3_2.mn3");
|
||||
} else {
|
||||
SetFunctionMode(MENU_MODE);
|
||||
}
|
||||
} else if (Current_mission.filename && (stricmp(Current_mission.filename, "d3_2.mn3") == 0) &&
|
||||
(Current_mission.cur_level <= 4)) {
|
||||
// Part 2 of the mission is d3_2.mn3
|
||||
// close the mission hog file and open d3.mn3
|
||||
mn3_Close();
|
||||
ddio_MakePath(hogpath, D3MissionsDir, "d3.mn3", nullptr);
|
||||
if (cfexist(hogpath)) {
|
||||
mn3_Open(hogpath);
|
||||
mem_free(Current_mission.filename);
|
||||
Current_mission.filename = mem_strdup("d3.mn3");
|
||||
} else {
|
||||
SetFunctionMode(MENU_MODE);
|
||||
}
|
||||
}
|
||||
CheckHogfile();
|
||||
|
||||
// load the level. if fails, then bail out
|
||||
// ShowProgressScreen (TXT_LOADINGLEVEL);
|
||||
|
Loading…
Reference in New Issue
Block a user