Test whether there is a prefix for a markov name.

When the prefix is empty, there is no name so directly return.

This with commit f941c70081 makes it
possible to undo recruitment of undead units.

This breaks compatibility so is not intended for backporting.
This commit is contained in:
Mark de Wever 2014-04-12 21:59:25 +02:00
parent 734f1be224
commit 6ec8d80260
2 changed files with 3 additions and 1 deletions

View file

@ -83,6 +83,7 @@ Version 1.13.0-dev:
* Fix bug 21459 by making dropped sides default to idle.
* Fix bug 21882 by introducing "fight_on_without_leader" boolean attribute
of [side] tags and refactoring check_victory to use this.
* Changed: Don't use the random generator for units with no names.
Version 1.11.11:
* Add-ons server:

View file

@ -67,8 +67,9 @@ static markov_prefix_map markov_prefixes(const std::vector<std::string>& items,
static ucs4::string markov_generate_name(const markov_prefix_map& prefixes,
size_t chain_size, size_t max_len)
{
if(chain_size == 0)
if(prefixes.empty() || chain_size == 0) {
return ucs4::string();
}
ucs4::string prefix, res;