626 Commits

Author SHA1 Message Date
Chris Beck
042b72a4b8 rename scripting/lua.?pp to game_lua_kernel.?pp 2014-11-09 18:45:14 -05:00
Chris Beck
2059c6729f use the game config manager's terrain cache in play_controllers
this completes 1a4efb6b22aeb0742c9083a7d0515ebdef799078 by
passing a reference to global terrain data cache to these
functions
2014-11-07 22:34:32 -05:00
Chris Beck
ab62d9c75e split off terrain data caches from the gamemap object
This commit splits some of the functionality of the gamemap object
into a new class, the "terrain_type_data" object. This class is
intended to hold a record of known terrains and the terrain code ->
terrain type map. It handles merging in new terrain definitions,
and it is shared between map objects. It is also cached by the game
config manager, so that we only recalculate this data when we
change configs.

There is in fact a *semantic* change going on here, which is that
when a scenario introduces a new terrain type by merging, this gets
added to the global cache. The alternative is to make a copy of the
global cache, only for the this scenario, as soon as we have to
dirty the cache. However since I didn't see any downside to putting
the merged terrains together and carrying them across scenarios,
I opted not to do that here.
2014-11-07 22:34:31 -05:00
gfgtdf
9d52c08039 remove outcommented code 2014-10-31 22:07:51 +01:00
gfgtdf
00e50f5620 partly revert e454252f2
there are multiple reasons why i think this should be reverted:
1) this wasn't tested enough, especialy we don't even know, whether all mainline campaigns are compatible
(this can be easily fixed, but only if one know which campaigns are effected which requires testing)
2) after renaming remove_from_carryover_on_leaders_loss to remove_from_carryover_on_defeat it sounds wrong that this can result in removing units on victory.
3) this seemed to break many UMC addons.

Note that this only removes one check for defeat_condition before [endlevel].
Especialy if for example side 1 gets defeated by defeat_condition in turn 1 but the game still goes on due to multiple other non defeated sides, but then the game ends with [endlevel] result=victory in turn 2, the units will be removed from carryover (unless specified otherwise)
This was also the pre 1.11.13 behaviour.
Also note that we cannot remove the 'defeated' side in case of [endlevel]result=victory, becasue [endlevel] doesn't sepcify which sides have victory/defeat.
2014-10-15 00:33:57 +02:00
Ignacio R. Morelle
c25567ba66 Fix up a comment from PR #275 for accuracy 2014-10-07 21:32:55 -03:00
LovCAPONE
2dae3f7a3b Fix for bug #22443 (Scenario settings table inaccuracies)
In the method play_controller::fire_start, added start
gold amount update for all teams.
2014-10-07 21:31:07 -03:00
gfgtdf
ca546300de dont delete a side from carryover if it came back to life
This especialy fixes the scenario "Stolen Gold" from "Northern Rebirth" (http://gna.org/bugs/?22601)

this commit ports e0ec8c32b22c95412925bc163eeaca6ffa96d1ab from 1.12
2014-10-02 21:44:50 +02:00
Chris Beck
1b5a22965f Merge pull request #283 from cbeck88/chatlog
allow chat_log to be opened even when not in networked games
2014-09-21 17:21:47 -04:00
Chris Beck
7477e9d5db bugfix: when toggling accelerated speed, got overlapping print msgs 2014-09-11 08:48:33 -04:00
Chris Beck
55d093ba16 allow chat_log to be opened even when not in networked games
This was requested by players, so that they can review chat logs
offline more easily.
2014-09-11 07:56:26 -04:00
Mark de Wever
c119584895 Strip trailing whitespace. 2014-07-13 12:41:43 +02:00
gfgtdf
459630a67b remove unused variable. 2014-07-09 17:32:42 +02:00
Chris Beck
8ecef3b6f0 move homeless statistics calc fcns from unit.?pp to display_context 2014-07-06 17:41:39 -04:00
Chris Beck
d86b59f08a add filter_context class, use in unit_filter
The filter context is, game_board + tod manager.
game_display can (and now does) implement this interface,
also game_state. This permits both animations and engine
components to use it.
2014-07-03 10:27:01 -04:00
Chris Beck
79b95f76cf add some check_victory-related logging to engine/enemies channel
This seems likely to come in handy in the future... I have added
and removed debugging code like this several times :)
I think engine/enemies is a good channel for it which won't
clutter.
2014-07-01 11:08:14 -04:00
Chris Beck
c11ba80a53 Keep context menu open after selecting "more" or "earlier items"
We remember the last location of the context menu, and in this
case rebuild the menu and relaunch in the same place.
2014-06-28 21:37:05 -04:00
Chris Beck
f24f6adee1 add wmi pager class, to allow unlimited wml menu items
The pager is held by the play_controller and wraps around the
wmi_container, if there are too many items it adds "More Items"
or "Earlier Items" entries. These entries have special reserved
ids, if they are selected the pager traps them.

