25259 Commits

Author SHA1 Message Date
Chris Beck
5fd8e5afcb add "ADJUST_ALPHA" image path function 2014-11-13 13:20:56 -05:00
gfgtdf
c64a1925df fix variable_info.cpp
variable_as_array_h::operator() expects the range to be passed as a pair (startindex, endindex). We accidentally passed the range as (startindex, size) instead.

Shadowm reported bugs related to global variables but most likely this can also lead to segfaults in other situations (some uses of [set_variables]).
2014-11-13 14:17:27 +01:00
gfgtdf
d0623f16da rename "current_player" -> "reserved_for"
Conflicts:
	src/game_initialization/connect_engine.cpp
	src/game_initialization/connect_engine.hpp
2014-11-13 01:42:44 +01:00
gfgtdf
005c99fc23 dont read "player_id" attribute
its not persistent in savefiles nor it's a documented [side] attribute
2014-11-13 01:32:37 +01:00
gfgtdf
a6e6326072 fix "player_id" during mp_connect/mp_wait
the value of "player_id" is only used to set the userlist in mpwait in
case there is no other userlist available (usualy there is another list
available) adding a side number doesn't make sense.

We also use a std::set for gathering the player_id values to make sure
there is no player_id twice.
2014-11-13 01:21:34 +01:00
gfgtdf
9d5504da33 fixup 'rename team::is_human -> is_local_human' 2014-11-13 01:07:22 +01:00
gfgtdf
ea2386a8a7 simplyfy conditional structure 2014-11-12 23:17:43 +01:00
gfgtdf
54e27d2d3f rename team::is_human() -> is_local_human
and is_ai -> is_local_ai
2014-11-12 23:11:15 +01:00
Chris Beck
9fdc91e8a9 Merge branch 'master' of https://github.com/wesnoth/wesnoth 2014-11-11 15:48:21 -05:00
Chris Beck
eac22acff2 fixup include guards 2014-11-11 15:48:14 -05:00
gfgtdf
1114ef2e42 fixup comment 2014-11-11 20:56:05 +01:00
gfgtdf
f777c3ce18 get rid of preprocessor conditional
having 2 different implementations (one for c++11 and one for c++03)
makes the code harder to maintain.
2014-11-11 20:51:34 +01:00
gfgtdf
73b523a077 refactor variable_info.cpp
this is a strict refactor which shouldn't change the compiled code.
2014-11-11 20:51:33 +01:00
gfgtdf
a7ceb23eb2 rename variable_info_3 -> variable_info
the only reason thart this was called variable_info_3 is that it was my
third try to implement it (my second try that used boost::variant for
the differnet states turned out to be too slow)
2014-11-11 20:51:32 +01:00
Chris Beck
19caaa667a fixup b6e12ebf76c8a7fec216d9667e65e1798566f83d 2014-11-11 13:35:43 -05:00
Chris Beck
b6e12ebf76 fixup more includes 2014-11-11 13:32:03 -05:00
Chris Beck
c4014bc39c Merge branch 'master' of https://github.com/wesnoth/wesnoth 2014-11-11 12:41:14 -05:00
Chris Beck
3b8e3b6d09 fix includes 2014-11-11 12:40:53 -05:00
gfgtdf
43e0ef1f26 revert d889982437fe7b91b7161f22559b3b439bbd7292
since https://github.com/wesnoth/wesnoth/pull/201 these tags shouldn't appear in the snapshot/scenario anymore.



