How many tiles does this need?

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Shooshpanchick's idea worked, thank you.

Now, I'm very confused with String_IDs.

I'd like to use string but seems String_ID is required to draw a tooltip.
Take a look at this line:

Code: Select all

WP(w,tooltips_d).string_id = string_id;
It draws a tooltip with set string_id which is processed against language test, resulting different hints in different languages.

Is there other WP(w,tooltips_d)'s property than string_id?
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Good news: I'm making good progress :) Image and diff really soon.


Now, absolute[0] x and y are displayed instead of relative[1] TileX and TileY[2].

[0] - Count from tile(0,0)
[1] - Count from selection start
[2] - TILE_SIZE=16; TileX = x/TILE_SIZE
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Features: Relative values work, result is tile difference +1

Need to be fixed: Showing length (only x or only y) doesn't work

Future: Showing maximum height difference in the selected area (Bjarni)
Attachments
tooltip_r3165.patch
Difference file
(2.71 KiB) Downloaded 106 times
Sample image
Sample image
measure_test_1.png (28.21 KiB) Viewed 2281 times
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Very good job you've done there, MeusH!
I just can't wait to get home and try this :D
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

webfreakz.nl wrote: <?
$str = 'Text' .$int. 'Other text' .$int2;
?>
[/code]
(Yes i do how to program in PHP rather than in C !!)
I'd say you guys can't program PHP. It is actually:

Code: Select all

<? $str = "Text $int Other text $int2"; ?>
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Darkvater wrote:I'd say you guys can't program PHP. It is actually:

Code: Select all

<? $str = "Text $int Other text $int2"; ?>
On the other hand, sometimes your method won't work.

Code: Select all

<? $file = $_GET['number'] . '.txt'; ?>
^ adding strings

Here you have some more pics
Attachments
measure_test_3.png
measure_test_3.png (51.53 KiB) Viewed 2227 times
measure_test_2.png
measure_test_2.png (17.79 KiB) Viewed 2227 times
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Post by Wolf01 »

you may also show the cost, so you haven't to use the shift to know how you spend
Shooshpanchick
Engineer
Engineer
Posts: 8
Joined: 15 Nov 2004 22:58
Contact:

Post by Shooshpanchick »

MeusH wrote:other hand, sometimes your method won't work.

Code: Select all

<? $file = $_GET['number'] . '.txt'; ?>
^ adding strings

Code: Select all

<? $file = "{$_GET['number']}.txt"; ?>
Your patch should definitely be in next integrated nightly :)
User avatar
nicfer
Director
Director
Posts: 529
Joined: 03 May 2005 20:50
Location: Somewhere in a country called Argentina

Post by nicfer »

Wolf01 wrote:you may also show the cost, so you haven't to use the shift to know how you spend
Today I have the same idea :lol:
Sorry for my english I am argentinian
TTO don't crashes in Windows XP; XP crashes TTO

Formerly known as UnderBuilder.

MyMiniCity
User avatar
webfreakz.nl
Director
Director
Posts: 627
Joined: 11 Aug 2005 08:22
Location: Localhost, 127.0.0.1, [The Netherlands: South Holland-> Westland]
Contact:

Post by webfreakz.nl »

MeusH wrote:Here you have some more pics
That's great!

How far is the patch coming? :)
# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

webfreakz.nl wrote:How far is the patch coming? :)
I'm experiencing big problems with measuring height difference :(
Why

Code: Select all

int heightdiff;
heightdiff = TileHeight(TileVirtXY(10, 10)) - TileHeight(TileVirtXY(5,5));
is heightdiff always 0, even if there are different heights on tile 5,5 and 10,10?
Image
User avatar
webfreakz.nl
Director
Director
Posts: 627
Joined: 11 Aug 2005 08:22
Location: Localhost, 127.0.0.1, [The Netherlands: South Holland-> Westland]
Contact:

Post by webfreakz.nl »

MeusH wrote:
webfreakz.nl wrote:How far is the patch coming? :)
I'm experiencing big problems with measuring height difference :(
Why

Code: Select all

int heightdiff;
heightdiff = TileHeight(TileVirtXY(10, 10)) - TileHeight(TileVirtXY(5,5));
is heightdiff always 0, even if there are different heights on tile 5,5 and 10,10?
Uhm, I was thinking of using the function 'drag&drop' which is used when you place a station or something like that? That function also has to count how many tiles it needs or else your station is bigger than you want it to! So with this, you can easily make the image ( or yours ) in the starting-post :)

I could also be very wrong in using this function, just let me know ;)
# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

webfreakz.nl wrote:
MeusH wrote:
webfreakz.nl wrote:How far is the patch coming? :)
I'm experiencing big problems with measuring height difference :(
Why

Code: Select all

int heightdiff;
heightdiff = TileHeight(TileVirtXY(10, 10)) - TileHeight(TileVirtXY(5,5));
is heightdiff always 0, even if there are different heights on tile 5,5 and 10,10?
Uhm, I was thinking of using the function 'drag&drop' which is used when you place a station or something like that?
I'm using more global function, which is being called by all dragging buttons
webfreakz.nl wrote:So with this, you can easily make the image ( or yours ) in the starting-post :)
What? (or mine)?
User avatar
webfreakz.nl
Director
Director
Posts: 627
Joined: 11 Aug 2005 08:22
Location: Localhost, 127.0.0.1, [The Netherlands: South Holland-> Westland]
Contact:

Post by webfreakz.nl »

MeusH wrote:
webfreakz.nl wrote:So with this, you can easily make the image ( or yours ) in the starting-post :)
What? (or mine)?
This one:

http://www.tt-forums.net/viewtopic.php?p=372933#372933

:)
# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Hehe, anyway, I've made a good progress:

Code: Select all

FindLandscapeHeight(&start_ti, sx, sy);
FindLandscapeHeight(&end_ti, x, y);

heightdiff = (end_ti.z * 50 / 8) - (start_ti.z * 50 / 8);
TileIndex.z was a proper tile height. Take a look at the attached screenies
Attachments
measure_test_5.png
measure_test_5.png (80.51 KiB) Viewed 2130 times
measure_test_4.png
measure_test_4.png (33.18 KiB) Viewed 2130 times
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Here is the diff :P
It is still against r3163 because there are some linking problems due to newstation support and new files to the trunk 8)
Attachments
tooltip3_r3165.patch
(5.13 KiB) Downloaded 98 times
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

MeusH wrote:Here is the diff :P
It is still against r3163 because there are some linking problems due to newstation support and new files to the trunk 8)
Add station_newgrf.h and station_newgrf.c in your project.
I'm using MSV6, and it compiled without problems
Attachments
ToolTipFrench.patch
And why not already a french translation...
(909 Bytes) Downloaded 100 times
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

I've downloaded .dsw and .dsp from the trunk but seems something doesn't work.

Anyway, there are some things to do:
* must
+ nice to have to


* Show the tooltip after pressing some key. It can't be ctrl, because diagonal selection uses it. It may be alt or shift

* Make it work with tunnels

* Show height difference for bridges, too

+ Show query cost

+ Move the tooltip so it won't be behind huge cursor (like rail cursor)

+ {} (new line sign) working in tooltip
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

You can try this diff. It is from the project I have updated.
There are some stuff I don't know where the do come from, but I can compile with it, no prob...
Attachments
OpenTTD_DSP.patch
(3.68 KiB) Downloaded 101 times
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

I've managed to make it working with tunnels. However, it shows length of docks (2), too.

I'll duplicate the toolkit showing function so I can move my toolkit away from the mouse cursor, then go to rail (tracks+signals) and hotkey check.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: YaCy [Bot] and 15 guests