57600 Commits

Author SHA1 Message Date
Boldizsár Lipka
66fdc79e5d Add a function that loads a texture. 2014-06-11 22:49:36 +02:00
Boldizsár Lipka
03c0efe95b Remove twindow::clear. 2014-06-11 22:49:36 +02:00
Boldizsár Lipka
4288e08b04 Better name for twindow::clear(Uint8, Uint8, Uint8, Uint8). 2014-06-11 22:49:36 +02:00
Chris Beck
656870ca64 move parse_location_range to map:: object
This function required the use of resources::game_map, so properly
should be a method of game_map. This will help us to make sure that
such functions work when using either the editor or the play
controller, or the replay controller, and generally improve
encapsulation.
2014-06-11 14:50:07 -04:00
Chris Beck
33689f6c7c fixup prior commit 2014-06-11 14:48:19 -04:00
Chris Beck
0d6f146ed3 use disp_context->units() in reports, not resources::units 2014-06-11 14:15:44 -04:00
Chris Beck
d2f35c6082 comment out unused includes 2014-06-11 13:26:10 -04:00
Chris Beck
2bd6520d0c use display_context pointer for reports that need teams 2014-06-11 12:39:07 -04:00
Alexander van Gessel
7960e4746f Fix SDL2 compilation with scons 2014-06-11 12:35:19 +02:00
Chris Beck
3b70c87f5b Merge branch 'fixup_segfaulting_editor' 2014-06-11 01:31:25 -04:00
Chris Beck
da552fc10e fixup segfaulting editor, favoring display_context over game_board
Currently, the editor does not generate game_board objects, and
leaves the pointer resources::gameboard null. This commit makes
map_location, reports, and tod_manager, three things used in
editor mode, use the display_context pointer instead of the
game_board pointer. We also move a function to display_context,
which finds a const unit * to a visible unit at a hex.
2014-06-11 01:28:15 -04:00
Ignacio R. Morelle
6558bdc785 campaignd: Write config to disk every ten minutes, not 60 seconds
The 60 seconds value was just intended for internal testing and it
slipped into production by accident.
2014-06-11 00:44:32 -04:00
Chris Beck
126358f50c add display_context pointer to resources
This should be removed soon, it is just a short term corrective
measure for an editor segfault introduced in prior commits. The
plan is to correct the segfaults, then refactor this away.
2014-06-11 00:20:11 -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
Ignacio R. Morelle
1ef59a37d1 THoT S4: Replace the wooden bridge with a stone one per the start dialogue
This commit also rewrites the map to drop the superfluous whitespace per
the changes to the editor in 1.11.x.
2014-06-10 23:12:24 -04:00
Ignacio R. Morelle
52f71d900f Merge branch 'feature/campaignd-refactoring'
Refactors most of campaignd's code to ease future feature additions and
bug fixes, making the code slightly more organized and readable.

No behavior changes expected or observed from the state previous to this
merge.
2014-06-10 22:46:00 -04:00
Ignacio R. Morelle
fb5c5abeff campaignd: Use const references or values where applicable
Some old code used copies or read-write refererences for strings that
are never deliberately modified afterwards; and a bit of my own code
gets a (arguably tiny) WML config by value from a method that always
returns a read-only reference, missing out on a tiny optimization
opportunity by avoiding a config copy.

There was also a once-written int variable in handle_request_campaign().
2014-06-10 22:39:33 -04:00
Ignacio R. Morelle
e13570954a campaignd: Code indentation and spacing style changes for consistency
No functional changes.
2014-06-10 22:39:32 -04:00
Ignacio R. Morelle
603c06d1e7 campaignd: Show RO mode warning in load_config() rather than in run() 2014-06-10 22:39:32 -04:00
Ignacio R. Morelle
9b1fd86016 campaignd: Use empty C strings instead of t_strings to clear out attributes 2014-06-10 22:39:32 -04:00
Ignacio R. Morelle
dff480bb07 campaignd: Drop pointless use of lexical_cast to set WML attributes
Since 1.9.x, using lexical_cast to set config attributes is no longer
required and the engine will automatically try to cast string values to
a more "natural" type.

Thus, this commit incurs in no real behavior changes.
2014-06-10 22:39:32 -04:00
Ignacio R. Morelle
7535b916a3 campaignd: Wrap request handler registration statements in macros
This should make it easier to add new handlers or change their API at a
later point.
2014-06-10 22:39:32 -04:00
Ignacio R. Morelle
42ee57c919 campaignd: Move and document more ancillary functions
Since the move is between two files, I took this opportunity to rename
a "campaign" parameter to "addon" and tweak the code style for
consistency.
2014-06-10 22:39:31 -04:00
Ignacio R. Morelle
0d81fae45b campaignd: Move several anonymous namespace members to a new file
This step covers the markup char check function and the add-on feedback
URL formatter.
2014-06-10 22:39:31 -04:00
Ignacio R. Morelle
e5354435b1 campaignd: Refactor construct_message/error() functions and boilerplate
This replaces them with two methods that are part of the server class
itself.

