mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 16:35:40 +00:00
New 'extra_defines' key to define some extra preprocessor symbols...
...*before* the file are repreprocessed (just like the campaign define). Use this in campaigns that need USE_L3_OUTLAWS
This commit is contained in:
parent
6dc8451240
commit
3f7b93d141
@ -14,6 +14,8 @@ Version 1.3.6+svn:
|
||||
* Enable "Save Game" and "View Chat Log" menu entries in replay mode.
|
||||
* WML engine:
|
||||
* now [base_unit]id= inside [unit] can extend upon existing unit types
|
||||
* new extra_defines key to define in campaigns some other preprocessor
|
||||
symbol *before* the files are repreprocessed
|
||||
* miscellaneous and bug fixes
|
||||
* rewrote the config merge routine (should improve parse time slightly)
|
||||
* various code cleanups
|
||||
|
@ -1,22 +1,6 @@
|
||||
#textdomain wesnoth
|
||||
{themes/}
|
||||
|
||||
# This check has to be done early, so USE_L3_OUTLAWS can affect the
|
||||
# advancement trees of the core units.
|
||||
|
||||
#ifdef CAMPAIGN_LIBERTY
|
||||
#define USE_L3_OUTLAWS
|
||||
#enddef
|
||||
#endif
|
||||
#ifdef CAMPAIGN_NORTHERN_REBIRTH
|
||||
#define USE_L3_OUTLAWS
|
||||
#enddef
|
||||
#endif
|
||||
#ifdef CAMPAIGN_THE_RISE_OF_WESNOTH
|
||||
#define USE_L3_OUTLAWS
|
||||
#enddef
|
||||
#endif
|
||||
|
||||
{core/}
|
||||
|
||||
#The editor needs the multiplayer included since the random maps are defined there
|
||||
|
@ -10,6 +10,7 @@
|
||||
first_scenario=the_raid
|
||||
|
||||
define=CAMPAIGN_LIBERTY
|
||||
extra_defines=USE_L3_OUTLAWS
|
||||
difficulties=EASY,NORMAL,HARD
|
||||
difficulty_descriptions={MENU_IMG_TXT2 "units/human-peasants/peasant.png~RC(magenta>red)" _"Peasant" _"(Easy)"} + ";" + {MENU_IMG_TXT2 "units/human-outlaws/outlaw.png~RC(magenta>red)" _"Outlaw" _"(Normal)"} + ";" + {MENU_IMG_TXT2 "units/human-outlaws/fugitive.png~RC(magenta>red)" _"Fugitive" _"(Difficult)"}
|
||||
icon="units/human-outlaws/fugitive.png"
|
||||
|
@ -8,6 +8,7 @@
|
||||
name= _ "Northern Rebirth"
|
||||
first_scenario=chain_break
|
||||
define=CAMPAIGN_NORTHERN_REBIRTH
|
||||
extra_defines=USE_L3_OUTLAWS
|
||||
difficulties=NEWBIE,EASY,NORMAL,HARD
|
||||
difficulty_descriptions={MENU_IMG_TXT2 "units/human-peasants/peasant.png~RC(magenta>red)" _"Peasant" _"(Normal)"} + ";" +
|
||||
{MENU_IMG_TXT2 "units/human-loyalists/spearman.png~RC(magenta>red)" _"Spearman" _"(Challenging)"} + ";" +
|
||||
|
@ -7,6 +7,7 @@
|
||||
#textdomain wesnoth-trow
|
||||
name= _ "The Rise of Wesnoth"
|
||||
define=CAMPAIGN_THE_RISE_OF_WESNOTH
|
||||
extra_defines=USE_L3_OUTLAWS
|
||||
first_scenario=A_Summer_of_Storms
|
||||
difficulties=EASY,NORMAL,HARD
|
||||
difficulty_descriptions={MENU_IMG_TXT2 TRoW_difficulty_easy.png _"Fighter" _"(Easy)"} +
|
||||
|
12
src/game.cpp
12
src/game.cpp
@ -686,6 +686,12 @@ bool game_controller::load_game()
|
||||
defines_map_["MULTIPLAYER"] = preproc_define();
|
||||
}
|
||||
|
||||
const std::vector<std::string> campaign_xtra_defines = utils::split(cfg["campaign_extra_defines"]);
|
||||
|
||||
for(std::vector<std::string>::const_iterator i = campaign_xtra_defines.begin(); i != campaign_xtra_defines.end(); ++i) {
|
||||
defines_map_[*i] = preproc_define();
|
||||
}
|
||||
|
||||
refresh_game_cfg();
|
||||
|
||||
state_ = game_state(units_data_,cfg);
|
||||
@ -846,6 +852,7 @@ bool game_controller::new_campaign()
|
||||
#endif
|
||||
|
||||
state_.campaign_define = campaign["define"];
|
||||
state_.campaign_xtra_defines = utils::split(campaign["extra_defines"]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1714,6 +1721,11 @@ void game_controller::play_game(RELOAD_GAME_DATA reload)
|
||||
defines_map_[state_.campaign_define] = preproc_define();
|
||||
}
|
||||
|
||||
for( std::vector<std::string>::const_iterator i = state_.campaign_xtra_defines.begin();
|
||||
i != state_.campaign_xtra_defines.end(); ++i) {
|
||||
defines_map_[*i] = preproc_define();
|
||||
}
|
||||
|
||||
if(defines_map_.count("NORMAL")) {
|
||||
defines_map_["MEDIUM"] = preproc_define();
|
||||
}
|
||||
|
@ -470,6 +470,8 @@ game_state::game_state(const game_data& data, const config& cfg)
|
||||
|
||||
campaign_define = cfg["campaign_define"];
|
||||
|
||||
campaign_xtra_defines = utils::split(cfg["campaign_extra_defines"]);
|
||||
|
||||
campaign_type = cfg["campaign_type"];
|
||||
if(campaign_type.empty())
|
||||
campaign_type = "scenario";
|
||||
@ -580,7 +582,8 @@ void write_game(const game_state& gamestate, config& cfg, WRITE_GAME_MODE mode)
|
||||
cfg["difficulty"] = gamestate.difficulty;
|
||||
|
||||
cfg["campaign_define"] = gamestate.campaign_define;
|
||||
|
||||
cfg["campaign_extra_defines"] = utils::join(gamestate.campaign_xtra_defines);
|
||||
|
||||
cfg.add_child("variables",gamestate.get_variables());
|
||||
|
||||
for(std::map<std::string, wml_menu_item *>::const_iterator j=gamestate.wml_menu_items.begin();
|
||||
@ -630,6 +633,7 @@ void write_game(config_writer &out, const game_state& gamestate, WRITE_GAME_MODE
|
||||
out.write_key_val("campaign_type", gamestate.campaign_type);
|
||||
out.write_key_val("difficulty", gamestate.difficulty);
|
||||
out.write_key_val("campaign_define", gamestate.campaign_define);
|
||||
out.write_key_val("campaign_xtra_defines", utils::join(gamestate.campaign_xtra_defines));
|
||||
out.write_child("variables", gamestate.get_variables());
|
||||
for(std::map<std::string, wml_menu_item *>::const_iterator j=gamestate.wml_menu_items.begin();
|
||||
j!=gamestate.wml_menu_items.end(); ++j) {
|
||||
@ -1301,6 +1305,7 @@ game_state& game_state::operator=(const game_state& state)
|
||||
version = state.version;
|
||||
campaign_type = state.campaign_type;
|
||||
campaign_define = state.campaign_define;
|
||||
campaign_xtra_defines = state.campaign_xtra_defines;
|
||||
campaign = state.campaign;
|
||||
scenario = state.scenario;
|
||||
players = state.players;
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
std::string campaign_type; //type of the game - campaign, multiplayer etc
|
||||
|
||||
std::string campaign_define; //if there is a define the campaign uses to customize data
|
||||
std::vector<std::string> campaign_xtra_defines; // more customization of data
|
||||
|
||||
std::string campaign; //the campaign being played
|
||||
std::string scenario; //the scenario being played
|
||||
|
Loading…
x
Reference in New Issue
Block a user