Merge pull request #497 from Wedge009/bug_18637_fix

Work-around for planning moves on planned recruits (bug #18637)
This commit is contained in:
Ignacio R. Morelle 2015-11-05 00:03:00 -03:00
commit e5538b3ad8
2 changed files with 8 additions and 0 deletions

View file

@ -189,6 +189,7 @@ Version 1.13.1+dev:
* Fixed bug 23060: unit stat tooltips do not show.
* wmllint, wmlscope, wmlindent and wmllint-1.4 now run on Python 3
* Text boxes tab completion now lists friends and whisperer nicks for easier answer (bug #9742)
* Avoid crash when planning moves on planned recruits (bug #18637)
* Fixed cases of wrong unit type used in planning moves (bug #20299)
* Fixed hang when attempting to make a screenshot from a non-existent map via
command-line (bug #20900)

View file

@ -144,6 +144,13 @@ move::move(config const& cfg, bool hidden)
void move::init()
{
// If a unit is invalid, return immediately to avoid crashes such as trying to plan a move for a planned recruit.
// As per Bug #18637, this should be fixed so that planning moves on planned recruits work properly.
// The alternative is to disable movement on planned recruits altogether,
// possibly in select_or_action() where the fake unit is selected in the first place.
if (get_unit() == NULL)
return;
assert(get_unit());
unit_id_ = get_unit()->id();