[[WML includes and village banners]]

* Added support for per-scenario configurable village flags

* Added sample Black-Eyed banners for SotBE

* Added support for relative {includes} in WML files ( {./utils.cfg}
  instead of {scenarios/Son_Of_The_Black_Eye/utils.cfg} for files in
  scenarios/Son_Of_The_Black_Eye}

* Added patch #3262 from Cedric
This commit is contained in:
Philippe Plantier 2004-08-03 19:50:01 +00:00
parent 5ad63ef5dc
commit 5c7b8585a3
24 changed files with 113 additions and 32 deletions

3
aclocal.m4 vendored
View file

@ -1,3 +1,5 @@
<<<<<<< aclocal.m4
=======
# generated automatically by aclocal 1.7.9 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
@ -833,3 +835,4 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.])
fi])])
>>>>>>> 1.9

View file

@ -65,7 +65,6 @@
ally_energy_image="ally-energy.png"
flag_image="terrain/flag-team%d-1.png:150,terrain/flag-team%d-2.png:150"
cross_image="misc/cross.png"
dot_image="misc/dot.png"

View file

@ -10,14 +10,14 @@ ggggggggggggggggggggggggggccccggggggg
ggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggg
gggggggggggggcgggggggCCCggggggggggggg
gggggggggggggcgggggggCCCggggggggggggg
ggggggggggggggcgggggggggggggggggggggg
ggnnKngggggggggcggggggggggggggggggggg
gggnnggggggggggcggggggggggggggggggggg
gggggggggggggggcgggggggggggg2gggggggg
gggggggDgggggccgggggggggggggggggggggg
ggggggDgggcgggggggggggggggggggggggggg
gggggggggggggggggggggCCCggggggggggggg
gggggggggggggggggggggCCCggggggggggggg
ggggggggggggggggggggggggggggggggggggg
ggnnKnggggggggggggggggggggggggggggggg
gggnngggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggg2gggggggg
gggggggDgggggtggggggggggggggggggggggg
ggggggDgggtgggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggg
"
turns=36

View file

@ -1,4 +1,4 @@
{scenarios/Son_Of_The_Black_Eye/utils.cfg}
{./utils.cfg}
{utils.cfg}
[scenario]
@ -35,6 +35,7 @@ Defeat:
recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
team_name=Kapoue
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -1,4 +1,4 @@
{scenarios/Son_Of_The_Black_Eye/utils.cfg}
{./utils.cfg}
{utils.cfg}
@ -37,6 +37,7 @@ Defeat:
recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer, Lizardman
team_name=Kapoue
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -1,4 +1,4 @@
{scenarios/Son_Of_The_Black_Eye/utils.cfg}
{./utils.cfg}
{utils.cfg}
@ -36,6 +36,7 @@ Defeat:
recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
team_name=Kapoue
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -1,3 +1,6 @@
{utils.cfg}
{./utils.cfg}
[scenario]
name= _ "End Of Peace"
id="End_Of_Peace"
@ -43,6 +46,7 @@ Defeat:
recruit= Wolf Rider, Orcish Grunt, Orcish Archer
enemy=2
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -1,4 +1,4 @@
{scenarios/Son_Of_The_Black_Eye/utils.cfg}
{./utils.cfg}
{utils.cfg}
#define BRIDGE_EXPLODE
@ -103,6 +103,7 @@ Defeat:
recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
team_name=Kapoue
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -1,4 +1,4 @@
{scenarios/Son_Of_The_Black_Eye/utils.cfg}
{./utils.cfg}
{utils.cfg}
@ -36,6 +36,7 @@ Defeat:
recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
team_name=Kapoue
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -1,4 +1,4 @@
{scenarios/Son_Of_The_Black_Eye/utils.cfg}
{./utils.cfg}
{utils.cfg}
@ -36,6 +36,7 @@ Defeat:
recruit=Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
team_name=Kapoue
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -1,4 +1,4 @@
{scenarios/Son_Of_The_Black_Eye/utils.cfg}
{./utils.cfg}
[scenario]
name= _ "The Siege Of Barag Gór"
@ -36,6 +36,7 @@ Defeat:
recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
team_name=Kapoue
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -1,4 +1,4 @@
{scenarios/Son_Of_The_Black_Eye/utils.cfg}
{./utils.cfg}
{utils.cfg}
[scenario]
@ -50,6 +50,7 @@ Defeat:
recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
team_name=Kapoue
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -1,3 +1,5 @@
{./utils.cfg}
[scenario]
name= _ "Toward Mountains of Haag"
id="Toward_Mountains_of_Haag"
@ -54,6 +56,7 @@ Defeat:
recruit= Wolf Rider, Orcish Grunt, Orcish Archer
team_name=Kapoue
gold=100
{BLACK_FLAG}
[/side]
[side]

View file

@ -249,3 +249,9 @@ y={Y}
y={Y}
[/unit]
#enddef
#define BLACK_FLAG
flag=terrain/flag-sotbe-1.png:100,terrain/flag-sotbe-2.png:300,terrain/flag-sotbe-1.png:100,terrain/flag-sotbe-3.png:300
#enddef