These functions were always used in conjunction with
network::send_data() to send the generated WML object to a network
client. Because the config was created within the functions and not on
the callsite, this resulted in a call to the config copy constructor
that could be avoided by grouping the network::send_data() call together
with the WML generation.
2014-06-10 22:39:31 -04:00
Ignacio R. Morelle
c164cb22b0 campaignd: Refactor request handling blocks into separate methods
These methods are tried and run in sequence by looking them up from a
request handler registry maintained as part of the server object. Since
every campaignd request is a single WML node with an identifying name, I
feel this approach makes things more readable than the previous massive
deeply-nested if-else-if chain approach, but that might be just me.
2014-06-10 22:39:31 -04:00
Ignacio R. Morelle
a8ea4796a0 campaignd: Replace write_config() scheduling mechanism
Check time() deltas instead of incrementing a counter variable forever.
This should allow to extract a bit of the run() logic into a separate
method later.
2014-06-10 22:39:30 -04:00
Ignacio R. Morelle
deea32f9a5 campaignd: Make input_ a boost::scoped_ptr 2014-06-10 22:39:30 -04:00
Ignacio R. Morelle
ada5a7ca60 campaignd: Refactor config commit boilerplate into a separate method 2014-06-10 22:39:29 -04:00
Ignacio R. Morelle
796b77d440 campaignd: Rename a server class field and some scoped_ostream objects
The file_ field is now cfg_file_ to avoid ambiguity ("what file and for
what?"). Since there are a lot of scoped_ostream instantiations around
named cfgfile which are used to write to the cfg_file_ path, those are
now renamed to simply out, also to avoid ambiguity -- just an
intermediate step before refactoring those into a separate method.
2014-06-10 22:39:22 -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
gfgtdf
c9be48f570 game_state -> saved_game in test_mp_connect.cpp
my local build doesn't include this file so i didn't notice.
2014-06-11 03:12:47 +02:00
Chris Beck
aab7edd88c remove resources::game_map (part 2)
This the result of executing, in folder src/, the following

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

and carefully inspecting the result.

We also had to add game_board.hpp includes in various places,
and change the arguent order of unit::is_visible_to_team --
this function was taking *resources::game_map as its default
argument, and we do not want to include game_board in unit.hpp,
as it creates cyclic dependencies. This was resolved by
eliminating this as a default value -- this is an improvement,
since usually when this function was called it was in a context
where a game_map was available already locally anyways.
2014-06-10 20:53:00 -04:00
gfgtdf
a3a999572c fix / -> \ 2014-06-11 02:33:08 +02:00
gfgtdf
3bc9e0476d remove function we had twice
convert_old_saves is already defined in gamestatus.cpp
2014-06-11 02:13:25 +02: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
7154ab4609 add comment about unused code. 2014-06-11 02:02:22 +02:00
gfgtdf
ea4af52470 disable unneeded code. 2014-06-11 02:00:38 +02:00
gfgtdf
31927886f5 fixup renaming game_state -> saved_game
this somehow got lost.
2014-06-11 01:54:37 +02:00
gfgtdf
7f6d4a7e25 simplify saved_game s constructor 2014-06-11 01:45:30 +02: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
3c93463b3c Merge branch 'master' of git://github.com/wesnoth/wesnoth 2014-06-10 19:05:00 -04:00
Chris Beck
6fe87277be fixup a subtle problem in the replay_controller reset procedure
You can see that this must be done by reading display.cpp and
looking at the similar editor code that switches map contexts.
2014-06-10 19:04:22 -04:00
gfgtdf
f1c4485ce3 add comment in synced_context.cpp
[ci skip]
2014-06-11 01:01:40 +02:00
gfgtdf
2b9fc977c6 fixup replays 2014-06-11 00:53:01 +02:00
Chris Beck
522988c689 update projectfiles to include display_context.hpp 2014-06-10 18:45:44 -04:00
Chris Beck
ae5436d565 Merge branch 'add_display_context' 2014-06-10 18:34:09 -04:00
Chris Beck
43ade4615a display uses display_context internally, not 3 private pointers
Also refactor editor and game_display to use this.

To achieve this it turns out we also have to add a "dummy display
context" unique to the editor code, which it can use to initalize
editor display, because after refactor NULL doesn't cut it
anymore. This appears in src/editor/editor_display.?pp, might
want to branch into its own file later.
2014-06-10 18:29:03 -04:00
gfgtdf
35b8730f8c remove random.cpp
this file only contained outdated comments.
2014-06-11 00:19:29 +02:00