This was an idea we tried so that we’d start with the most uncertain
attack first, but it did not work very well.
Keep the code for now, just comment it out.
That’s what wesnoth.simulate_combat() does, but is different from the
other functions in battle_calcs. Only hp_chance[0] needs to be set,
even if it is zero.
In rare cases (when the unit has no hexes to move to, not even the one
it is on because it is in a zone to be avoided), this would cause an
error and crash the AI.
Our simple_rng is described in comments (in .cpp file) as coming
from a desription in man pages, man rand(3). Here is a link to
that page:
http://linux.die.net/man/3/rand
Our implementation did not match the specification, because the
rand_pool_ variable was an unsigned int and not an unsigned long.
Since the rand_pool_ should basically be constantly overflowing
under normal operation of the rng, it is obvious to me that this
would affect the long term random results. It is not at all obvious
to me whether significant bias or defect would be introduced... but
it would not be surprising either.
we now set skipsighted to true if there is no fog or shroud.
The intention is that if a player uses fog=no in debugmode we still get
the same move destination in replays.
we now add nonundoable commands at the current position instead of
assuming
at_end(), this way nonundoable replay entrys like speak can now also be
added
while we are not at end.
Usually playturn_network_adapter ensures that we are always are at_end()
and i didn't get any error with the previous solution but the new
solution
is just more robust in case something goes wrong.
Note that we cannot add nonundoable commands at end if we aren’t at end
because
in that case the user would see the message again when he replays it.
Note that we cannot just do this for normal command because it might
bring the
replay in disorder.
we now enable warning 4800. I ran though the msvc compile with this
warning and i found some (in overlay.hpp, unit.cpp, whiteboard/move.cpp)
unintended implicit bool b = cfg["attributename"] casts that use
the implicit attribute_value to int cast and then a int to bool cast.
So for attributename=true b would be false. So i believe this
is a useful warning.
There are also a lot of implicit int to bool cast from the SDL and LUA
C-libraries which use int instead of bool because C doesn't have bool.
In this case this warning is less useful, but i still think it's worth
it since a "!= 0" or "== 1" isn't cost.
Plus if someone really wants to disable this warning he can still
disable it in the msvc project settings, while before is was not
possible for someone to enable this warning the the settings.
these appear to cause replay corruption, and bugs 19218, 21562
the replay_start cfg is already set correctly as the snapshot
at the start of a game, in playsingle_controller.cpp, in the
play_scenario function:
0aa13d477d/src/playsingle_controller.cpp (L372)
Not copying the unit improves the speed of wesnoth.put_unit by two orders
of magnitude from lua's perspective.
To do this, we have to take ownership of any owned pointer from lua_unit.
We do this by not running lua_unit's destructor, but just overwriting the memory it's in.
The description text does not get rendered very well on a webpage. One
solution might be to use pre-wrap/word-wrap in the CSS, but due to
differences between browsers, that's a can of worms (at least for me, I'm
not a web pro).
So, the not-so-elegant solution is to add <br/> to every line.
URLs are also not linked in the plain text. Although in modern browsers
you can select the text and right-click, it's still convenient to turn
them into actual links.
There seems no particular reason to require that this magic comment be at
the very beginning of the line, so why not switch from re.match to
re.search.
Also, update comments to reflect the fact that UtBS no longer uses this
magic comment.
A suggestion has been made to get rid of this magic comment now that UtBS
is no longer using it, but it may still be in use in some UMC somewhere.