56411 Commits

Author SHA1 Message Date
gfgtdf
25d4f2bca4 give a better error message.
when a player leaves a mp game during a lua call and the other player
pressed escape, lua catches the error that should exit the game, idk
wether i can fix that but at least i can give a better error message.
2014-04-02 21:45:04 +02:00
gfgtdf
fc8c15e46a add synced_context class
the intention  is to fix #20871 and implement #21697, to sync
prestart/start events, and to implement
http://forums.wesnoth.org/viewtopic.php?f=6&t=39611 in the next patches,

the intention of synced_checkup is to replace random .. set/get_random_results.
Because set/get_random_results didn't have much to do with random, since it was only used to compare unit checksums and attacker damage to replays.

the intention of synced_commands is to move code out of do_replay_handle and make it callable from other places too so that we can just call the same function taht was called from replay in the simple cases (with synced_context::run_in_synced_command).

the object set_scontext_synced can be used to enter the synced context which enables synced_checkup and make the random calls synced.
Or we can use run_in_synced_context which is normaly easier than set_scontext_synced.
we can check wether we are in a synced context with get_syced_state to make addidional checks to detect oos (the other intention of that is to implement #21697 ).

this commit is part of pf 121.
2014-04-02 21:44:52 +02:00
Boldizsár Lipka
a928ce76de Properly clean up source_surface_ for streaming textures. 2014-04-02 18:05:03 +02:00
Boldizsár Lipka
4a34642ddc Allow streaming access for textures loaded from file. 2014-04-02 17:58:59 +02:00
Boldizsár Lipka
cf17070ae7 Optionally save an SDL_Surface when loading a texture from file. 2014-04-02 17:58:59 +02:00
Boldizsár Lipka
506c6a268c Minor code cleanup. 2014-04-02 17:58:59 +02:00
Nils Kneuper
60d30a0112 updated Italian translation 2014-04-01 22:00:15 +02:00
Nils Kneuper
88e378ab30 updated Slovak translation 2014-04-01 21:58:36 +02:00
Nils Kneuper
277b5dd698 updated credits for the Greek translation 2014-04-01 21:56:31 +02:00
gfgtdf
8f00786fb6 add functions in replay
these will be used in synced_context.cpp.

this commit is part of pr 121.
2014-04-01 21:54:41 +02:00
gfgtdf
fef7c49e83 add config_of function
in the file config_assign.cpp/hpp, it can be use similar to boost's boost::assign for config object.
I don't use it that much, but i found it useful especialy to pass or return a config that just contains one or two childs.
2014-04-01 21:06:43 +02:00
gfgtdf
ea7521af2b add replay_helper class
the main intention was to make the file replay.cpp smaller during writing pr 121.
also in order to use synced_context::run_in_synced_context this is useful.
(replay_helper.cpp was already accidently moved into makelist.txt in a pevious commit (add new rng))
2014-04-01 21:00:47 +02:00
gfgtdf
bf4935da84 add new rng
the plan is to have random_new::generator which can be a rng_synced or not dependng on whether we are in a synced context (for example select events are no synced context)

this commit is part of pr 121.
2014-04-01 20:59:34 +02:00
mattsc
1dfd79c3a5 Micro AIs: use the new functions for storing information in self.data
… so that it is done in a consistent way and conflicts can be avoided
when setting up a subsequent MAI.
2014-03-31 20:04:18 -07:00
mattsc
73a11634f7 Micro AIs: check for existence of [micro_ai] tags in self.data when...
… setting up an MAI. Ideally, we would delete such previous occurrences
of [micro_ai] tags in the AI's self.data variable. However, the MAI can
be changed while it is not the AI's turn, when this is not possible. So
instead, we check for the existence of such tags and make sure we are
using a different ai_id.
2014-03-31 20:02:16 -07:00
mattsc
6cfe5fa351 MAIs: add utility functions for storing information in AI's self.data
These provide a simple and consistent method of storing variables
inside [micro_ai] tags in the AI's persistent self.data variable. This
is needed for fixing a bug with variables stored there from a previous
MAI causing problems with a subsequent MAI
2014-03-31 19:58:58 -07:00
mattsc
6bd3bae330 Fix typos in comments 2014-03-31 19:55:24 -07:00
Alexander van Gessel
66058c10ef Merge branch 'codepoint_count' (PR #128) from aquileia/wesnoth-old
Conflicts:
	src/serialization/string_utils.cpp
2014-04-01 04:38:52 +02:00
mattsc
d69d4e9858 Goto MAI: store whether unit is released in the unit, not self.data
This is unit specific information, and therefore should go into the
unit.  By contrast, information whether all units of the side have been
released needs to remain in self.data.
2014-03-31 18:18:51 -07:00
Alexander van Gessel
116c6a6e97 Merge branch 'master' of github.com:wesnoth/wesnoth 2014-04-01 03:14:31 +02:00
Alexander van Gessel
ea8a3bbcd9 Further reorganise unicode.hpp
Create a unicode_cast<utf8::string, ucs4::char_t> specialisation.
Move remaining functions in the utils namespace to implemenation.
2014-04-01 03:11:59 +02:00
Alexander van Gessel
9d0a05cadc Rename utils::trancate_as_ucs4string to utf8::truncate_as_ucs4 2014-04-01 02:46:04 +02:00
mattsc
e1bbfc49ad Merge branch 'master' of github.com:wesnoth/wesnoth 2014-03-31 08:22:28 -07:00
mattsc
c24ddb71b2 Micro AIs bug fix: remove MAI unit variables on MAI removal
Previously this information remained in units and could alter the
behavior of subsequent MAIs, or even entirely disable them.
2014-03-31 08:21:50 -07:00
mattsc
49cc3bc7f9 Micro AIs: use the new functions for storing information in units
… such that it is done in a consistent way and this information can be
removed on MAI deletion.
2014-03-31 08:19:31 -07:00
mattsc
a4ee966d06 Fix comments 2014-03-31 08:16:14 -07:00
mattsc
bfb3315153 Micro AIs: another bug fix for required keys for MAI removal
The random recruiters MAI also required unnecessary keys to be provided
for MAI removal.
2014-03-31 08:15:12 -07:00
mattsc
24881edfb3 Micro AIs: use AI id instead of CA id as identifier
… for determining whether AI/CA ids are unique.  Also pass AI id to
eval/exec functions, instead of CA id.  This is also a step toward
fixing the bug with MAI variables remaining stored in units after an
MAI is removed.
In principle, the ca_id= key in the [micro_ai] tag should now be
renamed to ai_id, but that would break backward compatibility without
any benefit to the user, so we deal with it internally behind the
scenes instead.
2014-03-31 08:12:33 -07:00
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
Alexander van Gessel
7e128d09e0 Restore some commented-out code 2014-03-31 16:54:47 +02: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
Alexander van Gessel
d42afd970a Move a function back to string_utils.hpp 2014-03-31 15:52:06 +02:00
Alexander van Gessel
4d464bf8d2 Merge branch 'master' of github.com:wesnoth/wesnoth 2014-03-31 04:19:19 +02:00
Alexander van Gessel
5467b7a8c5 Fix encoding of a test 2014-03-31 04:18:32 +02:00
gfgtdf
0f9ad019c6 put simple_rng methods in own file. 2014-03-31 02:38:39 +02:00
Duthlet
5530cd0fc5 Fix bug #21759
Removed duplicate code that caused timer to be refreshed an additional
time if time runs out. The usual refreshing in
playmp_controller::after_human_turn is already called in this case as
well (after turn ends). The duplicate code gave the bonuses before the
turn ended, and after that the turn was ended (giving turn bonus again)
only if there was no random seed incoming from the server.

Conflicts:
	changelog
2014-03-30 13:48:53 -04:00
Alexander van Gessel
0170b539ac Merge branch 'master' of github.com:wesnoth/wesnoth 2014-03-30 18:59:10 +02:00
Boldizsár Lipka
e9d42a91ce Fix a memory leak in the previous commit. 2014-03-30 19:32:05 +02:00
Boldizsár Lipka
c63c27ae5e Add a ctor to ttexture which loads the texture from a file. 2014-03-30 19:24:57 +02:00
Alexander van Gessel
cad98a3278 Use unicode_cast 2014-03-30 18:51:28 +02:00
Alexander van Gessel
f330080e37 Add unicode_cast to wrap utils::X_to_Y() functions 2014-03-30 18:51:16 +02: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