56165 Commits

Author SHA1 Message Date
mattsc
96e84f24c5 MAIs: add utility functions for storing information in unit variables
These provide a simple and consistent way of storing variables inside
[micro_ai] tags in unit variables.  This is needed for fixing a bug
with variables stored in units from a previous MAI causing problems
with a subsequent MAI.
2014-03-31 07:54:52 -07:00
mattsc
7c3d9093fb Micro AIs: fix bug requiring unnecessary keys for MAI removal
MAIs which take either [filter] or id= used to throw an error message
if neither was given even for MAI removal.
2014-03-31 07:49:56 -07:00
mattsc
84b1234835 [micro_ai] tag: move CA_path definition to beginning of file
To make it more visible for UMC authors who want to include their own
(modified) AIs.
2014-03-31 07:46:21 -07:00
mattsc
0fd45763a9 MAIs: test for unit equality directly, not via coordinates 2014-03-29 17:19:56 -07:00
mattsc
f03c6052d0 Return guardian MAI: remove unnecessary condition
We can never get to this point in the code if the unit does not have
moves.
2014-03-29 17:19:56 -07:00
mattsc
a017e584f2 Coward MAI: remove unnecessary condition
ai_helper.movefull_stopunit takes care of this internally.
2014-03-29 17:19:56 -07:00
gfgtdf
89192cef82 optimize minimap.cpp
moved 2 preferences::.. calls out of the loop so that we just call it once.

the following is especialy true on large maps, all results are recorded from a msvc 2010 release build, and recorded with the msvc 2010 sampling Profiler.

these calls are less expensive than the final scale_surface_sharp call at the end of the funcion. But if you assume the scale_surface_sharp woudn't be there, then they'd use a major part (~50%) of the cputime of get_minimap.

i also tested replacing scale_surface_sharp at the end of the function with scale_surface. Here are the results:
tested on LotI Mp Map (part of LotI addon) which has a size 200x200 with fog but no shroud, no logs, ingame debug mode enabled (the :debug wesnoth-console command).
the image on the upper middle is made with scale_surface the other two are made with scale_surface_sharp.
The down-left Image are the profiler results from the scale_surface version of get_minimap, the down-right are from the scale_surface_sharp version. The record was started shortly before a moving so the record only  shows the cputime during moving. Also the content of this commit is used in those testings.
http://i.imgur.com/YETVuNq.png
the profiler shows that during movements (with fog) more than 50% of the cputime of wesnoth is spend in scale_surface_sharp for get_minimap, and i personaly think differences in the minimap are not worth that. But there are different opinions and thats why i didn't change it yet, but i still propose replacing the last call

minimap = scale_surface_sharp(minimap,
		static_cast<int>(minimap->w * ratio), static_cast<int>(minimap->h * ratio));

with something like: 

if(map.w() > 100 || map.h() > 100)
{
minimap = scale_surface(minimap,
		static_cast<int>(minimap->w * ratio), static_cast<int>(minimap->h * ratio));
}
else
{
minimap = scale_surface_sharp(minimap,
		static_cast<int>(minimap->w * ratio), static_cast<int>(minimap->h * ratio));
}
note, that the 100 is choosen rather randomly.
If that's a problem with msvc then i propose wrapping it in a #if.
I have heared that we will be able to do scaling with hardware acceleration later (around september), but i don't see how thats a reason to not do this until then.
2014-03-29 21:16:42 +01:00
Alarantalara
6b9ee774ec Compile Lua with OS X options
Avoids some warnings, more secure
2014-03-29 16:08:40 -04:00
Alarantalara
a79467791d Remove references to unused flag ENABLE_OPENMP_SUPPORT
Not available in clang, gcc support unstable in versions available in
Xcode. Defaults to no
2014-03-29 16:07:27 -04:00
Alarantalara
c6e165504b Mark Wesnoth not high-resolution capable
Greatly improves performance on retina devices
2014-03-29 14:42:18 -04:00
Nils Kneuper
2bce3c6ccf updated Hungarian translation 2014-03-29 11:12:59 +01:00
Nils Kneuper
89c5b5ee4d updated Slovak translation 2014-03-29 10:00:48 +01:00
Chris Beck
77a93373a4 update changelog 2014-03-29 02:49:18 -04:00
Chris Beck
37c138c775 don't show petrified units in "Damage versus:" tooltip
since we can't attack these, this information is not useful.
afaik it is quite common to have permanent "statues" in MP maps,
and extremely rare that units may be unpetrified in any core or
umc scenarios.
2014-03-28 23:07:38 -04:00
Chris Beck
254eade25f fixup b854aab437f157eea642131b882a4987a95c5b6b (ai side drops)
logic error was introduced in client side controller types:
when a player drops and controls an ai-side, the side_drop signal
is only sent to the host, who should make that side a local ai,
not a networked ai.
2014-03-28 15:49:46 -04:00
mattsc
187f1c489b Patrol MAI: fix bug with save/load persistent data storage
WML values may not be used as keys, this can make savegames invalid.
Store information in the units now rather than in self.data. (Note:
storing in self.data would also be possible if the syntax were changed.)
2014-03-28 07:49:09 -07:00
mattsc
244ad22ce2 MAIs: minor code simplification in AIs that take both [filter] and id=
These are the AIs that used to use Behavior Candidate Actions (BCA).
2014-03-28 07:00:59 -07:00
mattsc
c72c8e7ff2 Messenger MAI: add optional invert_order= key
In the default configuration, the AI moves the messenger which has
advanced the furthest through the waypoints first.  If this key is set,
the rearmost messenger is moved first.
2014-03-27 14:36:32 -07:00
mattsc
62f709aaa3 Messenger MAI: allow several messengers to be controlled by AI
For two of the CAs this mostly just means reading the [filter] tag and
picking one of the messengers.  However, for the CA moving the escort
units, it means a complete rewrite, as the AI now needs to figure out
which escort unit should be moved toward which messenger.
2014-03-27 13:36:29 -07:00
mattsc
2d458b642a Messenger MAI: fix bug with escort units blocking the messenger
When there were lots of escort units, they previously quite frequently
blocked the messenger’s way, preventing him from making progress even
when it was possible.  Escort units now specifically move out of the
way if they do not need to attack enemy units in the messenger’s way.
2014-03-26 18:06:36 -07:00
mattsc
9e6b780306 ai_helper.get_closest_location(): fix bug with tags in SLF
The way how the Standard Location Filter was dealt with only worked
with keys, not tags.
2014-03-26 18:03:50 -07:00
Chris Beck
15a4c1f74c apply a brief blindfold when changing sides in hotseat mp
Fix bug #3865: While the turn dialog used for changing sides is active,
apply a blindfold, which is removed when the dialog is cleared.
2014-03-26 01:04:50 -04:00
Chris Beck
56bdb6aa05 blindfold is removed when control of a side is received
in blindfold_ii, blindfold was taken off when local side takes control
in this fixup, blindfold is taken off as soon as host gives control of
any side.
to achieve this, playturn.cpp must be able to ask the playcontroller to
remove the blindfold.
we create a virtual method of play_controller, on_not_observer,
which is called whenever this client gets local control of a side
(it becomes ai or human)
on all play_controllers except play_mpcontroller, this does nothing
in play_mpcontroller it calls a "remove_blindfold" function
when a human side takes control, remove_blindfold is still called,
as a precaution.
2014-03-26 00:35:55 -04:00
mattsc
f417faa2d5 Move path to Micro AI candidate actions files into variable
The purpose of this commit (and the previous) is to make it easier for
UMC authors to add functionality to the Micro AIs.
2014-03-25 08:09:49 -07:00
mattsc
5df117161a Move Micro AI auxiliary functions into their own file 2014-03-25 07:59:29 -07:00
mattsc
76bcdae73c Messenger MAI: add optional [filter_second] tag
This allows selection of the escort units.
2014-03-25 06:32:58 -07:00
mattsc
bfa48aa52b Update Xcode project 2014-03-25 06:16:59 -07:00
Alexander van Gessel
3113763de0 Revert XCode changes in "Attempt to update projectfiles"
This reverts part of commit f786c2d4229ea16f6d6fbe24f557a524af74707d.
2014-03-24 22:02:35 +01:00
Mark de Wever
4b298611fb Merge branch 'SDL2_exception'
Improves the exception handling for the SDL2 code.
2014-03-24 20:01:06 +01:00
Alexander van Gessel
d79b7d6547 Merge branch 'master' of github.com:wesnoth/wesnoth 2014-03-24 04:31:39 +01:00
Alexander van Gessel
1c73372beb Add missing include for windows-only files 2014-03-24 04:25:18 +01:00
Alexander van Gessel
89e1eba6df Merge pull request #130 from Aishiko/Add-unit-instance-recall-costs
Correct gold check comparision in recall dialog
2014-03-24 03:22:02 +01:00
Aishiko
5beed0a0f5 Correct gold check comparision in recall cost
By correcting the assignment of the cost of the unit it now correctly
says whether or not the play actually has the gold to recall a unit, as
after this check it is assumed they do by the program which creates
the possibility of recalling when you have no gold, or negative gold.

Added comments so that the magic number is explained.
2014-03-23 21:51:59 -04:00
Alexander van Gessel
e132df7d64 Remove gitignore in otherwise empty dir 2014-03-24 00:32:39 +01:00
Alexander van Gessel
f786c2d422 Attempt to update projectfiles 2014-03-24 00:32:15 +01:00
Alexander van Gessel
c192854e32 Whitespace fix 2014-03-24 00:25:01 +01:00
Alexander van Gessel
1b2bfa1e2a Include system headers with <>, not "" 2014-03-24 00:24:50 +01:00
Alexander van Gessel
1aad7f9d45 Move unicode support to its own file 2014-03-24 00:24:21 +01:00
Alexander van Gessel
7df83c22a8 Don't dereference iterator after invalidating it
Found by coverity.
2014-03-23 19:31:40 +01:00
Alexander van Gessel
ae34792417 Initialize all members
Found by coverity.
2014-03-23 19:22:03 +01:00
Nils Kneuper
4e514f2304 updated German translation 2014-03-23 18:02:04 +01:00
Alexander van Gessel
b6d4b9c71a Changelog entry for unicode handling improvements 2014-03-23 17:20:14 +01:00
Alexander van Gessel
436582337c Fix an identifier. Spotted by aquileia 2014-03-23 14:44:07 +01:00
Mark de Wever
f1793ab3e8 Use the new SDL exception in the SDL code.
Also:
* Fix a copy paste error in an error message.
* Make creation failures of a texture object throwing an exception.
2014-03-23 13:22:07 +01:00
Mark de Wever
982a844470 Catch the new SDL exception in the main game. 2014-03-23 13:17:29 +01:00
Alexander van Gessel
4e50c064e3 Merge branch 'master' of github.com:wesnoth/wesnoth 2014-03-23 13:13:44 +01:00
Alexander van Gessel
883fe46cad Use existing named constants 2014-03-23 13:13:19 +01:00
Alexander van Gessel
5b72299c39 Match declaration with definition 2014-03-23 13:13:08 +01:00
Mark de Wever
f6b52f338c Add the SDL exception class. 2014-03-23 13:09:08 +01:00
David Mikos
c770104621 Fix bug #21257: make skip AI mid-movement animations invisible and only enable at end. 2014-03-23 18:08:10 +10:30