Create Engine: removed surface getters from type classes
This commit is contained in:
parent
c6bf9359d8
commit
d435d861f2
2 changed files with 0 additions and 33 deletions
|
@ -124,7 +124,6 @@ config& level::data()
|
|||
scenario::scenario(const config& data) :
|
||||
level(data),
|
||||
map_(),
|
||||
minimap_img_(),
|
||||
map_hash_(),
|
||||
num_players_(0)
|
||||
{
|
||||
|
@ -139,23 +138,6 @@ bool scenario::can_launch_game() const
|
|||
return map_.get() != nullptr;
|
||||
}
|
||||
|
||||
surface scenario::create_image_surface(const SDL_Rect& image_rect)
|
||||
{
|
||||
if (!map_) {
|
||||
minimap_img_ = surface();
|
||||
return minimap_img_;
|
||||
}
|
||||
|
||||
std::string current_hash = util::encode_hash(util::md5(map_->write()));
|
||||
|
||||
if (minimap_img_.null() || (map_hash_ != current_hash)) { // If there's no minimap image, or the map hash doesn't match, regenerate the image cache.
|
||||
minimap_img_ = image::getMinimap(image_rect.w, image_rect.h, *map_, 0);
|
||||
map_hash_ = current_hash;
|
||||
}
|
||||
|
||||
return minimap_img_;
|
||||
}
|
||||
|
||||
void scenario::set_metadata()
|
||||
{
|
||||
const std::string& map_data = data_["map_data"];
|
||||
|
@ -339,14 +321,6 @@ bool campaign::can_launch_game() const
|
|||
return !data_.empty();
|
||||
}
|
||||
|
||||
surface campaign::create_image_surface(const SDL_Rect& image_rect)
|
||||
{
|
||||
surface temp_image(
|
||||
image::get_image(image::locator(image_label_)));
|
||||
|
||||
return scale_surface(temp_image, image_rect.w, image_rect.h);
|
||||
}
|
||||
|
||||
void campaign::set_metadata()
|
||||
{
|
||||
image_label_ = data_["image"].str();
|
||||
|
|
|
@ -46,8 +46,6 @@ public:
|
|||
|
||||
virtual bool can_launch_game() const = 0;
|
||||
|
||||
virtual surface create_image_surface(const SDL_Rect& image_rect) = 0;
|
||||
|
||||
virtual void set_metadata() = 0;
|
||||
|
||||
virtual std::string name() const;
|
||||
|
@ -76,8 +74,6 @@ public:
|
|||
|
||||
bool can_launch_game() const;
|
||||
|
||||
surface create_image_surface(const SDL_Rect& image_rect);
|
||||
|
||||
void set_metadata();
|
||||
|
||||
int num_players() const;
|
||||
|
@ -88,7 +84,6 @@ protected:
|
|||
|
||||
std::unique_ptr<gamemap> map_;
|
||||
|
||||
surface minimap_img_;
|
||||
std::string map_hash_;
|
||||
|
||||
private:
|
||||
|
@ -152,8 +147,6 @@ public:
|
|||
|
||||
bool can_launch_game() const;
|
||||
|
||||
surface create_image_surface(const SDL_Rect& image_rect);
|
||||
|
||||
void set_metadata();
|
||||
|
||||
void mark_if_completed();
|
||||
|
|
Loading…
Add table
Reference in a new issue