Revival of subsidiaries patch
Moderator: OpenTTD Developers
-
- Route Supervisor
- Posts: 415
- Joined: 07 Oct 2004 10:05
Re: Revival of subsidiaries patch
Maybe it would be possible to add most of this patch in seperate files and then maybe only use some inline functions in the original code. That would not be very intrusive but could still at a lot of functionality. Also disabling any functionality added with the patch options shouldn't be a problem. I realized though that the original version is too outdated and I wouldn't be able myself to just take the old code and revamp it for current trunk.
-
- Tycoon
- Posts: 1395
- Joined: 12 Jun 2004 00:37
- Location: United Kingdom of Great Britain and Northern Ireland
- Contact:
Re: Revival of subsidiaries patch
As I read it, the arguement is that the code is too scattered around. That's fairly valid IMHO, as it makes things a nightmare to maintain (I've had a few such projects
).
Maybe if the code was narrowed in scope so that it'd need to be "injected" (placed) in less places in the trunk. That might help things.

Maybe if the code was narrowed in scope so that it'd need to be "injected" (placed) in less places in the trunk. That might help things.
- belugas
- OpenTTD Developer
- Posts: 1507
- Joined: 05 Apr 2005 01:48
- Location: Deep down the deepest blue
- Contact:
Re: Re:
I was merely answering as much as I can to the question of its no-inclusion in trunk.LordOfThePigs wrote:If the intrusive comment was referring to the code, my answer would be: Yes it was, but if you don't want people to play around with your code, don't make it GPL in the first place...
Bare i mind that it's not because trunk is GPL that it means it must accept the work of each individual who offers a new patch. Somehow, we have to maintain every patch that eventually goes into trunk. So, i think we have the right to accept or refuse one patch, for whatever the reason we do feel.
I do not say that Subsidiary patch should or not go in, just what I think about the general acceptance stuff.
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
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
- LordOfThePigs
- Route Supervisor
- Posts: 435
- Joined: 01 Jul 2004 10:28
- Location: Jura/Switzerland
Re: Revival of subsidiaries patch
It is scattered around a lot, but think of all the things that need to be modified: Pathfinding (on 3 different pathfinders), Various GUI elements (for 4 different type of vehicles), Profit calculation, Network code, Building, Destruction etc...Moriarty wrote:As I read it, the arguement is that the code is too scattered around. That's fairly valid IMHO, as it makes things a nightmare to maintain (I've had a few such projects).
Maybe if the code was narrowed in scope so that it'd need to be "injected" (placed) in less places in the trunk. That might help things.
So yeah, the code was scattered, but only because it HAD to be. It's not possible to modify the pathfinders by putting all your code in one file exclusively, and the same holds true for most of the elements I mentioned. The code was scattered because each of the elements that needed to be modified were scattered themselves.
@Belugas: Reading your reply it seems I was a bit harsh in my previous post, so I'm sorry. I totally understand the constraints of merging patches to trunk, and I actually got some comments from Bjarni and Celestar (IIRC) on my code and corrected it. Apparently the real reason was that it was too big, and nobody would bother reading through all of it (it was more than 3000 lines of diff)...
Sometimes I'm told "Brilliant"...
Sometimes I'm told "Charming"...
And Often I'm told "Shut Up"!
Sometimes I'm told "Charming"...
And Often I'm told "Shut Up"!
Re: Revival of subsidiaries patch
Before they moved to C++?A lot has changed in the trunk (C++, map accessors, YAPF, plenty of other things I'm forgetting...)
Yeah, it would definitely need to be re-implemented then. I had to rewrite my patch for that reason alone.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
I am not much of a coder, but when chrissicom posted his partial upgrade a I gave it a go and tried to finish it. All I can say is that for me it compiles, links, runs and more or less works.
Some of the changes that I have made will be probably classified as hacks and they probably are in fact ARE hacks, anyway there they are:
Here you are
EDIT: I have tried to separate the tracksharing part of the patch, but I have run into a design issues - like who should be able to start/stop the train or even make it ignore signal - owner of the track or train. The obvious solution would be that both of them must agree, but that involves new GUI windows. Is there somebody who thought about that and came to some outcome? If so, please share your ideas.
Other problems arise when thinking about tracksharing tax - My idea is to make the train each time it enters new tile save its current weight to array <pseudocode>uint32 tontiles[MAX_PLAYERS]</pseudocode> and each month, day, or x ticks(dont know what will be better) compute the tax based on tontiles travelled, increase the running cost and give tax to track owner. Any comments?
Some of the changes that I have made will be probably classified as hacks and they probably are in fact ARE hacks, anyway there they are:
- Company and player names are now referenced by index in SetParamD, so I changed the strings accordingly.
- Changed commands type from int32 to CommanCost.
- Changed retyped few variables to Money.
- Changed Subsidiaries button in Player window widget type from WWT_TEXTBTN to WWT_PUSHTXTBTN and made it open subsidiaries management window(Don't know why it was missing)
- Made player icons position in status bar relative to its widget position.
- Changed other players finances window description to player finances window description
- For some reason when old AI builds stations, tracks and buys trains it does not launch them from depot. (Maybe it is not such an issue, as old AI builds the tracks with 90˚ turns anyway and will be replaced ).
- When you create subsidiary, send her some cash, then merge her back you will end up with more money than you had before.
- Although there is patch setting for track sharing tax, it does not work(I could not find the code for taxation in chrissicoms diff nor in LordOfThePigs original patch for r7213
)
- The coding style is not OK.
- It's completely untested in multiplayer.
- Some parts of my upgrade are hacks.
- Some parts of my upgrade are hacks. ( "I know that, technically, that's only one issue, but it was such a big one I thought I'd mention it twice "
Here you are
EDIT: I have tried to separate the tracksharing part of the patch, but I have run into a design issues - like who should be able to start/stop the train or even make it ignore signal - owner of the track or train. The obvious solution would be that both of them must agree, but that involves new GUI windows. Is there somebody who thought about that and came to some outcome? If so, please share your ideas.
Other problems arise when thinking about tracksharing tax - My idea is to make the train each time it enters new tile save its current weight to array <pseudocode>uint32 tontiles[MAX_PLAYERS]</pseudocode> and each month, day, or x ticks(dont know what will be better) compute the tax based on tontiles travelled, increase the running cost and give tax to track owner. Any comments?
- Attachments
-
- subsidiaries_r10821.diff
- (112.34 KiB) Downloaded 269 times
-
- trackshare_r10876.diff
- Tracksharing part of the subsdiaries patch
- (17.55 KiB) Downloaded 192 times
- Kosov_1986
- Traffic Manager
- Posts: 248
- Joined: 01 May 2006 14:37
- Location: Pecs, Hungary
- Contact:
Re: Revival of subsidiaries patch
Grolsch wrote:Subsidiaries is one of the two patches I would REALLY like to see in trunk/stable.... Other one is PBS![]()
I wish I could programme, so I could help this patch get into trunk. However, I can't, so I wish the people who can and try, the best of luck!
absolutely same here! this is why i was sad about the cancelling of the MiniIN, and why i'm happy that ChrisIN appeared!
Kosov from the depths of East Europe!
My English isn't good but i never use translating programs
I had a Chinese gf, for 3 days, now she's in Germany because she studies there... she was my first serious gf.
Minibus topic, (Renault-Ikarus 546 released by wyctor) http://www.tt-forums.net/viewtopic.php?t=25662
Ikarus buses from all around the world! http://www.tt-forums.net/viewtopic.php?t=26985
My English isn't good but i never use translating programs

I had a Chinese gf, for 3 days, now she's in Germany because she studies there... she was my first serious gf.
Minibus topic, (Renault-Ikarus 546 released by wyctor) http://www.tt-forums.net/viewtopic.php?t=25662
Ikarus buses from all around the world! http://www.tt-forums.net/viewtopic.php?t=26985
Re: Revival of subsidiaries patch
yeah but as you can see, the topic is dead again 

-
- Route Supervisor
- Posts: 415
- Joined: 07 Oct 2004 10:05
Re: Revival of subsidiaries patch
The topic might be dead but only because nothing new has been produced yet
I am looking at Vikthor's good work and what I am trying to do is to seperate the patches into smaller parts. What I think is most interesting is the track sharing which could clean up an 8 player game a lot 


Last edited by chrissicom on 28 Aug 2007 10:39, edited 1 time in total.
-
- Transport Coordinator
- Posts: 283
- Joined: 08 May 2004 07:48
- Location: Alkmaar, The Netherlands
Re: Revival of subsidiaries patch
Second that!chrissicom wrote:The topic might be dead but only because nothing new has been produced yetI am looking at Vikthor good work and what I am trying to do is to seperate the patches into smaller parts. What I think is most interesting is the track sharing which could clean up an 8 player game a lot
Beer equals power
Re: Revival of subsidiaries patch
one thing that i liked a lot in mini, with the subsidiaries patch, was that i could make companies that has only trains, or only trucks, al subordinated to the mother company
-
- Route Supervisor
- Posts: 415
- Joined: 07 Oct 2004 10:05
Re: Revival of subsidiaries patch
I also liked this idea and it was one of the reason I brought this topic up after all. But afaik there were lots of exploits due to the possibility of multiple companies. For example you could create a new company to demolish buildings in a city where your main company has an appaling rating which is really not nice for multiplayer. So such problems would need to be solved in a nice way first.xmart2k wrote:one thing that i liked a lot in mini, with the subsidiaries patch, was that i could make companies that has only trains, or only trucks, al subordinated to the mother company
Re: Revival of subsidiaries patch
That's easy. In MP, you can't spawn subsidiaries. You can only buy out existing companies. It has been this way for ages.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Re: Revival of subsidiaries patch
I am glad to hear that somebody is working to it. I was actually trying to separate it myself, but RL got in the way and I won`t have time for coding until mid of September. I am looking forward to your patcheschrissicom wrote:I am looking at Vikthor's good work and what I am trying to do is to seperate the patches into smaller parts.

Re: Revival of subsidiaries patch
any progress in this?
Re: Revival of subsidiaries patch
Hi
I started a rewrite of the subsidiaries patch.
things that work:
1. share stations, depots, tracks, road stops, docks
2. enable/disable sharing
3. english(UK) and german language
things that don't work:
1. taxes for using other players tracks...
2. buildung junctions on other players tracks
3. disable sharing, for example tracks, when a train is on it, that wil cause an assertion error
4. having subsidiaries
5. all other languages
I think there are two possibilities for expanding this patch, I'm not yet sure, which I do want:
1. rebuild old subsidiaries behavior
2. allow contracts between two players about sharing each others infrastructre with the possibility to set taxes for each contract in game
What do you think?
The patch is made against r11158 and works with MS VS 8 and all Systems, that use configure/make
I started a rewrite of the subsidiaries patch.
things that work:
1. share stations, depots, tracks, road stops, docks
2. enable/disable sharing
3. english(UK) and german language
things that don't work:
1. taxes for using other players tracks...
2. buildung junctions on other players tracks
3. disable sharing, for example tracks, when a train is on it, that wil cause an assertion error
4. having subsidiaries
5. all other languages
I think there are two possibilities for expanding this patch, I'm not yet sure, which I do want:
1. rebuild old subsidiaries behavior
2. allow contracts between two players about sharing each others infrastructre with the possibility to set taxes for each contract in game
What do you think?
The patch is made against r11158 and works with MS VS 8 and all Systems, that use configure/make
- Attachments
-
- shared_r11158.diff
- (20.24 KiB) Downloaded 175 times
Re: Revival of subsidiaries patch
Great! I really loved this patch in MiniIN.
I vote for second option; but how would one do this with his subsidiary (under his control) instead of another player?I think there are two possibilities for expanding this patch, I'm not yet sure, which I do want:
1. rebuild old subsidiaries behavior
2. allow contracts between two players about sharing each others infrastructre with the possibility to set taxes for each contract in game
Re: Revival of subsidiaries patch
I would prefere to split it.I vote for second option; but how would one do this with his subsidiary (under his control) instead of another player?
In my oppinion you don't need subsidiaries in multiplayer when you can have contracts.
In singleplayer it's the other way around. With whom would you create contracts in singleplayer? But you can make sepereate companies foer busses, trains ... in singleplayer.
So my solution would be, to make a contracts patch for multiplayer games and a simplified subsidiaries patch for singleplayer games.
I think I will set up a subversion repository on my server for both patches.
I there is anyone who would like to help me, I will grant access.
Re: Revival of subsidiaries patch
Gagarin, as I have just today finished my exams, I took a look into your patch and I can not see big differences between your patch and updated patch of LordOfThePigs( apart from extra patch setting for each transport system). Would not be easier to use the original patch as base and continue from there? Or did I missed some major design flaw in original patch or maybe something else?
Re: Revival of subsidiaries patch
I agree with this. Also having it as two, smaller, simpler patches increases its chance of getting into trunk (though this is sometime ahead).gagarin wrote: I would prefere to split it.
In my oppinion you don't need subsidiaries in multiplayer when you can have contracts.
In singleplayer it's the other way around. With whom would you create contracts in singleplayer? But you can make sepereate companies foer busses, trains ... in singleplayer.
So my solution would be, to make a contracts patch for multiplayer games and a simplified subsidiaries patch for singleplayer games.
I think I will set up a subversion repository on my server for both patches.
I there is anyone who would like to help me, I will grant access.
Who is online
Users browsing this forum: No registered users and 13 guests