Fixed a bug where addons with recusive INCLUDES could no longer be loaded

(bug #11160).
This commit is contained in:
Mark de Wever 2008-02-26 21:00:55 +00:00
parent 75e834d126
commit 93ead85e99
3 changed files with 22 additions and 15 deletions

View file

@ -14,6 +14,9 @@ Version 1.3.19+svn:
* added new music track, "The King is Dead" by Mattias Westlund.
* updated music track, "Traveling Minstrels" by Mattias Westlund.
* changed the default story screen music from loyalists.ogg to revelation.ogg
* WML engine:
* fixed a bug where addons with recusive INCLUDES could no longer be loaded
(bug #11160)
* miscellaneous and bug fixes:
* units with a death sound but no death animation now play their death
sound correctly

View file

@ -12,6 +12,8 @@ Version 1.3.19+svn:
* New music track, "The King is Dead" by Mattias Westlund.
* Updated music track, "Traveling Minstrels" by Mattias Westlund.
* Miscellaneous and bug fixes
* Some addons failed to load, this has been fixed.
Version 1.3.19:
* Language and translations

View file

@ -720,22 +720,24 @@ bool preprocessor_data::get_chunk()
}
// If this is a known pre-processing symbol, then we insert it,
// otherwise we assume it's a file name to load.
preproc_map::const_iterator macro = target_.defines_->find(symbol),
unknown_macro = target_.defines_->end();
if (macro != unknown_macro) {
for(std::vector<std::string>::iterator iter=called_macros_->begin(); iter!=called_macros_->end(); ++iter)
{
if(*iter==symbol)
{
std::ostringstream error;
error << "symbol '" << symbol << "' will cause a recursive macro call";
std::ostringstream location;
location<<linenum_<<' '<<target_.location_;
target_.error(error.str(), location.str());
}
}
preproc_map::const_iterator macro = target_.defines_->find(symbol);
if(macro != target_.defines_->end()) {
// INCLUDE is special and is allowed to be used recusively.
if(symbol != "INCLUDE") {
for(std::vector<std::string>::iterator
iter=called_macros_->begin();
iter!=called_macros_->end(); ++iter) {
if(*iter==symbol) {
std::ostringstream error;
error << "symbol '" << symbol << "' will cause a recursive macro call";
std::ostringstream location;
location<<linenum_<<' '<<target_.location_;
target_.error(error.str(), location.str());
}
}
}
preproc_define const &val = macro->second;
size_t nb_arg = strings_.size() - token.stack_pos - 1;
if (nb_arg != val.arguments.size()) {