Make an error message more useful by propagating the filename.
This commit is contained in:
parent
a7d3f68b46
commit
3a1a2f4657
3 changed files with 8 additions and 4 deletions
|
@ -705,7 +705,7 @@ static surface get_hexed(const locator& i_locator)
|
|||
surface image(get_image(i_locator, UNSCALED));
|
||||
// hex cut tiles, also check and cache if empty result
|
||||
bool is_empty = false;
|
||||
surface res = mask_surface(image, get_hexmask(), &is_empty);
|
||||
surface res = mask_surface(image, get_hexmask(), &is_empty, i_locator.get_filename());
|
||||
i_locator.add_to_cache(is_empty_hex_, is_empty);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -805,7 +805,7 @@ surface adjust_surface_alpha_add(const surface &surf, int amount, bool optimize)
|
|||
return optimize ? create_optimized_surface(nsurf) : nsurf;
|
||||
}
|
||||
|
||||
surface mask_surface(const surface &surf, const surface &mask, bool* empty_result)
|
||||
surface mask_surface(const surface &surf, const surface &mask, bool* empty_result, const std::string& filename)
|
||||
{
|
||||
if(surf == NULL) {
|
||||
return NULL;
|
||||
|
@ -826,7 +826,11 @@ surface mask_surface(const surface &surf, const surface &mask, bool* empty_resul
|
|||
// (different height is not a real problem)
|
||||
// This function is used on all hexes and usually only for that
|
||||
// so better keep it simple and efficient for the normal case
|
||||
std::cerr << "Detected an image with bad dimensions :" << nsurf->w << "x" << nsurf->h << "\n";
|
||||
std::stringstream ss;
|
||||
ss << "Detected an image with bad dimensions: ";
|
||||
if(!filename.empty()) ss << filename << ": ";
|
||||
ss << nsurf->w << "x" << nsurf->h << "\n";
|
||||
std::cerr << ss.str();
|
||||
std::cerr << "It will not be masked, please use :"<< nmask->w << "x" << nmask->h << "\n";
|
||||
return nsurf;
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ surface adjust_surface_alpha(const surface &surf, fixed_t amount, bool optimize=
|
|||
surface adjust_surface_alpha_add(const surface &surf, int amount, bool optimize=true);
|
||||
|
||||
/** Applies a mask on a surface. */
|
||||
surface mask_surface(const surface &surf, const surface &mask, bool* empty_result = NULL);
|
||||
surface mask_surface(const surface &surf, const surface &mask, bool* empty_result = NULL, const std::string& filename = std::string());
|
||||
|
||||
/** Check if a surface fit into a mask */
|
||||
bool in_mask_surface(const surface &surf, const surface &mask);
|
||||
|
|
Loading…
Add table
Reference in a new issue