NewIndustries error messages

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

NewIndustries error messages

Post by Csaboka »

Hi everyone!

The attached patch implements the same functionality I've added to TTDPatch some days ago - allowing GRFs to put their own parameters into their error messages. It also has a small bugfix - OTTD displayed the "site unsuitable" message even when the GRF wanted to show a custom message instead.

The main idea is having two text reference stacks - one for normal messages (ie. when you can call DrawString right away) and one for error messages (the error window may have to redraw itself multiple times, so it needs to remember the parameters). You can switch between those two by SwitchToNormalRefStack() and SwitchToErrorRefStack(). I couldn't find a better way to do it because the stack itself is used some layers deeper than the DrawString call - making it a parameter that's passed down to callees would have broken a lot of code with no good reason. I hope this solution is acceptable.

EDIT: I've now split off the bugfix diff to the new feature diff.
Attachments
ottd-industry-error-messages.patch
Some NewIndustries error message enhancements implemented by TTDPatch
(7.54 KiB) Downloaded 78 times
ottd-industry-error-message-fix.patch
Fix for "site unsuitable" error even when the GRF wanted to show something else
(576 Bytes) Downloaded 78 times
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 22 guests