Increase or remove oil refinary limit over 48 tiles

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

User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Increase or remove oil refinary limit over 48 tiles

Post by NekoMaster »

OpenTTD Is almost a Full v1.0.0 and yet there still the annoying limit of 48 tiles away from the map edges for oil refineries.
IRL As far as I know, oil refineries are usually near a large source of water (usually oceans or seas)

Anyways, could someone tell me how I would remove that limit (like which file in the source code has the limit) or could someone make a simple patch to fix this
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Increase or remove oil refinary limit over 48 tiles

Post by petert »

This line of code looks like it deals with the limit and returning errors:
http://hg.openttd.org/openttd/trunk.hg/ ... .cpp#l1169
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Increase or remove oil refinary limit over 48 tiles

Post by NekoMaster »

Ok, im having A LOT of trouble with this since I know nothing about C\C+

What do I need to change to remove the limit or make it higher?
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Increase or remove oil refinary limit over 48 tiles

Post by petert »

NekoMaster wrote:What do I need to change to remove the limit or make it higher?
From what my limited knowledge of coding can determine:

Code: Select all

if // if xx is true
(DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) // The distrance from the edge (TILE_ADD X+Y)
< _settings_game.game_creation.oil_refinery_limit) // is less that that defined in  _settings_game.game_creation....
return CommandCost() // Return the Command Cost

return_cmd_error(STR_ERROR_CAN_ONLY_BE_POSITIONED); // Other wise, find and return STR_ERROR_CAN_ONLY_BE_POSITIONED
}
You could probably get around this by changing return_cmd_error(STR) to return CommandCost(), so that although it failed, it will still successfully complete the command.

You'd have to do this many times, as the oil refinery code isn't all in one place: http://hg.openttd.org/openttd/trunk.hg/ ... .cpp#l1183

On another note, you sound like you want someone to just do it for you, without actually trying to understand the code. The developers have lives, they just do this in their free time. Perhaps you should try to invest some of yours to figure it out.
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Increase or remove oil refinary limit over 48 tiles

Post by NekoMaster »

Ok I got it, I also removed the limitations of some other industries that should be able to build anywhere, like the forest in subarctic and and the water supply in subtropic
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Increase or remove oil refinary limit over 48 tiles

Post by petert »

NekoMaster wrote:Ok I got it, I also removed the limitations of some other industries that should be able to build anywhere, like the forest in subarctic and and the water supply in subtropic
Could you provide a patch, if at all possible?
With TortoiseSVN: Right Click -> TortoiseSVN -> Create Patch
Command-line: svn diff > patchfile.diff
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Increase or remove oil refinary limit over 48 tiles

Post by NekoMaster »

petert wrote:
NekoMaster wrote:Ok I got it, I also removed the limitations of some other industries that should be able to build anywhere, like the forest in subarctic and and the water supply in subtropic
Could you provide a patch, if at all possible?
With TortoiseSVN: Right Click -> TortoiseSVN -> Create Patch
Command-line: svn diff > patchfile.diff
currently when I try to make a patch it wont compile when I patch openttd with it, but when I edit industry_cmd.cpp by hand it works :\

could I just post the modified industry_cmd.cpp?
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Increase or remove oil refinary limit over 48 tiles

Post by Roujin »

