Merge branch '1.12' of https://github.com/wesnoth/wesnoth into 1.12

This commit is contained in:
Chris Beck 2014-04-16 21:05:36 -04:00
commit 91ac54fa9d
10 changed files with 95 additions and 80 deletions

View file

@ -23,6 +23,8 @@ Version 1.11.12+dev:
* Language and i18n:
* Updated translations: Czech, French, Hungarian, Italian, Slovak
* Added missing translation mark for mp-related idle notification string
* Units:
* Fix sound timings for drake fire animation macros
* Miscellaneous and bug fixes:
* Petrified units are no longer displayed in the "Damage versus" tooltip.
* Fix bug #21759: "timer refreshed too often when time runs out"

View file

@ -990,14 +990,11 @@
start_time=-900
[frame]
image="units/drakes/{DRAKE_NAME}-fire-inhale-1.png:100"
sound=flame-big.ogg
[/frame]
[frame]
image="units/drakes/{DRAKE_NAME}-fire-inhale-[2~4,2].png:100"
image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
[/frame]
[frame]
image="units/drakes/{DRAKE_NAME}-fire-{DIRECTION_SUFFIX}-[1~3,2,1].png:100"
sound=flame-big.ogg
[/frame]
[/attack_anim]
@ -1053,14 +1050,11 @@
start_time=-900
[frame]
image="units/drakes/{DRAKE_NAME}-fire-inhale-1.png:100"
sound=flame-big-miss.ogg
[/frame]
[frame]
image="units/drakes/{DRAKE_NAME}-fire-inhale-[2~4,2].png:100"
image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
[/frame]
[frame]
image="units/drakes/{DRAKE_NAME}-fire-{DIRECTION_SUFFIX}-[1~3,2,1].png:100"
sound=flame-big-miss.ogg
[/frame]
[/attack_anim]
#enddef
@ -1077,25 +1071,13 @@
halo_x,halo_y={OFFSET_POSITION}
[/missile_frame]
start_time=-900
[if]
hits=no
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
sound=flame-big-miss.ogg
[/frame]
[/if]
[else]
hits=yes
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
sound=flame-big.ogg
[/frame]
[/else]
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
[/frame]
[frame]
image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
[/frame]
{SOUND:HIT_AND_MISS flame-big.ogg flame-big-miss.ogg -480}
[frame]
image="units/drakes/{DRAKE_NAME}-fire-se-[1~3,2,1].png:100"
[/frame]
@ -1114,25 +1096,13 @@
halo_x,halo_y={OFFSET_POSITION}
[/missile_frame]
start_time=-900
[if]
hits=no
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
sound=flame-big-miss.ogg
[/frame]
[/if]
[else]
hits=yes
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
sound=flame-big.ogg
[/frame]
[/else]
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
[/frame]
[frame]
image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
[/frame]
{SOUND:HIT_AND_MISS flame-big.ogg flame-big-miss.ogg -480}
[frame]
image="units/drakes/{DRAKE_NAME}-fire-se-[1~3,2,1].png:100"
[/frame]
@ -1151,25 +1121,13 @@
halo_x,halo_y={OFFSET_POSITION}
[/missile_frame]
start_time=-900
[if]
hits=no
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
sound=flame-big-miss.ogg
[/frame]
[/if]
[else]
hits=yes
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
sound=flame-big.ogg
[/frame]
[/else]
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
[/frame]
[frame]
image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
[/frame]
{SOUND:HIT_AND_MISS flame-big.ogg flame-big-miss.ogg -480}
[frame]
image="units/drakes/{DRAKE_NAME}-fire-s-[1~3,2,1].png:100"
[/frame]
@ -1188,25 +1146,13 @@
halo_x,halo_y={OFFSET_POSITION}
[/missile_frame]
start_time=-900
[if]
hits=no
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
sound=flame-big-miss.ogg
[/frame]
[/if]
[else]
hits=yes
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
sound=flame-big.ogg
[/frame]
[/else]
[frame]
image="units/drakes/{DRAKE_NAME}.png:20"
[/frame]
[frame]
image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
[/frame]
{SOUND:HIT_AND_MISS flame-big.ogg flame-big-miss.ogg -480}
[frame]
image="units/drakes/{DRAKE_NAME}-fire-s-[1~3,2,1].png:100"
[/frame]

View file

