Patch: Counting died passengers
Moderator: OpenTTD Developers
Patch: Counting died passengers
I'm playing OpenTTD for many years, and want to add some improvements to the game.
My first one is a very small one to understand how the game works and try to apply the coding syntax correctly.
Is this a good start?
And what to do next?
My first one is a very small one to understand how the game works and try to apply the coding syntax correctly.
Is this a good start?
And what to do next?
Re: Patch: Counting died passengers
Sadly I lack any skill to apply a patch but the subject you choose is actually a nice one: the death toll could affect company rating.
Messages
I made another small patch which makes to changes for displaying messages.
1.
When you click at a summary message, the full message appears. After closing this message, the message is still visible in the status bar. Sometimes it cost a lot of seconds before the next message is vissible.
After applying this patch, the message will be removed from the status bar and the next message will be visible directly.
2.
When a lot of messages are in the que to display, the latest messages aren't showed anymore because they are very old. (for example: When removing a road piece, a lot of vehicle lost messages will come up.)
After applying this patch, a third menu option is available in the News menu to skip all pending messages.
In the file strings.h the line static const StringID STR_NEWS_MENU_MESSAGE_SKIP_NEXT_MESSAGES = 0x15C; should be added, but I couln't make a patch for this file.
And apply both patch files:
1.
When you click at a summary message, the full message appears. After closing this message, the message is still visible in the status bar. Sometimes it cost a lot of seconds before the next message is vissible.
After applying this patch, the message will be removed from the status bar and the next message will be visible directly.
2.
When a lot of messages are in the que to display, the latest messages aren't showed anymore because they are very old. (for example: When removing a road piece, a lot of vehicle lost messages will come up.)
After applying this patch, a third menu option is available in the News menu to skip all pending messages.
In the file strings.h the line static const StringID STR_NEWS_MENU_MESSAGE_SKIP_NEXT_MESSAGES = 0x15C; should be added, but I couln't make a patch for this file.
And apply both patch files:
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Messages
strings.h is not edited manually. Just add your string to src/lang/english.txt and use it. strgen will take care of strings.h upon compilation.Mister_X wrote:I made another small patch which makes to changes for displaying messages.
1.
When you click at a summary message, the full message appears. After closing this message, the message is still visible in the status bar. Sometimes it cost a lot of seconds before the next message is vissible.
After applying this patch, the message will be removed from the status bar and the next message will be visible directly.
2.
When a lot of messages are in the que to display, the latest messages aren't showed anymore because they are very old. (for example: When removing a road piece, a lot of vehicle lost messages will come up.)
After applying this patch, a third menu option is available in the News menu to skip all pending messages.
In the file strings.h the line static const StringID STR_NEWS_MENU_MESSAGE_SKIP_NEXT_MESSAGES = 0x15C; should be added, but I couln't make a patch for this file.
And apply both patch files:
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Patch: Counting died passengers
Ah, I understand. Now It's clear why this file wasn't synchronized with SVN. 

Show area
I've a new patch. 
The button "Area" is added onto the town window. This will show all tiles where the town is the local authority from.
The button "Area" is added onto the station window also. This will show the catchment area for acceptance for goods and passengers.
If you have some suggestions, please let me know.

The button "Area" is added onto the town window. This will show all tiles where the town is the local authority from.
The button "Area" is added onto the station window also. This will show the catchment area for acceptance for goods and passengers.
If you have some suggestions, please let me know.

Re: Patch: Counting died passengers
Adding a new byte into the map array to do this seems...wrong. very wrong.
Also, can you make your patches without spaces in the filenames? Makes it a bit easier for us unix types to apply
Also, can you make your patches without spaces in the filenames? Makes it a bit easier for us unix types to apply

AroAI - A really feeble attempt at an AI
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Re: Patch: Counting died passengers
I didn't like to add an extra variable there, but I read the file landscape_grid.html, and no bit was left which wasn't used by any tile type.Lord Aro wrote:Adding a new byte into the map array to do this seems...wrong. very wrong.
To not slow down the current game speed a search loop isn't a good idea, I think. So I need a global variable which is accessible when drawing the sprite.
Do you have a better idea to solve this issue?
OK, next time I don't use spaces in the file names.

Edit:
In landscape_grid.html I see that for each tile type at least one bit is available.
It is desirable to place this bit dependent on the tile type at different locations in the map?
Re: Patch: Counting died passengers
You have a set of rectangles and circles. Tiles are inside or outside them - perform this hit test on-demend, don't pre-calculate values for all tiles. When you have to decide whether to draw a tile highlight or not, then just check whether the tile is contained by any of rectangles/circles, something like this:Mister_X wrote:Do you have a better idea to solve this issue?
Code: Select all
for (uint i = 0; i < areas_to_highlight.Length(); i++) {
if (areas_to_highlight[i].Contains(tile)) {
DrawTileCoverage(i, tile);
break;
}
}
Last edited by planetmaker on 05 Nov 2013 21:33, edited 1 time in total.
Reason: PHP style means dark blue on black - hardly readable, thus removed
Reason: PHP style means dark blue on black - hardly readable, thus removed
![Pleased :]](./images/smilies/pleased.gif)
Re: Patch: Counting died passengers
You are right. I tought that the process to draw the tiles was very slow, so I wouldn't make the draw process more slower than needed. Now I see that this process is fast enough to do an extra loop.
Your suggestion to do a raw rectangle check first is a good point. I added this into the patch and removed the extra byte in the map array.
Your suggestion to do a raw rectangle check first is a good point. I added this into the patch and removed the extra byte in the map array.

Who is online
Users browsing this forum: Ahrefs [Bot] and 6 guests