Binary file not shown.

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -297,15 +297,33 @@ void internal_preprocess_data(const std::string& data,
internal_preprocess_data(str,defines_map,depth,res,NULL,line,fname,srcline);
} else if(depth < 20) {
std::string prefix;
std::string fname = newfilename;
std::string nfname;
//if the filename begins with a '~', then look in the user's data directory
if(newfilename != "" && fname[0] == '~') {
//if the filename begins with a '~', then look
//in the user's data directory
if(newfilename != "" && newfilename[0] == '~') {
nfname = newfilename;
prefix = get_user_data_dir() + "/";
fname.erase(fname.begin(),fname.begin()+1);
nfname.erase(nfname.begin(),nfname.begin()+1);
nfname = prefix + "data/" + nfname;
} else if(newfilename.size() >= 2 && newfilename[0] == '.' &&
newfilename[1] == '/' ) {
//if the filename begins with a "./", then look
//in the same directory as the file currrently
//being preprocessed
nfname = newfilename;
nfname.erase(nfname.begin(),nfname.begin()+2);
nfname = directory_name(fname) + nfname;
std::cerr << "Preprocessing relative path " << newfilename << " preprocessed to " << nfname << "\n";
} else {
nfname = "data/" + newfilename;
}
internal_preprocess_file(prefix + "data/" + fname,
std::cerr << "Preprocessing subfile " << nfname << "\n";
internal_preprocess_file(nfname,
defines_map, depth+1,res,
lines_src,line);
} else {

View file

@ -53,8 +53,8 @@ namespace {
}
display::display(unit_map& units, CVideo& video, const gamemap& map,
const gamestatus& status, const std::vector<team>& t, const config& theme_cfg,
const config& built_terrains) :
const gamestatus& status, const std::vector<team>& t, const config& theme_cfg,
const config& built_terrains) :
screen_(video), xpos_(0), ypos_(0),
zoom_(DefaultZoom), map_(map), units_(units),
minimap_(NULL), redrawMinimap_(false),
@ -84,14 +84,20 @@ display::display(unit_map& units, CVideo& video, const gamemap& map,
//inits the flag list
flags_.reserve(teams_.size());
for(size_t i = 0; i != teams_.size(); ++i) {
std::string flag = game_config::flag_image;
std::string::size_type pos;
while((pos = flag.find("%d")) != std::string::npos) {
std::ostringstream s;
s << int(i+1);
flag.replace(pos, 2, s.str());
std::string flag;
if(teams_[i].flag().empty()) {
flag = game_config::flag_image;
std::string::size_type pos;
while((pos = flag.find("%d")) != std::string::npos) {
std::ostringstream s;
s << int(i+1);
flag.replace(pos, 2, s.str());
}
} else {
flag = teams_[i].flag();
}
std::cerr << "Adding flag from " << flag << "\n";
std::cerr << "Adding flag for team " << i << " from animation " << flag << "\n";
flags_.push_back(animated<image::locator>(flag));
flags_.back().start_animation(0, animated<image::locator>::INFINITE_CYCLES);
}

View file

@ -382,12 +382,28 @@ std::string file_name(const std::string& file)
if(pos == std::string::npos)
return file;
if(pos == file.size())
if(pos >= file.size()-1)
return "";
return file.substr(pos+1);
}
std::string directory_name(const std::string& file)
{
#ifdef _WIN32
static const std::string dir_separators = "\\/:";
#else
static const std::string dir_separators = "/";
#endif
std::string::size_type pos = file.find_last_of(dir_separators);
if(pos == std::string::npos)
return "";
return file.substr(0,pos+1);
}
namespace {
std::set<std::string> binary_paths;

View file

@ -66,6 +66,10 @@ int file_size(const std::string& fname);
//to a portable basename() function
std::string file_name(const std::string& file);
//returns the directory name of a file, with filename stripped. Equivalent to a
//portable dirname()
std::string directory_name(const std::string& file);
///the paths manager is responsible for recording the various paths that
///binary files may be located at. It should be passed a config object
///which holds binary path information. This is in the format

View file

@ -267,6 +267,9 @@ LEVEL_RESULT play_level(game_data& gameinfo, const config& game_config,
for(config::child_list::const_iterator su = starting_units.begin();
su != starting_units.end(); ++su) {
unit new_unit(gameinfo,**su);
new_unit.set_side(lexical_cast_default<int>((**ui)["side"],1));
const std::string& x = (**su)["x"];
const std::string& y = (**su)["y"];

View file

@ -65,6 +65,7 @@ team::team_info::team_info(const config& cfg)
team_name = cfg["team_name"];
if(team_name.empty())
team_name = cfg["side"];
flag = cfg["flag"];
description = cfg["description"];
@ -185,6 +186,7 @@ void team::team_info::write(config& cfg) const
cfg["income"] = income;
cfg["name"] = name;
cfg["team_name"] = team_name;
cfg["flag"] = flag;
cfg["description"] = description;
char buf[50];
@ -475,6 +477,11 @@ void team::change_team(const std::string& name)
info_.team_name = name;
}
const std::string& team::flag() const
{
return info_.flag;
}
const std::string& team::ai_algorithm() const
{
return info_.ai_algorithm;

View file

@ -69,6 +69,8 @@ public:
std::vector<int> enemies;
std::string team_name;
std::string flag;
std::string description;
enum CONTROLLER { HUMAN, AI, NETWORK, EMPTY };
@ -128,6 +130,8 @@ public:
const std::string& team_name() const;
void change_team(const std::string& name);
const std::string& flag() const;
const std::string& ai_algorithm() const;
const config& ai_parameters() const;