hopefully fixes #1397. Still too much magic in this code :(

git-svn-id: http://svn.code.sf.net/p/vcmi/code/trunk/@3498 4dfc6b2a-8b31-0410-aa91-d6c70e3ac834