@ -143,8 +143,8 @@ private:
class unit_callable : public game_logic::formula_callable {
public:
typedef map_location location;
unit_callable(const std::pair<location, unit>& pair)
: loc_(pair.first), u_(pair.second)
unit_callable(const location& loc, const unit& u)
: loc_(loc), u_(u)
{
type_ = UNIT_C;
}

View file

@ -38,6 +38,7 @@
#include "resources.hpp"
#include "whiteboard/manager.hpp"
#include "overlay.hpp"
#include "synced_context.hpp"
#include "SDL_image.h"
@ -2465,7 +2466,7 @@ void display::draw(bool update,bool force) {
if (screen_.update_locked()) {
return;
}
set_scontext_leave_for_draw leave_synced_context;
local_tod_light_ = has_time_area() && preferences::get("local_tod_lighting", true);
draw_init();

View file

@ -26,6 +26,7 @@
#include "actions/create.hpp"
#include "actions/move.hpp"
#include "actions/undo.hpp"
#include "config_assign.hpp"
#include "dialogs.hpp"
#include "game_display.hpp"
#include "game_end_exceptions.hpp"
@ -687,7 +688,20 @@ static void check_checksums(const config &cfg)
}
}
bool replay::add_start_if_not_there_yet()
{
//this method would confuse the value of 'pos' otherwise
assert(pos_ == 0);
if(at_end() || !cfg_.child("command", pos_).has_child("start"))
{
cfg_.add_child_at("command",config_of("start", config()),pos_);
return true;
}
else
{
return false;
}
}
static void show_oos_error_error_function(const std::string& message, bool /*heavy*/)
{

View file

@ -127,7 +127,11 @@ public:
int ncommands() const;
static void process_error(const std::string& msg);
/*
adds a [start] at the begnning of the replay if there is none.
returns true if a [start] was added.
*/
bool add_start_if_not_there_yet();
private:
void add_chat_log_entry(const config &speak, std::back_insert_iterator< std::vector<chat_msg> > &i) const;

View file

@ -37,6 +37,7 @@ static lg::log_domain log_engine("engine");
static lg::log_domain log_replay("replay");
#define DBG_REPLAY LOG_STREAM(debug, log_replay)
#define LOG_REPLAY LOG_STREAM(info, log_replay)
#define ERR_REPLAY LOG_STREAM(err, log_replay)
LEVEL_RESULT play_replay_level(const config& game_config,
const config* level, CVideo& video, game_state& state_of_game)
@ -293,6 +294,10 @@ void replay_controller::reset_replay()
// Scenario initialization. (c.f. playsingle_controller::play_scenario())
fire_preload();
if(true){ //block for set_scontext_synced
if(recorder.add_start_if_not_there_yet())
{
ERR_REPLAY << "inserted missing [start]\n";
}
config* pstart = recorder.get_next_action();
assert(pstart->has_child("start"));
/*

View file

@ -363,6 +363,33 @@ set_scontext_local_choice::~set_scontext_local_choice()
random_new::generator = old_rng_;
}
set_scontext_leave_for_draw::set_scontext_leave_for_draw()
: previous_state_(synced_context::get_syced_state())
{
if(previous_state_ != synced_context::SYNCED)
{
return;
}
synced_context::set_syced_state(synced_context::LOCAL_CHOICE);
old_rng_ = random_new::generator;
//calling the synced rng form inside a local_choice would cause oos.
//TODO use a member variable instead if new/delete
random_new::generator = new random_new::rng();
}
set_scontext_leave_for_draw::~set_scontext_leave_for_draw()
{
if(previous_state_ != synced_context::SYNCED)
{
return;
}
assert(synced_context::get_syced_state() == synced_context::LOCAL_CHOICE);
synced_context::set_syced_state(synced_context::SYNCED);
delete random_new::generator;
random_new::generator = old_rng_;
}
random_seed_choice::random_seed_choice()

View file

@ -158,6 +158,22 @@ private:
random_new::rng* old_rng_;
};
/*
an object to leave the synced context during draw when we dont know whether we are in a synced context or not.
if we are in a sanced context we leave the synced context otherwise it has no effect.
we need this because we might call lua's wesnoth.theme_items during draw and we dont want to have that an effect on the gamestate in this case.
*/
class set_scontext_leave_for_draw
{
public:
set_scontext_leave_for_draw();
~set_scontext_leave_for_draw();
private:
random_new::rng* old_rng_;
synced_context::syced_state previous_state_;
};
/*
a helper object to server random seed generation.
*/

View file

@ -1629,7 +1629,7 @@ bool unit::internal_matches_filter(const vconfig& cfg, const map_location& loc,
}
config::attribute_value cfg_formula = cfg["formula"];
if (!cfg_formula.blank()) {
const unit_callable callable(std::pair<map_location, unit>(loc,*this));
const unit_callable callable(loc,*this);
const game_logic::formula form(cfg_formula);
if(!form.evaluate(callable).as_bool()) {///@todo use formula_ai
return false;