[Patch] Measuring tools
Moderator: OpenTTD Developers
[Patch] Measuring tools
Here I made a patch to measure distances, it's like a ruler.
The idea comes from "elho" who entered the chat and wanted to know the air distance of 2 stations...
The patch is complete, it has some bugs like the "height difference" not being removed when measuring a plain area and a problem of refresh of the distance when the tile is one, oh and the sprites for the button and the mouse and the drawing area which should not be highlighted, but only a stepped line or maybe just the start tile and the tile under the mouse.
Nothing that couldn't be fixed...
The distance from the edge and the height from the sea level are measured for the tile under the mouse.
The idea comes from "elho" who entered the chat and wanted to know the air distance of 2 stations...
The patch is complete, it has some bugs like the "height difference" not being removed when measuring a plain area and a problem of refresh of the distance when the tile is one, oh and the sprites for the button and the mouse and the drawing area which should not be highlighted, but only a stepped line or maybe just the start tile and the tile under the mouse.
Nothing that couldn't be fixed...
The distance from the edge and the height from the sea level are measured for the tile under the mouse.
- Attachments
-
- measurement_r20106.diff
- (6.52 KiB) Downloaded 544 times
-
- measuring_tools.png (25.58 KiB) Viewed 17553 times
Re: [Patch] Measuring tools
The numbers shown don't seem to add up properly...
how are they calculated?
how are they calculated?
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] Measuring tools
Use the source, lord!Lord Aro wrote:how are they calculated?
Re: [Patch] Measuring tools
aahh, but...
it's in linux-line-ending-enter-thingys and i can't be bothered to decipher it...
it's in linux-line-ending-enter-thingys and i can't be bothered to decipher it...
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] Measuring tools
Get a real text editor instead of notepad. Even Wordpad that is shipped with Windows can read and understand unix line endings.
Do not tell us that you edit NoAI .nut files with Notepad.... If that is the case, I recommend you look for something better. Even Notepad++ should give you some pretty advanced features compared to MS Notepad.
Do not tell us that you edit NoAI .nut files with Notepad.... If that is the case, I recommend you look for something better. Even Notepad++ should give you some pretty advanced features compared to MS Notepad.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [Patch] Measuring tools
I'm sorry but I wasn't of the right mood to use Notepad++ and make, so I used VS2005 to do it...Zuu wrote:Get a real text editor instead of notepad. Even Wordpad that is shipped with Windows can read and understand unix line endings.
The manhattan distance is the sum of height and width of the rectangle excluded the start tile, the bird fly distance is something of magic, but it should be the euclidean distance (the rectangle diagonal)Lord Aro wrote:The numbers shown don't seem to add up properly...
how are they calculated?
The height difference is the same of the other tools, and is the difference from the start tile height and the end tile height.
The height from sea level is the height from the sea level of the tile under your mouse.
If you add up the number correctly, you will get that the start tile has an height of 450m = 400-(-50) <- the start tile is above the end tile so you need to subtract the negative value, and "- * - = +"
Re: [Patch] Measuring tools
No no no no no...Zuu wrote: Do not tell us that you edit NoAI .nut files with Notepad.... If that is the case, I recommend you look for something better. Even Notepad++ should give you some pretty advanced features compared to MS Notepad.
i only use notepad when using windows, as i regularly can't use anything else (school + no admin rights)
i generally don't like the look of wordpad so i don't use it. i might now.
i didn't know that notepad was the only program that couldn't read unix line-endings
oh well
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] Measuring tools
Notepad++ is also available in portable edition, so you can bring that to places where you can't install anything: http://portableapps.com/apps/developmen ... p_portable
And compared to any other text editor, Windows Notepad indeed is a piece of crap.
And compared to any other text editor, Windows Notepad indeed is a piece of crap.
Re: [Patch] Measuring tools
ok, ok, i was wrong to use windows notepad
enough off-topic, talk about the patch
(@FooBar - at school i can only run approved programs, i.e. programs they themselves have installed, so it wouldn't work there anyway)
enough off-topic, talk about the patch
(@FooBar - at school i can only run approved programs, i.e. programs they themselves have installed, so it wouldn't work there anyway)
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] Measuring tools
Hello Wolf01,
Here are a few bugs that were spotted when playing with my patchpack by Moriarty, I have checked with your clean patch bumped to trunk and can confirm them.
While bumping I had to only remove the "true" from the one conflicting line to keep your patch going. (r20240 at time of writing.)
Some of these bugs might probably already be known by you judging by the first post, anyway here they are.
- If you have just generated a map and you use the measurement tool on one tile the height from sea sometimes give some weird results. eg. height = 32 meters while the height difference per tile is 50 meters ... very strange.
- Also when measuring on a flat piece of land the height difference is always reported as "50 meters" or "-50 meters" but never 0, except if you have just started the game then it reports 0 meters as it should.
Also attached a screenshot that displays the weird behaviour mentioned above, it is taken while selecting 1 tile and holding it there.
Regards,
ChillCore.
Edit:
Another little bug reported by thetzar.
The "R" shortcut is already used for the removal tool and will prevent the removal tool to be selected by means of the shortcut.
Please ignore, if this is not the case in your clean patch as I have not yet tested this ...
Here are a few bugs that were spotted when playing with my patchpack by Moriarty, I have checked with your clean patch bumped to trunk and can confirm them.
While bumping I had to only remove the "true" from the one conflicting line to keep your patch going. (r20240 at time of writing.)
Some of these bugs might probably already be known by you judging by the first post, anyway here they are.
Also I noticed a few other things when testing.Moriarty wrote: a) The "- Measurement tool" has issues. If you click and do NOT drag but just hold the mouse in place, it starts randomly flickering through numbers for manhatten distances and "bird fly distance".
b) The measurement tool also shows the results of the last measurement if you click but don't drag. Surely it should start with NO results.
- If you have just generated a map and you use the measurement tool on one tile the height from sea sometimes give some weird results. eg. height = 32 meters while the height difference per tile is 50 meters ... very strange.
- Also when measuring on a flat piece of land the height difference is always reported as "50 meters" or "-50 meters" but never 0, except if you have just started the game then it reports 0 meters as it should.
Also attached a screenshot that displays the weird behaviour mentioned above, it is taken while selecting 1 tile and holding it there.
Regards,
ChillCore.
Edit:
Another little bug reported by thetzar.
The "R" shortcut is already used for the removal tool and will prevent the removal tool to be selected by means of the shortcut.
Please ignore, if this is not the case in your clean patch as I have not yet tested this ...
- Attachments
-
- After having generated the second game.png (20.1 KiB) Viewed 17230 times
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: [Patch] Measuring tools
Yes I was aware of those bugs, but consider that this was only a "draft" patch to catch the attention of some other volunteer to bring it on and improve it
I only put the idea and some code to share my needs with others, if somebody wants it, it's here and it's GPL
I only put the idea and some code to share my needs with others, if somebody wants it, it's here and it's GPL
- Vaulter
- Traffic Manager
- Posts: 185
- Joined: 21 Dec 2004 05:35
- Skype: andrey-zaharov
- Location: St. Petersburg, Russia
- Contact:
Re: [Patch] Measuring tools
here is fixed patch with proper initializing to catch those bugsWolf01 wrote:Yes I was aware of those bugs, but consider that this was only a "draft" patch to catch the attention of some other volunteer to bring it on and improve it
I only put the idea and some code to share my needs with others, if somebody wants it, it's here and it's GPL
- Attachments
-
- measurement.r22604M.patch
- (9.53 KiB) Downloaded 294 times
Re: [Patch] Measuring tools
Hey all,
I updated the patch to r23948, and fixed the bugs (unrelated to Vaulter's patch above, didn't see it
I updated the patch to r23948, and fixed the bugs (unrelated to Vaulter's patch above, didn't see it
- Attachments
-
- measurement_tool.diff
- (6.64 KiB) Downloaded 438 times
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] Measuring tools
Updated patch to r25578. Based on vaulters measurement.r22604M.patch.
- Attachments
-
- measurement-tool.r25578.patch
- (10.05 KiB) Downloaded 420 times
Who is online
Users browsing this forum: No registered users and 15 guests