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

At long last, the flickering chat bug is fixed!

Recommended Posts

For those who don't know the bug... When you're online a long time, as in several hours, the list of messages in the client can get full. When the list is full, it starts using old message slots.

This works fine, except that as messages move up in the main view, you can see old messages flickering there.

This bug has been annoying me for a long time, and I finally found the cause! The fix:

Index: gamewin.c
RCS file: /cvsroot/elc/elc/gamewin.c,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -d -r1.186 -r1.187
--- gamewin.c   12 Jun 2007 21:32:17 -0000      1.186
+++ gamewin.c   13 Jun 2007 22:15:41 -0000      1.187
@@ -827,15 +827,12 @@
        /* Draw the chat text */
        if (use_windowed_chat != 2)
-               int msg, offset, ytext, htext, filter;
-               ytext = use_windowed_chat == 1 ? 25 : 20;
-               htext = (int) (1 + lines_to_show * 18 * chat_zoom);
+               int msg, offset, filter;
                filter = use_windowed_chat == 1 ? current_filter : FILTER_ALL;
                if (find_last_lines_time (&msg, &offset, filter, console_text_width))
                        set_font(chat_font);    // switch to the chat font
-                       draw_messages (10, ytext, display_text_buffer, DISPLAY_TEXT_BUFFER_SIZE, filter, msg, offset, -1, console_text_width, htext, chat_zoom);
+                       draw_messages (10, use_windowed_chat == 1 ? 25 : 20, display_text_buffer, DISPLAY_TEXT_BUFFER_SIZE, filter, msg, offset, -1, console_text_width, (int) (1 + lines_to_show * 18 * chat_zoom), chat_zoom);
                        set_font (0);   // switch to fixed

The problem is that htext is set, using lines_to_show, but find_last_lines_time can change lines_to_show. I found this by accident while adding numerous debugging printfs(): "Err. Waitaminute... why is it in that order, that isn't... Oh. My. Gosh."

Basically, someone figured out the height we should be drawing to, and then called a function that can potentially change what it should be, and then used the old number.


So, to other coders: Please be careful you don't invalidate your data. Where possible, don't even calculate it until you need it. In the above case, the ytext and htext variables, if used at all (which they aren't now) should have been inside the if(), not set beforehand.


ed: Wow, this was an old bug... If it was first introduced in the commit I think it was, then, according to berlios:

Sun Jul 3 2005 UTC (23 months, 1 week ago)


If not part of that commit, it's even older (as it's possible the older code had a similar bug).


anyone fixed any bugs that lasted longer? :(


ed2: For those who have this problem, until a client update, just use #cls. It will clear all old chat and the flickering will be gone for another 6-10 hours :P

If you don't like a blank console, you can then use #glinfo to fill it up and you'll have a screenfull again

Edited by ttlanhil

Share this post

Link to post
Share on other sites

Good find, ttl!


My bug fix record was set last week, a 22 months old bug. And noone ever noticed that bug. So you're a month ahead of me :P


goes off to check old commits for unfixed bugs


EDIT: typo

EDIT2: just stumbled upon a bug introduced Sat Apr 9 00:21:08 2005 UTC (2 years, 2 months ago) by ... myself, of course. In the notepad, so noone's ever seen it :)

Edited by Grum

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.