Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Tue Sep 26, 2017 4:32 pm

All times are UTC




Post new topic  Reply to topic  [ 14 posts ] 
Author Message
 Post subject: [Patch] Measuring tools
PostPosted: Sat Jul 10, 2010 6:14 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Apr 24, 2004 10:43 am
Posts: 1965
Location: Venezia - Italia
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.


Attachments:
measurement_r20106.diff [6.52 KiB]
Downloaded 195 times
measuring_tools.png
measuring_tools.png [ 25.58 KiB | Viewed 7745 times ]

_________________
ImageImage
ImageImage
ImageImage
newgrf tests, see: newgrf test topic, my patches: Wolf01's Hire Point
Italian TTD Forum
Wiki Page
Top
   
PostPosted: Sat Jul 10, 2010 6:38 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Jun 25, 2009 4:42 pm
Posts: 2364
Location: Location, Location
The numbers shown don't seem to add up properly...
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


Top
   
PostPosted: Sat Jul 10, 2010 7:14 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Sun Sep 09, 2007 5:03 am
Posts: 4470
Location: home
Lord Aro wrote:
how are they calculated?
Use the source, lord!


Top
   
PostPosted: Sat Jul 10, 2010 7:22 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Jun 25, 2009 4:42 pm
Posts: 2364
Location: Location, Location
aahh, but...
it's in linux-line-ending-enter-thingys and i can't be bothered to decipher it... :P

_________________
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


Top
   
PostPosted: Sat Jul 10, 2010 9:13 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4532
Location: /home/sweden
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.... :roll: 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)


Top
   
PostPosted: Sat Jul 10, 2010 10:35 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Apr 24, 2004 10:43 am
Posts: 1965
Location: Venezia - Italia
Zuu wrote:
Get a real text editor instead of notepad. Even Wordpad that is shipped with Windows can read and understand unix line endings.

I'm sorry but I wasn't of the right mood to use Notepad++ and make, so I used VS2005 to do it...

Lord Aro wrote:
The numbers shown don't seem to add up properly...
how are they calculated?


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)
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 "- * - = +"

_________________
ImageImage
ImageImage
ImageImage
newgrf tests, see: newgrf test topic, my patches: Wolf01's Hire Point
Italian TTD Forum
Wiki Page


Top
   
PostPosted: Sun Jul 11, 2010 4:27 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Jun 25, 2009 4:42 pm
Posts: 2364
Location: Location, Location
Zuu wrote:
Do not tell us that you edit NoAI .nut files with Notepad.... :roll: 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.

No no no no no...
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. :lol:
i didn't know that notepad was the only program that couldn't read unix line-endings
oh well :roll:

_________________
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


Top
   
PostPosted: Sun Jul 11, 2010 9:56 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 21, 2007 11:47 am
Posts: 6559
Location: The Netherlands
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.

_________________
FooBar's Tram Tracks | TransRapid Track Set | Metro Track Set | OpenGFX base graphics set | FIRS Industry Replacement Set
Dutch Tram Set | Dutch Trainset 2 | Dutch Road Furniture


Top
   
PostPosted: Sun Jul 11, 2010 10:10 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Jun 25, 2009 4:42 pm
Posts: 2364
Location: Location, Location
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)

_________________
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


Top
   
PostPosted: Thu Jul 29, 2010 10:40 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Oct 04, 2008 11:05 pm
Posts: 2622
Location: Lost in spaces
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.

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.


Also I noticed a few other things when testing.

- 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
After having generated the second game.png [ 20.1 KiB | Viewed 7422 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.
Top
   
PostPosted: Wed Aug 04, 2010 1:46 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Apr 24, 2004 10:43 am
Posts: 1965
Location: Venezia - Italia
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 :P

_________________
ImageImage
ImageImage
ImageImage
newgrf tests, see: newgrf test topic, my patches: Wolf01's Hire Point
Italian TTD Forum
Wiki Page


Top
   
PostPosted: Sun Jul 31, 2011 10:23 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Dec 21, 2004 5:35 am
Posts: 185
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Wolf01 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 :P

here is fixed patch with proper initializing to catch those bugs


Attachments:
measurement.r22604M.patch [9.53 KiB]
Downloaded 85 times

_________________
OpenTTD Hard Game Pack
Top
   
PostPosted: Wed Feb 15, 2012 6:12 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Jun 25, 2009 4:42 pm
Posts: 2364
Location: Location, Location
Hey all,

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 84 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
Top
   
PostPosted: Wed Jul 10, 2013 11:25 pm 
Offline
Engineer
Engineer

Joined: Tue Nov 18, 2008 12:10 am
Posts: 19
Updated patch to r25578. Based on vaulters measurement.r22604M.patch.


Attachments:
measurement-tool.r25578.patch [10.05 KiB]
Downloaded 99 times

_________________
https://github.com/bcmpinc/openttd
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.