How to crash client with haven error

The worst monsters in the Hearthlands warp the fabric of space and time..

Re: How to crash client with haven error

Postby theTrav » Sun Sep 06, 2009 2:16 am

loftar wrote:Cool, I'll probably apply it as a fix until I will myself to look up the real text measuring APIs. Thanks!

I have to ask, though -- why are you using an Indir<StringBuffer> instead of just a StringBuffer?

Short answer is because I didn't take something into account in the original design of my solution, and rather than going back to fix my hack to be the perfect hack it could be, I just kludged in the easiest container I could find.

Long answer is that I needed to re-start the StringBuffer for every new line and then still have access to it when the wrap method returned so I could make sure the last line was added to the list. I was under the impression I would be able to find some sort of clear method on StringBuffer to remove all the current text in it, but couldn't find one (I looked for clear, empty, remove, delete saw nothing) so I just wrapped it in a container.

I apologize for my incompetence. In my defence, I was drunk at the time!
User avatar
theTrav
 
Posts: 3464
Joined: Fri May 29, 2009 11:25 pm

Re: How to crash client with haven error

Postby Pacho » Mon Sep 07, 2009 9:57 am

<.< I was under the impression that measuring text in Java was fairly easy since nearly everything dealing with text has something that keeps tracks of its length

>.>

But don't mind me, I haven't programmed in java for quite a while now.
Pacho
 
Posts: 712
Joined: Wed Jun 10, 2009 2:21 am

Re: How to crash client with haven error

Postby theTrav » Mon Sep 07, 2009 10:37 am

Pacho wrote:<.< I was under the impression that measuring text in Java was fairly easy since nearly everything dealing with text has something that keeps tracks of its length

knowing the length of the string isn't so great when you're not using monospace fonts... You're right that it could just be approximated using max letter width / chat space = maxChars, but I like to use up the whole space if possible, and wanted to keep my implementation as close to what loftar had done as possible
User avatar
theTrav
 
Posts: 3464
Joined: Fri May 29, 2009 11:25 pm

Previous

Return to Bugs

Who is online

Users browsing this forum: No registered users and 11 guests