Patch : Show station coverage areas [v1 r17250]

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

gehene
Engineer
Engineer
Posts: 4
Joined: 10 Aug 2009 23:24

Patch : Show station coverage areas [v1 r17250]

Post by gehene »

This patch allows to show the acceptance and catchment area of a station. It is just a first version to get feedback (and see if people like/want it).

Features :
- add a button in the station gui (another train square icon between Location and Ratings button)
- display acceptance and catchment areas in, respectively, blue and red "selection" squares (temporary sprites)

Known Bugs :
- if using "more realistic catchment size" for station, adding or removing tiles to a station with different catchment size can crash the game (on remove). Will be fixed in v2

Next :
- fix bug 1 (more an unfinished feature)
- add specific sprites : toggle button + acceptance / catchment tiles.
- differentiate between companies with colors / patterns / ... (how to do when station areas overlap ?)
- toogle catchment in stations from town ?
- optimize / change way to get catchment area
- ...

Infos on how works acceptance and catchment areas : http://www.tt-forums.net/viewtopic.php? ... 94&start=0

Feel free to comment ...
(don't mind the code yet, also i will comment it and check code style for next version)
Attachments
coverage_v1.PNG
coverage_v1.PNG (185.38 KiB) Viewed 2481 times
show_station_coverage_v1_17250.diff
(35.74 KiB) Downloaded 827 times
User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Patch : Show station coverage areas [v1 r17250]

Post by pavel1269 »

At first, i dont like the small tag for turning on/off. Also the Red highlight is not very nice, use the standart ( gray - blue, when building station ... ) one? But nice patch for concept ;-)
User avatar
1009
Engineer
Engineer
Posts: 81
Joined: 22 Mar 2009 07:24
Location: Haarlem, The Netherlands
Contact:

Re: Patch : Show station coverage areas [v1 r17250]

Post by 1009 »

I think that's a cool patch. I also agree that the red is a little too much, I'd like white better.
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: Patch : Show station coverage areas [v1 r17250]

Post by Ammler »

Very nice patch, something similar was already around some time ago. I would like a "global" switch, where the catchment view is enabled for all stations. What is the difference between your red and blue tiles, or rather what's the difference between blue and unmarked tiles?

Greets
Ammler
User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Patch : Show station coverage areas [v1 r17250]

Post by pavel1269 »

Ammler, blue tiles are also covered in acceptance area. His patch show the direct ones (red tiles) and also the one described in other topic (link at forst post)(blue ones).
Swansea Stu
Engineer
Engineer
Posts: 72
Joined: 21 Jan 2009 12:24

Re: Patch : Show station coverage areas [v1 r17250]

Post by Swansea Stu »

I like the look of this, it reminds me of the areas you can set workers to in RCT. (Maybe you could use the same colour blue as a homage ;))

I think it'd be very handy for bus routes. Maybe if you are running a feeder service to a train station or airport to make sure you get 100% coverage in cities.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch : Show station coverage areas [v1 r17250]

Post by 2007Alain2007 »

update to R17532

removed becuse of bug and updated below

Also a great patch cant wait for V2
Last edited by 2007Alain2007 on 20 Sep 2009 22:52, edited 1 time in total.
For Community Integrated Version http://code.google.com/p/civopenttd/
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch : Show station coverage areas [v1 r17250]

Post by 2007Alain2007 »

There is a small bug the coverage is not updated if you remove part of a station.

All so if you end a game with it showing it will also show on the main screen on the background game
For Community Integrated Version http://code.google.com/p/civopenttd/
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch : Show station coverage areas [v1 r17250]

Post by 2007Alain2007 »

bug fixed with romoveing lorry stops becuse of my bad update heres a working one

code should never been changed

Code: Select all

-		InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
+		SetWindowWidgetDirty(WC_STATION_LIST, st->owner, 0);
show_station_coverage_v1_17250(AT17595).diff
We all hope gehene will get back to this patch
For Community Integrated Version http://code.google.com/p/civopenttd/
PapaPingouin
Engineer
Engineer
Posts: 1
Joined: 14 Jan 2011 17:13

Re: Patch : Show station coverage areas [v1 r17250]

Post by PapaPingouin »

Is this patch always in production ?

I think this is an important function to see stations coverage.

If needed, I can help to develop this, but I'm not very familiar with openttd code (and I'm French :roll: )
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: Patch : Show station coverage areas [v1 r17250]

Post by Eddi »

maybe this patch is more developed: http://www.tt-forums.net/viewtopic.php?f=33&t=33701
User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Patch : Show station coverage areas [v1 r17250]

Post by Vaulter »