Future work might be to allow the page_size_ to be selected in
the preferences, that is currently left as a variable to make
it easy to support this.
2014-06-28 20:47:12 -04:00
Chris Beck
cb5a9a0d28 add display chat manager, notifications support outside game_display
The functionality of tracking observers and displaying chat messages
is moved to a manager class, which the gui owns.

The functionality of displaying notifications is similarly moved out
of the game_display and to a private namespace. (Static singleton
pattern seems okay here since there really won't need to be more
than one of these for a single application, it seems.)
2014-06-27 15:57:57 -04:00
Chris Beck
b0e407ac66 move halo::manager from play_controller to display
Also this removes the need to have it in the editor.
2014-06-27 10:36:15 -04:00
Chris Beck
82c6b98907 halo uses handle-body instead of static singleton idiom 2014-06-26 18:45:45 -04:00
gfgtdf
d3392cdee5 add comment 2014-06-24 23:41:08 +02:00
gfgtdf
97c1178e02 commented out unneeded code 2014-06-24 23:36:40 +02:00
Chris Beck
d583b3e401 add game_state::to_config 2014-06-24 17:18:53 -04:00
Chris Beck
15352a24e8 move some initializing from play_controller to game_state 2014-06-24 16:54:49 -04:00
Chris Beck
bcb39542c5 tweaks to play_controller::init
moved game_events manager init earlier
moved place_sides_in_preferred_locations to game_state
2014-06-24 16:08:23 -04:00
Chris Beck
e85c37e161 remove unused member (dead code) 2014-06-24 15:44:08 -04:00
Chris Beck
30a443d12f move game_state to its own file 2014-06-24 15:36:58 -04:00
Chris Beck
3d6f2d7821 add game_state class, separate from play_controller 2014-06-24 15:22:55 -04:00
Chris Beck
bd9fb6914c change saved_game name to saved_game_ in play_controllers 2014-06-24 14:17:17 -04:00
gfgtdf
436be9a306 more flexible hotkey scopes
there are some hotkeys that are senseful in editor and in game but not
in teh main menu, so now instead of having hotkeys eigher in GAME,
EDITOR, MAIN_MENU or GENERAL we now allow any combination of the first
3.

this is also intended to fix a bug in add_hotkey() if new_scope ==
hotkey::SCOPE_COUNT where new hotkeys doesn't correctly overwrite other
scoped hotkeys.
2014-06-21 23:44:24 +02:00
Chris Beck
3d6bcb4c39 move animation cache from play_controller to only fcn that uses it
This allows us to eliminate two headers and move code out of
play_controller, and keep related code together. The cache is
now a static variable in the only function that calls it.
2014-06-17 14:23:39 -04:00
Chris Beck
1cc51deb87 remove unit.hpp include from game_display.hpp 2014-06-17 13:17:14 -04:00
Chris Beck
6603de667b move animations vector to animation component, drop header in unit 2014-06-17 11:52:44 -04:00
gfgtdf
5bfce15789 move carryover handling out of playcampaign.cpp
this also makes a small change in the savefile format: [endlevel] ->
[end_level_data] in snapshots.