NekoMaster wrote:Ok I got it, I also removed the limitations of some other industries that should be able to build anywhere, like the forest in subarctic and and the water supply in subtropic
Who says where they should be? There are gameplay reasons for these limitations. [I'm not one of them but] quite some people like these restrictions in arctic and tropic. It's arguable though that the oil refinery limitation got broken by large maps anyway.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Increase or remove oil refinary limit over 48 tiles

Post by NekoMaster »

Roujin wrote:
NekoMaster wrote:Ok I got it, I also removed the limitations of some other industries that should be able to build anywhere, like the forest in subarctic and and the water supply in subtropic
Who says where they should be? There are gameplay reasons for these limitations. [I'm not one of them but] quite some people like these restrictions in arctic and tropic. It's arguable though that the oil refinery limitation got broken by large maps anyway.
The problem with having forests only above the snow line is stupid, IRL not all forest's in that climate will grow above the Snow line, after all the Sub-Arctic Climate is suppose to mimic North America, where you can find forests far below the snow line in many places.

As for the water supply, ground water can happen anywhere, it doesn't have to be just under desert's.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Increase or remove oil refinary limit over 48 tiles

Post by Kogut »

It is even less probably to find water on desert.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Increase or remove oil refinary limit over 48 tiles

Post by NekoMaster »

Kogut wrote:It is even less probably to find water on desert.
True, now with the patch I made water supplies can be built on tropical grass.

One thing I found is that Oil Refinaries wont spawn on map generation beyond 48 tiles, so you have to build them your self if you need a oil refinary beyond the 48 tile limit
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 314
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: Increase or remove oil refinary limit over 48 tiles

Post by ColdIce »

Here is the patch for refinery. I followed petert instructions. If you have problem with the patch, I think i can`t help you very much. I don`t know anything about c++.

patch revision 19378
Attachments
patch_refinery.patch
(832 Bytes) Downloaded 167 times
The rest is confetti!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Increase or remove oil refinary limit over 48 tiles

Post by NekoMaster »

Heres my patch, Less Restrictive Industries (Removes placement limits\restrictions for refinaries, forests and water supplies)
Attachments
LRI_r19375.diff
(1.13 KiB) Downloaded 153 times
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2868
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Increase or remove oil refinary limit over 48 tiles

Post by ChillCore »

Code: Select all

...
+	if (_settings_game.game_creation.landscape == LT_ARCTIC) {}
...
+	if (GetTropicZone(tile) != TROPICZONE_DESERT) {}

May I ask why you bother keeping the if statements if you are not doing anything after checking for the condition.
The only thing the above code does for the moment is stressing the processor needlessly.

Anyway I think you will have a hard time convincing the devs to include this into trunk.(I wouldn't.)
Maybe the oil refinery limit but not in this form.
If you could make it a configurable setting in advanced setting ...
You should go look here "_settings_game.game_creation.oil_refinery_limit" and change oil_refinery_limit where it is declared if you want to change the max distance from the edge.

Changing the forest and the water supply placement will break something, if not in the code it will remove the reason they have been coded this way, different gameplay strategy for different climates.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

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.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Increase or remove oil refinary limit over 48 tiles

Post by Yexo »

Even then it wouldn't be included in trunk. If you want to disable the limits create a simple newgrf that doesn't have those limits. I think that as soon as your newgrf overrides an industry some of the limits are already gone and you have to implement them again in the newgrf if you want them.
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: Increase or remove oil refinary limit over 48 tiles

Post by Zephyris »

Given large map sizes it would make a nice feature to allow oil rigs to be built far from the map edge, but have a requirement to be at least a certain distance away from land...
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Increase or remove oil refinary limit over 48 tiles

Post by NekoMaster »

Zephyris wrote:Given large map sizes it would make a nice feature to allow oil rigs to be built far from the map edge, but have a requirement to be at least a certain distance away from land...
What are you talking about, Im tlaking about removing the oil refinery limits
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Increase or remove oil refinary limit over 48 tiles

Post by petert »

NekoMaster wrote:What are you talking about, Im tlaking about removing the oil refinery limits
And he was merely suggesting something that has to do with your topic, without opening a new one.
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Increase or remove oil refinary limit over 48 tiles

Post by NekoMaster »

petert wrote:
NekoMaster wrote:What are you talking about, Im tlaking about removing the oil refinery limits
And he was merely suggesting something that has to do with your topic, without opening a new one.
What, is there a limit for Oil Rig's too like the limit for Oil Refineries?
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
jonty-comp
Tycoon
Tycoon
Posts: 2542
Joined: 22 Oct 2005 16:05
Location: Chesterfield, England
Contact:

Re: Increase or remove oil refinary limit over 48 tiles

Post by jonty-comp »

Kogut wrote:It is even less probably to find water on desert.
I think it's more the point that they only need the water in the desert parts, in general tropical rainforest has quite a lot of water anyway. :o
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 8 guests