Eddi wrote:maybe this patch is more developed: http://www.tt-forums.net/viewtopic.php?f=33&t=33701
This patch works with other NewGRFs, and more robust against performance
User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Patch : Show station coverage areas [v1 r17250]

Post by Vaulter »

Fixed & updated
Attachments
station-cover.r22604M.patch
(33.41 KiB) Downloaded 460 times
ST2
Engineer
Engineer
Posts: 63
Joined: 07 Apr 2011 14:17

Re: Patch : Show station coverage areas [v1 r17250]

Post by ST2 »

i made this simple modification in "rail_cmd.cpp" file and get a correct draw of coverage over rails (was not happening before).
"//DrawOverlay(ti, MP_RAILWAY);" is on the original place.

Code: Select all

===================================================================
--- src/rail_cmd.cpp	(revision 22660)
+++ src/rail_cmd.cpp	(working copy)
@@ -2218,11 +2218,15 @@
 	_drawtile_track_palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile));
 
 	if (IsPlainRail(ti->tile)) {
+    //DrawOverlay(ti, MP_RAILWAY);
+	
 		TrackBits rails = GetTrackBits(ti->tile);
 
 		DrawTrackBits(ti, rails);
 
 		if (HasBit(_display_opt, DO_FULL_DETAIL)) DrawTrackDetails(ti, rti);
+		
+		DrawOverlay(ti, MP_RAILWAY);
 
 		if (HasCatenaryDrawn(GetRailType(ti->tile))) DrawCatenary(ti);

Thank you for the update & fix :)
ST2
Engineer
Engineer
Posts: 63
Joined: 07 Apr 2011 14:17

Re: Patch : Show station coverage areas [v1 r17250]

Post by ST2 »

I love this patch therefore dedicated some time looking it.
probably big changes are beyond my knowledge :)
but somehow this one is working in the beta4 and without crashes, so i'll ask to someone test it too (more then I :P)

thx again :bow:

Edit: added diff file against trunk
Attachments
Station_Coverage_1.2.0-beta4M.diff
(29.5 KiB) Downloaded 400 times
Station_Coverage_r23919M.diff
(29.5 KiB) Downloaded 408 times
Last edited by ST2 on 09 Feb 2012 21:11, edited 1 time in total.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Patch : Show station coverage areas [v1 r17250]

Post by Alberth »

Patching against a release is not very useful.

After patching a release the program is not the same as the release itself (so use as a drop-in version of that release does not work), and in general the patch will fail in trunk due to changes between the release and trunk (making it impossible to merge it into trunk).
(Although, since beta4 is relatively young, the latter may still work in this particular case.)
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Patch : Show station coverage areas [v1 r17250]

Post by Bilbo »

Alberth wrote:Patching against a release is not very useful.
IF (and only if) the patch maintains network compatibility - i.e. most (though not all) GUI improvements would fall in this category - then it is useful to create patch against the release. Then you can use such modified release to connect to unmodified servers too (you just have to override the build to not add "M" to the end of the version)
Alberth wrote:... in general the patch will fail in trunk due to changes between the release and trunk (making it impossible to merge it into trunk).
Yes, but sometimes patch from release may work within some range of revisions and with reasonably small modification within quite large range of revisions. Creating patch for trunk from patch for reasonably new release is usually not very hard - though there are exceptions ... .
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Patch : Show station coverage areas [v1 r17250]

Post by Alberth »

Bilbo wrote:
Alberth wrote:Patching against a release is not very useful.
IF (and only if) the patch maintains network compatibility - i.e. most (though not all) GUI improvements would fall in this category - then it is useful to create patch against the release. Then you can use such modified release to connect to unmodified servers too (you just have to override the build to not add "M" to the end of the version)
I am aware of that, but for many patch creators/updaters the notion of "network compability" is too complicated to understand. As a result, I simplified the rules to just exclude releases entirely. It makes sense as in leveling the playing field. Also, the number of patches that are adversely affected is very small, and people understanding the deeper issues will understand why I say it, and also know when it does or does not hold.

Even then, from a development point of view, making a patch against a release is not helping in getting it in trunk.
Bilbo wrote:
Alberth wrote:... in general the patch will fail in trunk due to changes between the release and trunk (making it impossible to merge it into trunk).
Yes, but sometimes patch from release may work within some range of revisions and with reasonably small modification within quite large range of revisions. Creating patch for trunk from patch for reasonably new release is usually not very hard - though there are exceptions ... .
I thought I covered that in "in general ..." already.

I think getting the general idea across that patches and releases should not be combined is more useful.

People without good understanding cannot do anything with "sometimes" and "there are exceptions".
Like above, people that understand working with patches also know that the limits are less hard than I state them.
ST2
Engineer
Engineer
Posts: 63
Joined: 07 Apr 2011 14:17

Re: Patch : Show station coverage areas [v1 r17250]

Post by ST2 »

ok, lets make it in simple words...
1 - i'm not a pro in coding knowledge. Fact!
2 - not even average level!
2 - i've pick this patch and made couple changes (few)...
3 - starts working stable (no crashes) in SP and MP (yes, overriding !!VERSION!! and !!REVISION!! when needed to test in MP)
4 - after many many tests, no crashes, i shared the code that i got, here! (yes, was beta4 at the time - but good in RC1 and in r24000)

now, the 5th point can be:
a) i keep the code to myself as a "precisous opensource" code secret?
b) or i share it to community, that previously shared it to me? (imo, the way to get improved)

probably not a big improvement/changes i made... but i shared it!!! (this line will hit someone)
I didn't wanted that version to trunk/stable... i've only shared some code i think i got stable (PS: "i think" is important), and that i found somewhere in "OpenTTD Development" forums
i use it, even in release versions! So what!!

finally, questions to Alberth:
- have you tested it? (before you post a answer)
- if not, can you explain me better your fundaments? (patch i have changed VERSION and REVISION, patch i shared doesn't)
- better, can you explain any answer without testing it?
- if you're so worried with patched versions (network compatibilities), why those still appears in MP list?
- and the last question, any bug found, can you post it at this thread, right?!

PS: Alberth got my respect because gave huge help to solved some problems when i was compiling using MSYS earlier times.
PS2: When i make questions is because i'm prepared for all possible answers (side effects of working in a newspapper)
PS3: "I'm not big enough to start a war but powerfull enough to fight on it" <<-- quote

JRC/ST2

Edit: typo
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Patch : Show station coverage areas [v1 r17250]

Post by Alberth »

ST2 wrote:- have you tested it? (before you post a answer)
What can I find out by testing?
Does it patch cleanly against beta4? I believe you without trying it.
Does it work? You say it does, I did not try it, so I believe you.

So, you have a good working patch against 1.2 beta 4.
And now?
ST2 wrote:- if not, can you explain me better your fundaments? (patch i have changed VERSION and REVISION, patch i shared doesn't)
So you have a modified beta4, and hacked the protection mechanisms to fake it as beta4. Ok.
In a MP game, you now get two things:
- You get an unfair advantage compared to others.
- If you hit a desync, we are the people that get the report at our doorstep, and have to look for days only to come up with nothing, because you are using other software than we think.

The other thing you may want with a patch is inclusion in the OpenTTD program.
However trunk is not the same as beta4, so it cannot be applied.
(Yes I am aware that there is a non-zero chance that it works, but you're talking 1 in 1000 or so, and I am not prepared to download a patch, create a copy of the repository, apply the patch, try to compile, and mess around with improvements with about 0.1% chance of succes. I have better things to do with those hours.)
ST2 wrote:- better, can you explain any answer without testing it?
I just did, didn't I?
In fact, I don't even have source code of any released version at my machine in a state where I can work in it. I only use trunk. There are two simple reasons for it. One is that we make many many releases, so I'd have to keep lots and lots of source code around just in case. Second, if I'd download the sources, setup a working environment around it, apply your patch, compile, try it, it works. Then what?
The only thing I can do then is report "it works". Well, you did that already.
Moving it into trunk does not work in general (see above). My conclusion is therefore it is a futile exercise in the first place.
ST2 wrote:- if you're so worried with patched versions (network compatibilities), why those still appears in MP list?
Because 'network compability' is not something you can detect without actual playing, and getting a desync. If you get one, you know it is not compatible. If you don't get one, either you are compatible, or you did not test good enough. There is no way of being sure the software is fully network compatible at all times. Heck, we had desyncs between servers and clients where all programs were known to be an official version. These bugs can linger for several years before being triggered, just because the specific condition is so rare, it almost never happens. In other words, "I tested and it worked" is just reducing the chance, not eliminating existence.
(And thank you for proving my point about network compability being too complicated to understand for many people.)
ST2 wrote:- and the last question, any bug found, can you post it at this thread, right?!
How does a player or do we know the bug was due to your software changes?
If you fake to be an official version, there is no way to decide the software was actual a different version.
Such bugs just get filed un 'beta4', and we waste hours finding out how the problem may have happened in the official version. If we are very lucky, the crash log gives weird line numbers, and we can see it was actually a faked version, but which patch was added then? It could be any of the patches floating around, including non-published ones.
ST2 wrote:PS3: "I'm not big enough to start a war but powerfull enough to fight on it" <<-- quote
I don't fight wars, it's just a waste of energy and time. Writing this post cost me one hour, time I could have spend more usefully.
I am however willing to explain why I think like I do, and am willing to accept good arguments against it.

Albert
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 1 guest