Fixed animated cursors segfaulting the game.
This commit is contained in:
parent
ce961c1a2e
commit
e3b02d0bbc
3 changed files with 11 additions and 4 deletions
|
@ -90,7 +90,6 @@ void clear_cache()
|
|||
}
|
||||
|
||||
if(cursor_buf != NULL) {
|
||||
SDL_FreeSurface(cursor_buf);
|
||||
cursor_buf = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +157,6 @@ void draw(surface screen)
|
|||
}
|
||||
|
||||
if(have_focus == false) {
|
||||
SDL_FreeSurface(cursor_buf);
|
||||
cursor_buf = NULL;
|
||||
return;
|
||||
}
|
||||
|
@ -179,7 +177,6 @@ void draw(surface screen)
|
|||
}
|
||||
|
||||
if(cursor_buf != NULL && (cursor_buf->w != surf->w || cursor_buf->h != surf->h)) {
|
||||
SDL_FreeSurface(cursor_buf);
|
||||
cursor_buf = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1728,7 +1728,6 @@ void display::blit_surface(int x, int y, surface surf, SDL_Rect* srcrect, SDL_Re
|
|||
surface display::get_minimap(int w, int h)
|
||||
{
|
||||
if(minimap_ != NULL && (minimap_->w != w || minimap_->h != h)) {
|
||||
SDL_FreeSurface(minimap_);
|
||||
minimap_ = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ std::map<image::locator,bool> image_existance_map;
|
|||
|
||||
std::map<surface, surface> reversed_images_;
|
||||
|
||||
std::map<image::locator, image::locator> alternative_images_;
|
||||
|
||||
int red_adjust = 0, green_adjust = 0, blue_adjust = 0;
|
||||
|
||||
std::string image_mask;
|
||||
|
@ -498,6 +500,15 @@ surface reverse_image(const surface& surf)
|
|||
return rev;
|
||||
}
|
||||
|
||||
image::locator get_alternative(const image::locator &i_locator, const std::string &alt)
|
||||
{
|
||||
const std::map<locator,locator>::iterator itor = alternative_images_.find(i_locator);
|
||||
|
||||
if(itor != alternative_images_.end())
|
||||
return itor->second;
|
||||
|
||||
}
|
||||
|
||||
void register_image(const image::locator& id, const surface& surf)
|
||||
{
|
||||
id.add_to_cache(images_, surf);
|
||||
|
|
Loading…
Add table
Reference in a new issue