reverts d889982437
2014-11-11 18:29:50 +01:00
Chris Beck
970c74e6e2 add missing include guard 2014-11-11 12:13:58 -05:00
Chris Beck
445fda6325 fixup lua_gui2.?pp 2014-11-11 12:10:32 -05:00
Chris Beck
f969e60ca5 split off help topic generators into their own file 2014-11-11 11:55:06 -05:00
Chris Beck
f1ce9a34bf move impl details into compilation unit 2014-11-11 11:17:40 -05:00
Chris Beck
8d63f15c4d split off help_menu from help_impl 2014-11-11 01:24:59 -05:00
Chris Beck
b92ac18c6b fixup headers of new files using iwyu 2014-11-11 01:24:58 -05:00
Chris Beck
5b1e0611ca split off help_text_area from help_impl 2014-11-11 01:24:58 -05:00
Chris Beck
a046653cf0 split off help_browser from help_impl 2014-11-11 01:24:58 -05:00
Chris Beck
67cd15f5a0 add help_impl.?pp files (guts of help.cpp) 2014-11-11 01:24:57 -05:00
Chris Beck
8c0587348e split help_button out of help.hpp header 2014-11-11 01:24:57 -05:00
Chris Beck
a02235a567 move the help browser files into their own folder
This is the start of a refactor to make all the help code more
easy to follow.
2014-11-11 01:24:44 -05:00
Chris Beck
08e61a10bb Merge branch 'master' of https://github.com/wesnoth/wesnoth 2014-11-10 21:26:17 -05:00
Chris Beck
aa19f6eecd move gui2 dialog lua functions to the lua kernel base 2014-11-10 21:13:22 -05:00
Ignacio R. Morelle
0f453ea24c gui1: Fix bogus dialog option buttons layout (bug #22791, #22379)
Formerly, the option buttons at the bottom of the dialog were laid out
by redoing some math instead of tracking the dialog's menu position,
which is always valid (even when there is no menu!). I'm not entirely
sure why, but the math reprised here became bogus with the introduction
of top buttons in commit 045bda037d78056866bdd918b51708d44d2bf515 (for
the Add-ons Manager dialog), in particular for dialogs *not* using them
(such as the in-game Statistics dialog), even though the menu is still
laid out correctly.

So instead of reinventing the wheel, we really should just take the
menu's position and height as a baseline for the bottom option buttons.
At worst the height is 0, but the position is still within the dialog's
boundaries (but see below for an unsolved corner case).

This commit reverts commit f60ef98e275fd3d16733f7d5dfd7314920841fd5
(a.k.a. 69521000dc5c45f9745131ee13e76493e14fefaa in 1.12) that's part of
PR #263, because it turns out that the solution proposed there is only a
convenient workaround that solves a layout issue for a single dialog
(Statistics, see bug #22379) and introduces a new bug for another
(Add-ons Manager, see bug #22791).

Regardless of the cause for #22791, the approach put forward by this
commit is more consistent with best practice (laying out widgets from
top to bottom each row's geometry depending on the previous row's), so I
have decided to not look too much into it.

It should be noted that the layout of bottom option buttons breaks
entirely for dialogs missing a menu, both before and after the
introduction of top buttons. Currently there is no GUI1 dialog that
attempts to insert option buttons while lacking menu entries, so I'm not
too concerned about this bug (which affects 1.10 too!). Besides, some
day GUI1 is supposed to go the way of the dodo and stop bothering us
with its marvelous inflexibility and arcane logic.
2014-11-10 22:32:52 -03:00
Chris Beck
ee67de3e97 add a null pointer check 2014-11-10 20:20:52 -05:00
Chris Beck
91f5778068 move all gui2 lua bindings to their own file 2014-11-10 20:12:09 -05:00
Ignacio R. Morelle
c3c48434fa gui1: Reuse an unchanged max instead of recalculating it
Counts as a minor cleanup of commit
045bda037d78056866bdd918b51708d44d2bf515.
2014-11-10 21:37:46 -03:00
Chris Beck
30bc486b5c Merge branch 'master' of https://github.com/wesnoth/wesnoth 2014-11-10 19:36:59 -05:00
Chris Beck
27145f7e5e if we have PNG support, save screenshots from dialog as png's
this was overlooked when SDL_SavePNG was added
2014-11-10 19:36:28 -05:00
Chris Beck
ec6037644f Merge pull request #331 from cbeck88/fixup_lua
Fixup lua
2014-11-10 19:16:44 -05:00
Chris Beck
1967d52a5d fixup stack discipline with error handling
When a C function terminates, it should not leave bogus elements
on the stack, or the stack can eventually overflow.

This is not as critical for C functions which are called by lua,
because they return an int explaining how many values on the stack
are important. But for C++ facing functions it is very important.
2014-11-10 17:12:55 -05:00
Chris Beck
c0335d38f7 refactor lua map generator to use a lua kernel object
This reduces the code complexity quite a bit. Now all the lua api
defn's are in the scripting folder, and the generator object itself
needs only construct a kernel and ask it to do things, and catch /
rethrow its exceptions with appropriate type and additional
descriptive info.
2014-11-10 17:01:22 -05:00
Chris Beck
4134ef3a80 remove comment from dev concerned about a nonissue
read here: http://www.lua.org/manual/5.1/manual.html#lua_CFunction
When the C function returns with "1", all but the top entry are
discarded from the stack. If this function could be called again
and again without ever returning and without ever dumping the stack,
then there could be a stackoverflow, but in this case it's
not possible.
2014-11-10 15:34:14 -05:00
Chris Beck
63399b47e9 move some callbacks (gettext, file ops) to lua kernel base 2014-11-10 15:34:13 -05:00
Chris Beck
720f4cdb83 use setfuncs instead of register, so we can do partial define 2014-11-10 15:34:13 -05:00
Chris Beck
76141a0de1 new code for lua protected calls in lua_kernel_base
In initial commit of the new lua kernels, I introduced a problem
by trying to use luaW_pcall and lua_pcall interchangeably via
polymorphism. This doesn't work because their return types don't
match, and it's alot of work to change luaW_pcall syntax. Besides
this there's no reason we can't use the custom error handler
everywhere.

This commits adds protected_call and load_string functions to lua
kernel base. These are an intended replacement for luaW_pcall,
and replace the "run" function. They do better error reporting
and allow to specify an error handler.

The error reporting is very flexible -- by default we select a
an error reporting function associated polymorphically to the lua
kernel, so the in-game lua kernel can send chat messages, and
others can do something else. However an arbitrary handler may
be specified, and exceptions instead of logging may also be
requested.
2014-11-10 15:32:19 -05:00
gfgtdf
2264e9961d add a comment 2014-11-10 19:39:32 +01:00
Roland Hautz
52b34a0933 Catched more unsatisfied boost references 2014-11-09 21:33:47 -05:00
Roland Hautz
37d63fd9ec link game to boost-random and png libraries 2014-11-09 21:33:46 -05:00
Chris Beck
3193a67ce9 add option to allow "unsafe" lua scripts, with "package" package
This allows lua scripts to access the OS, the network, etc.
2014-11-09 20:47:27 -05:00
Chris Beck
4164a24a59 take cmdline arg for lua scripts to execute at application start
If a lua script is passed as an argument to wesnoth, wesnoth will
actually instantiate the application_lua_kernel defined in the
previous commits, initialize it, and run the script in that
environment.
2014-11-09 20:47:27 -05:00