Jump to content
Eternal Lands Official Forums
Sign in to follow this  
Grum

Error log spamming

Recommended Posts

The current sequence for using textures seems to be something like

int slot = load_texture_cache (file_name, alpha);

which is equivalent to

int slot = load_texture_cache_deferred(file_name, alpha);
get_and_set_texture_id(slot);
return slot;

and always returns a valid slot if the cache isn't full. Then when the texture needs to be used

int texture = get_and_set_texture_id (slot);

Now get_and_set_texture_id() will (through get_texture_id() -> load_bmp8_* () ) try to load the texture if it hasn't done so yet, printing a nice error message when it fails to do so, for instance when the texture doesn't exist. However, since this function is typically called every frame, a missing texture will very quickly[*] fill up your error log with these failure messages.

 

The original caller of load_texture_cache() has no idea if something went wrong, since all it receives is the index in the texture_cache array, and that's always valid.

 

The question is how we want to fix this. Have load_texture_cache() return an invalid slot when the initial get_and_set_texture_id() fails and leave it up to the caller to deal with it? Then we still have the same problem with functions that call load_texture_cache_deferred() directly. Don't let get_and_set_texture_id() try to load a file? Then we might as well throw out load_texture_cache_deferred(), and probably the whole texture caching system won't work anymore. The only option I see at this moment is to extend the texture_cache_struct with an extra flag that tells us whether we've tried to load the texture before and failed. That introduces some extra administration, but hopefully not too much.

 

If you have alternative ideas for fixing this, please let me know. Other thought, ideas are very welcome, since my laptop is already short on disk space ;)

 

[*] Actually, two missing textures will, a single one will probably result in something like "Last message repeated 18936109281269 times".

Share this post


Link to post
Share on other sites

Okay, I tried the approach described above yesterday evening and it seems to work. At least I got a single error, and didn't notice anything strange. I checked it in, let me know if it causes problems.

Share this post


Link to post
Share on other sites

Oops, sorry.

I only added a few lines though, so it shouldn't be too difficult to sort out.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×