Default_Campaign.patch (4,566 bytes)
2012-03-04 07:05
Index: code/fred2/campaigneditordlg.cpp
===================================================================
--- code/fred2/campaigneditordlg.cpp (revision 8557)
+++ code/fred2/campaigneditordlg.cpp (working copy)
@@ -180,7 +180,7 @@
load_tree(0);
if (!strlen(Campaign.filename))
- strcpy_s(Campaign.filename, BUILTIN_CAMPAIGN);
+ strcpy_s(Campaign.filename, Default_campaign_file_name);
if (mission_campaign_load(Campaign.filename, NULL, 0)) {
MessageBox("Couldn't open Campaign file!", "Error");
Index: code/globalincs/def_files.cpp
===================================================================
--- code/globalincs/def_files.cpp (revision 8557)
+++ code/globalincs/def_files.cpp (working copy)
@@ -104,6 +104,11 @@
;; Mod.tbl should be used for settings which affect the entire mod and \n\
;; only very rarely need to be changed (if ever). \n\
\n\
+#CAMPAIGN SETTINGS \n\
+ \n\
+;; Sets default campaign file the game will look for with new pilots \n\
+$Default Campaign File Name: FreeSpace2 \n\
+ \n\
#HUD SETTINGS \n\
\n\
;; Sets the delay before a directive will appear on the screen (ms) \n\
Index: code/mission/missioncampaign.cpp
===================================================================
--- code/mission/missioncampaign.cpp (revision 8557)
+++ code/mission/missioncampaign.cpp (working copy)
@@ -64,6 +64,8 @@
int Campaign_file_missing;
int Campaign_names_inited = 0;
+char Default_campaign_file_name[MAX_FILENAME_LEN - 4] = { NULL };
+
// stuff used for campaign list building
static bool MC_desc = false;
static bool MC_multiplayer = false;
@@ -2345,7 +2347,7 @@
if ( strlen(pl->current_campaign) ) {
return mission_campaign_load(pl->current_campaign, pl);
} else {
- int rc = mission_campaign_load(BUILTIN_CAMPAIGN, pl);
+ int rc = mission_campaign_load(Default_campaign_file_name, pl);
// if the builtin campaign is missing/corrupt then try and fall back on whatever is available
if (rc) {
Index: code/mission/missioncampaign.h
===================================================================
--- code/mission/missioncampaign.h (revision 8557)
+++ code/mission/missioncampaign.h (working copy)
@@ -18,7 +18,6 @@
// name of the builtin campaign.
#define BUILTIN_CAMPAIGN "FreeSpace2"
-#define BUILTIN_CAMPAIGN_NAME "The Main FreeSpace2 Campaign"
#define MAX_CAMPAIGN_MISSIONS 100 // maximum number of missions in a campaign
@@ -31,7 +30,7 @@
// missions.
#define CAMPAIGN_TYPE_SINGLE 0
#define CAMPAIGN_TYPE_MULTI_COOP 1
-#define CAMPAIGN_TYPE_MULTI_TEAMS 2
+#define CAMPAIGN_TYPE_MULTI_TEAMS 2
#define MAX_CAMPAIGN_TYPES 3
@@ -145,6 +144,8 @@
extern int Num_campaigns;
extern int Campaign_names_inited;
+extern char Default_campaign_file_name[MAX_FILENAME_LEN - 4];
+
// if the campaign file is missing this will get set for us to check against
extern int Campaign_file_missing;
Index: code/mod_table/mod_table.cpp
===================================================================
--- code/mod_table/mod_table.cpp (revision 8557)
+++ code/mod_table/mod_table.cpp (working copy)
@@ -6,6 +6,7 @@
#include "globalincs/pstypes.h"
#include "globalincs/def_files.h"
+#include "mission/missioncampaign.h"
#include "mod_table/mod_table.h"
#include "localization/localize.h"
#include "parse/parselo.h"
@@ -36,16 +37,22 @@
reset_parse();
// start parsing
- required_string("#HUD SETTINGS");
-
+ optional_string("#CAMPAIGN SETTINGS");
+ if (optional_string("$Default Campaign File Name:")) {
+ stuff_string(Default_campaign_file_name, F_NAME, (MAX_FILENAME_LEN - 4) );
+ }
+ else if (Default_campaign_file_name == NULL) {
+ strcpy(Default_campaign_file_name, BUILTIN_CAMPAIGN);
+ }
+
+ optional_string("#HUD SETTINGS");
// how long should the game wait before displaying a directive?
if (optional_string("$Directive Wait Time:")) {
stuff_int(&Directive_wait_time);
}
- required_string("#SEXP SETTINGS");
-
- if (optional_string("$Loop SEXPs Then Arguments:")) {
+ optional_string("#SEXP SETTINGS");
+ if (optional_string("$Loop SEXPs Then Arguments:")) {
stuff_boolean(&True_loop_argument_sexps);
if (True_loop_argument_sexps){
mprintf(("Game Settings Table : Using Reversed Loops For SEXP Arguments"));
@@ -54,10 +61,7 @@
mprintf(("Game Settings Table : Using Standard Loops For SEXP Arguments"));
}
}
- else
-
-
required_string("#END");
// close localization