we still have the "store_carryover" function in playcampaign.cpp which does the visual message.
Note that the real carryover happens after linger mode while that message happens before linger mode this simplifies linger mode saves.
2014-06-15 17:00:43 +02:00
Chris Beck
fddd043663 change unnecessary resources:: ptrs to local variable uses
play_controller has a smart pointer to the gui, it doesn't need
to use the resources links
2014-06-13 11:30:52 -04:00
Chris Beck
7df5aab23e remove unnecessary resource:: ptr uses
play_controller contains the whiteboard manager as a local variable,
and therefore doesn't need to use the externally linked resource
pointers.
2014-06-13 02:01:10 -04:00
Chris Beck
8531ddeae5 add gamemap argument to tod_manager::add_time_area(config &c)
This is needed to properly parse a list of locations from strings,
to have the dimensions available.

This allows to refactor tod_manager and not use resources:: ptrs
in its implementation, instead using the objects from the relevant
context.
2014-06-13 01:17:55 -04:00
Chris Beck
2a2a50a178 make whiteboard a shared_pointer in resources
This makes subsequent commit easier, because lua wants to be able
to make reports, and therefore needs a report_context
2014-06-12 19:41:38 -04:00
Chris Beck
5145c9422c display takes a pointer to whiteboard manager
It uses a shared_ptr, to prevent crashes during play_controller
initialization. But it only holds a weak_ptr, to preserve
previous behavior of skipping whiteboard ops when the ptr is
NULL.

It requires also for us to construct the whiteboard before
constructing the gui, so that we have a valid pointer to pass.

Most likely all of the managers will have to be moved forward,
in this commit we move forward the whiteboard and pathfinding
module, anticipating future commits.
2014-06-12 19:21:00 -04:00
Chris Beck
e4eb0a3ede use ptr to impl for gamemap in game_board, avoiding map.h include
unit_map is modified in many places that don't normally include
map.hpp, so to avoid doing harm by adding this class, I am making
it hold a scoped pointer to the gamemap instead of an actual
gamemap. This results in very few changes.

- The implementation of game_board has to use the pointer.
- game_board must use copy and swap idiom
- lua get terrain function must pass strings to the game_board,
  not enums, and we parse them as std::strings in game_board
  instead of as c strings in lua api (which was a bit gross anyhow)
2014-06-10 23:23:39 -04:00
Chris Beck
148d42ea88 Merge branch 'master' of git://github.com/wesnoth/wesnoth 2014-06-10 21:46:47 -04:00
Chris Beck
22cc827d71 finish removing resources::game_map
The remaining uses are just, checking whether or not the pointer
is null, or resets to its value, or simply storing it in a local
variable.

It might be appropriate to add resources::game_map back as a
function taking no parameters, at least this is flexible
enough to be changed later easily.
2014-06-10 21:26:41 -04:00
Chris Beck
4830b8ee3c partially remove resources::game_map (part 1)
This is the result of running, in src/ directory, the following:

find . -type f -exec sed -i 's/resources::game_map->/resources::gameboard->map()./g' '{}' \;

and carefully inspecting the result, and adding "game_board.hpp"
2014-06-10 20:13:11 -04:00
gfgtdf
929b7dfede rename game_state -> saved_game
and move it into a new file.
2014-06-11 01:21:22 +02:00
Chris Beck
ae5436d565 Merge branch 'add_display_context' 2014-06-10 18:34:09 -04:00
Chris Beck
13fca9a358 fixup play_controller initialization order 2014-06-10 17:16:11 -04:00
gfgtdf
99feabf3c4 Merge pull request #200 from gfgtdf/gamestate_refactor
move next_underlying_unit_id + game_state refactor
2014-06-10 23:13:30 +02:00
gfgtdf
b39601d700 remove outdated comment
there are random calls before "prestart" and we already use "random_new_deterministic" in that case.
2014-06-10 19:24:57 +02:00
gfgtdf
f26f992bf1 move next_underlying_unit_id
from savefiles toplevel to savefiles [snapshot]/[replay_start]/[carryover_sides_start]
previously this was handled specialy at scenario toplevel sometimes and in those tags at some other times.

accoringly to that change we now set n_unit::id_manager at play_controller s constructor.
2014-06-10 19:11:14 +02:00