add a cache for WML added animations, partial...
...(and probably final) fix for bug #16363
This commit is contained in:
parent
1a5b6d629f
commit
03dd653b6c
2 changed files with 13 additions and 1 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "statistics.hpp"
|
||||
#include "tod_manager.hpp"
|
||||
#include "savegame_config.hpp"
|
||||
#include "unit_animation.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -134,6 +135,7 @@ public:
|
|||
events::mouse_handler& get_mouse_handler_base();
|
||||
events::menu_handler& get_menu_handler() { return menu_handler_; }
|
||||
|
||||
std::map< std::string, std::vector<unit_animation> > animation_cache;
|
||||
protected:
|
||||
void slice_before_scroll();
|
||||
|
||||
|
|
12
src/unit.cpp
12
src/unit.cpp
|
@ -39,6 +39,7 @@
|
|||
#include "formula_string_utils.hpp"
|
||||
#include "team.hpp"
|
||||
#include "scripting/lua.hpp"
|
||||
#include "play_controller.hpp"
|
||||
|
||||
static lg::log_domain log_unit("unit");
|
||||
#define DBG_UT LOG_STREAM(debug, log_unit)
|
||||
|
@ -2483,7 +2484,16 @@ void unit::add_modification(const std::string& type, const config& mod, bool no_
|
|||
game_config::add_color_info(effect);
|
||||
LOG_UT << "applying image_mod \n";
|
||||
} else if (apply_to == "new_animation") {
|
||||
unit_animation::add_anims(animations_, effect);
|
||||
if(effect["id"].empty()) {
|
||||
unit_animation::add_anims(animations_, effect);
|
||||
} else {
|
||||
std::vector<unit_animation> &built = resources::controller->animation_cache[effect["id"]];
|
||||
if(built.empty()) {
|
||||
unit_animation::add_anims(built, effect);
|
||||
}
|
||||
animations_.insert(animations_.end(),built.begin(),built.end());
|
||||
}
|
||||
|
||||
} else if (apply_to == "ellipse") {
|
||||
cfg_["ellipse"] = effect["ellipse"];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue