Patch: Juanjo's patches

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

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Patch: Juanjo's patches

Post by Juanjo » 06 Aug 2011 16:58

These are the patches I have written so far.

Warning: saved games using this patch won't work with any other version of OpenTTD.

GUI:
  • Setting for automatically choose size of buttons, dropdowns, fonts, etc. It is necessary to set a truetype font in the config file. (There is a set of fonts in the shared dropbox folder)
  • Window for selecting fonts and their size.
  • GUI modes for tablets.
  • Some sprites can be are rendered as a TrueType font.
Depots:
  • Two depot types: small ones (with the standard behaviour of OpenTTD depots) and big depots that can be enabled in the configuration window.
  • Big water depots will allow joining different depot parts. Ships in big depots don't disappear when entering the depot. Each part can have one ship at most.
  • Big road depots will allow joining different depot parts. Each depot tile can handle three vehicles at most. One road depot consisting of 4 tram depot tiles and 5 road depot tiles can have 4*3 trams and 5*3 road vehicles inside.
  • Big rail depots will allow joining different rail depot parts. It is allowed to join in the same depot different platforms for different rail types.
About filtering items:
  • Town directory: Added possibility to filter towns. Most important feature is list all towns the local company hasn't built a statue yet (in order to increase ratings).
  • Station directory: Added a small greyed box to show that a station has ever accepted a certain cargo. Also, a different filter has been added (find stations that have ever accepted steel,...).
  • Industry directory: Added a filter (find industries that accept/produce a certain cargo).
  • Groups/vehicles lists: filter to find some type of vehicles/groups depending on certain parameters. Mass commands for vehicles are disabled if the filter is opened (would cause desyncs if enabled).
About grouping vehicles:
  • Vehicle window: Icon to find next/previous vehicle that shares orders with current vehicle.
  • Vehicle window: Details icon + ctrl: open a window showing the group-related stuff of the vehicle.
  • Vehicle lists: Button to see groups instead of vehicles. If a station has 5 groups of 10 vehicles each, it may be useful to show only 5 items instead of 50.
  • Group window: Group names are unique by owner and vehicle type (FS#3473).
  • Group window: When clicking a vehicle on the list, highlight the group it belongs to.
  • Group window: When dragging a vehicle, do not draw a white frame. Draw a grey rectangle instead (as group list does). If CTRL pressed, vehicles with the same order list are also highlighted.
  • Group window: Sprite depending of group profit: it is calculated using the worst vehicle on the group.
  • Group window: Show profit details of a group when hovering over it.
  • Group window: Sort groups by name, number of vehicles and mean profit.
  • Group window: Direct access to all order lists and timetables of the vehicles of the group.
  • Group window: Do not drop vehicles into the ALL_GROUP (FS#5168).
  • Group window: Add shared vehicles also available for DEFAULT_GROUP.
  • Group window: Show which group is empty, or there is an auto-fill timetable in progress, etc.
  • Group window: When creating a group, new group is selected.
  • Group window: When deleting a group, nearest group is selected.
  • Group window: Automatic building of groups: Rebuild groups by order lists, visited towns, transported cargo, first engine class and first engine.
  • Group statistics window: mean profit, total cargo capacity, total cargo carried... Also, find the orderlists, timetables and vehicles involved on this group.
Catchment area:
  • Different definition of production/acceptance area around tiles is used. The coverage of each station is calculated as the union of the coverage area of each single tile of that station. This way, area of production == area of acceptance.
  • Catchment area controller: Main purpose is to see with a few clicks all the tiles a company/town/station covers. See Zoning - Local Authorities and Show station coverage areas to see the patches I based my work on.
Hide engines:
  • Each company can hide engines from their lists. On build engine/available engines/autoreplace engines windows, CTRL+click over an engine hides it. This is useful if you play with lots of engines and are not interested but in a few of them.
  • Buy rights to use engines: Experimental feature to make companies plan which transport types and engines will use through the game.
About water/ships:
  • River and canal banks and available water tracks are stored in the map array (except for rail+water tiles).
  • The flat tile of each normal two-tile dock can be crossed by ships. A Ctrl+Click on it will change which tracks can be taken on this tile. A special one-tile dock can be built on a flat tile with water.
  • Each station can have multiple docks.
  • Ships do not cross over each other. This is enabled by a setting so old savegames do not crash.
  • YAPF and NPF try to reserve a path for the ship as long as possible. This improves the performance of ship pathfinding. Paths are automatically updated if needed.
  • Locks controlled differently (being possible in the future to draw lock gates).
Other changes:
  • Ctrl+Del deletes all news windows and all pending news windows as well.
  • DeliverGoodsToIndustry: now first industry to deliver is not the closest one but the oldest by construction date.
  • OPF for ships is broken playing with these modifications.
You can get the code in GitHub: https://github.com/J0anJosep/OpenTTD/tree/JJ-last
Last edited by Juanjo on 12 Feb 2018 14:03, edited 33 times in total.

User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 675
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Patch: Group GUI

Post by JacobD88 » 06 Aug 2011 20:43

Juanjo wrote:...If CTRL is pressed when dropping, all vehicles with same shared orders are moved into the group...
This feature alone is worth the patch! Many thanks for your efforts; downloading....

Eddi
Tycoon
Tycoon
Posts: 7424
Joined: 17 Jan 2007 00:14

Re: Patch: Group GUI

Post by Eddi » 07 Aug 2011 00:30

A suggestion: keep each of these changes as separate patches, makes them easier to review and merge into trunk
You might not exactly be interested in Ferion, but if you are, have fun :)

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: Group GUI

Post by Juanjo » 07 Aug 2011 08:58

Eddi wrote:A suggestion: keep each of these changes as separate patches, makes them easier to review and merge into trunk
You are right. But it is easier and faster for me to work in several features at the same time. If somebody is interested in only one of them, I can make separate patches for those features. I'll add the CTRL+DragAndDrop and the one dealing with creating/deleting group icons. The visual changes have very close code so I don't know if it will be possible to separate them. Also, I found a little bug with returning error messages. I'll update right now.

User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9331
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: Group GUI

Post by planetmaker » 07 Aug 2011 09:24

Juanjo wrote:
Eddi wrote:A suggestion: keep each of these changes as separate patches, makes them easier to review and merge into trunk
You are right. But it is easier and faster for me to work in several features at the same time. If somebody is interested in only one of them, I can make separate patches for those features. I'll add the CTRL+DragAndDrop and the one dealing with creating/deleting group icons. The visual changes have very close code so I don't know if it will be possible to separate them. Also, I found a little bug with returning error messages. I'll update right now.
It's not about "somebody interested in them". It's about actually being able to sensibly deal with it; thus if you're really interested in making a contribution which should (somewhen) hit the main development branch, Eddi's suggestion to split it up into its single constituents is essential. Doing it from the start keeps it simple as well. As a monolithic patch... it's unlikely that one even can bring up the motivation to review it as reviewing single patches with a single purpose and change is MUCH easier and MUCH less time-consuming.

Using something like mercurial queues it's also nothing which requires much of work to keep it separately. Actually on the contrary. And you still work on all features concurrently. Also generally, I can only recommend patch authors to have a look at mercurial (or maybe git).
Using svn when dealing with patches seems to be quite inferior to either of hg or git.

And yes, the intentions of these patches sound reasonable (I didn't yet look at any details, though)

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: Group GUI

Post by Juanjo » 08 Aug 2011 06:52

planetmaker wrote:Using something like mercurial queues it's also nothing which requires much of work to keep it separately. Actually on the contrary.
Thanks! I didn't know about it.
Last edited by Juanjo on 08 Aug 2011 14:24, edited 1 time in total.

Eddi
Tycoon
Tycoon
Posts: 7424
Joined: 17 Jan 2007 00:14

Re: Patch: Group GUI

Post by Eddi » 08 Aug 2011 10:23

be careful who you actually quote.
You might not exactly be interested in Ferion, but if you are, have fun :)

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: Group GUI

Post by Juanjo » 09 Sep 2011 19:12

First post updated

User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 675
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Patch: Group GUI

Post by JacobD88 » 12 Sep 2011 15:50

Juanjo wrote:First post updated
Many thanks Juanjo downloading now :bow:

Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Group GUI

Post by Terkhen » 13 Sep 2011 08:34

Can you add an screenshot?

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: Group GUI

Post by Juanjo » 20 Sep 2011 21:42

JacobD88 wrote:
Juanjo wrote:First post updated
Many thanks Juanjo downloading now :bow:
Thank you for your support!
Terkhen wrote:Can you add an screenshot?
Hi! A week late, but I've added it. I wanted to end the next version of the patch before posting the screenshot.

I've uploaded the 4th version which is quite close to the initial purpose of this patch: creation of groups automatically and filtering groups and vehicles by cargo and destinations. I don't expect to add any new feature, although probably I will revise the code and maintain the patch.

I hope you like it!

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: Group GUI

Post by Juanjo » 03 Apr 2012 08:27

Version 5 is out.

Most important change is about coverage area. Although the patch is mainly about groups, the filter window used to filter groups and vehicles is also reused to filter stations to show coverage area of a company. This window is hidden under the smallmap/viewport dropdown.

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: Group GUI

Post by Juanjo » 15 May 2012 07:51

Another bump. No big changes, but some critical bugs cleaned and code updated to trunk.

User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 675
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Patch: Group GUI

Post by JacobD88 » 16 May 2012 11:02

Thanks for the continued updates Juanjo :bow:

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: GroupGUI+Modif. accept./production+Station covera

Post by Juanjo » 25 Jun 2012 18:45

I'm posting an update due to a big change I'm planing to introduce in the set.

I previously included a station coverage controller to show which tiles are under the influence of certain stations. It calculated coverage as: "the station coverage is the union of the coverage of each single tile of the station." This differs with the way really stations work.
So I've decided to rewrite some functions to make acceptance and production of a station be coherent with the previously stated way. This is the first big change I'm introducing to gameplay. It still needs testing, but I think it deserves this update.

As usual, other minor changes (bugs and desyncs). I'll also change the name of the topic to something more appropriate.

Eddi
Tycoon
Tycoon
Posts: 7424
Joined: 17 Jan 2007 00:14

Re: Patch: GroupGUI+Modif. accept./production+Station covera

Post by Eddi » 25 Jun 2012 21:19

Juanjo wrote:So I've decided to rewrite some functions to make acceptance and production of a station be coherent with the previously stated way. This is the first big change I'm introducing to gameplay. It still needs testing, but I think it deserves this update.
i think that's a good idea, but it should be a completely separate patch.
You might not exactly be interested in Ferion, but if you are, have fun :)

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: GroupGUI+Modif. accept./production+Station covera

Post by Juanjo » 26 Jun 2012 20:44

Eddi wrote: i think that's a good idea, but it should be a completely separate patch.
I'll separate them soon then. It should be no big deal. Just for the modified acceptance/production algorithm though.

EDIT: Patch updated. Industries didn't produce anything after loading a savegame.

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: GroupGUI+Modif. accept./production+Station covera

Post by Vaulter » 31 Jul 2012 12:48

Sounds good, but can this patch be separated to specialized ones?

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: GroupGUI+Modif. accept./production+Station covera

Post by Juanjo » 01 Aug 2012 19:57

Vaulter wrote:Sounds good, but can this patch be separated to specialized ones?
I'm reviewing the code to clean up some bugs/inconsistent behaviour. As soon as I release the new version, I will also separate the patches into smaller parts. I think it will take no longer than a week.

Juanjo
Engineer
Engineer
Posts: 124
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Patch: Juanjo's patches

Post by Juanjo » 19 Sep 2012 15:52

Well, I have added two experimental features to the set of patches. They are not finished but they work by now and I don't have time for deep testing.

First feature is about a station having multiple docks. CTRL+Click to join two separate docks into a single station, as road stops and rail station. Second feature (and this needs a lot of work) tries to separate ships a little bit, so they don't cross over each other. Unfortunately, this makes ships to stop when they find another ship ahead. I'll have to look at pathfinders also (OPF for ships doesn't find a path for oil rigs).

For playtesters, take care as newly saved games with this patch will work only for this patched version.

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 5 guests