No tunnels under mines\wells [hello sourceforge]
Moderator: OpenTTD Developers
No tunnels under mines\wells [hello sourceforge]
This patch forbids building tunnel under following
industries:
coal mine, copper ore mine, iron ore mine, gold mine,
diamond mine, oil wells, plastic fountains, sugar mine, water
supply.
If player tries to do so, error message
Can't build tunnel here...
<Industry name> in the way
will pop-up.
If you have any suggestions\found a bug please let me know. This has been submitted to the SourceForge and now it awaits for a kind dev to merge "another tunnel bug fix".
The only thing I'd change (but I don't know yet how) is the red flickering tile - it appears at the tunnel end, while it should appear at one of the industrial tiles. Anyway I don't think it is important for gameplay.
industries:
coal mine, copper ore mine, iron ore mine, gold mine,
diamond mine, oil wells, plastic fountains, sugar mine, water
supply.
If player tries to do so, error message
Can't build tunnel here...
<Industry name> in the way
will pop-up.
If you have any suggestions\found a bug please let me know. This has been submitted to the SourceForge and now it awaits for a kind dev to merge "another tunnel bug fix".
The only thing I'd change (but I don't know yet how) is the red flickering tile - it appears at the tunnel end, while it should appear at one of the industrial tiles. Anyway I don't think it is important for gameplay.
Last edited by MeusH on 19 Oct 2005 21:36, edited 2 times in total.
-
- Chief Executive
- Posts: 697
- Joined: 10 Jun 2003 00:19
- Location: Australia
Finally. I thought I would have to make it. 
You could maybe limit the limit to the "shaft" parts of the mines (where the elevators go to the ground)...

You could maybe limit the limit to the "shaft" parts of the mines (where the elevators go to the ground)...
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Conditional Zenith wrote:Where's the diff?
Peter1138 did a nice work on simplifying the code (changed if to switch, case) - link to version improved by Peter is in the comments
I think we should keep it simple... I was also thinking about gold\iron ore mines should block tunnel only one height level below, but that would make game not-so-simpleSirkoZ wrote:You could maybe limit the limit to the "shaft" parts of the mines (where the elevators go to the ground)...
Personally, I hope it *doesn't* appear in CVS, because that would mean that I have to figure out how to acquire the source from CVS, instead of SVN.
</smart_alek>
</smart_alek>
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
- webfreakz.nl
- Director
- Posts: 627
- Joined: 11 Aug 2005 08:22
- Location: Localhost, 127.0.0.1, [The Netherlands: South Holland-> Westland]
- Contact:
- spaceman-spiff
- Retired Moderator
- Posts: 20634
- Joined: 28 Jul 2002 07:08
- Location: Belgium
- Contact:
- belugas
- OpenTTD Developer
- Posts: 1507
- Joined: 05 Apr 2005 01:48
- Location: Deep down the deepest blue
- Contact:
Cheat is easy ! Simply remove the featureMeusH wrote: Yes, if I go into enchancing this and keeping-not-as-simple, I'd do this.
I'd also make a cheat that allows to build such a tunnels...

But I think that cheat,as well as difficulty levels, are saved within the game.
Is there room for new stuff on it? Got to check it out!
Industries (should) not be able to be built over a tunnel.
There is one issue I can't fix, so I'm asking for help some kind coder with spare minutes.
Everything is in bool CheckIfIndustryTilesAreFree in industry_cmd.c:
Unfortunatelly, this doesn't block industries from being placed there.
Any ideas, please?
There is one issue I can't fix, so I'm asking for help some kind coder with spare minutes.
Everything is in bool CheckIfIndustryTilesAreFree in industry_cmd.c:
Code: Select all
// Check for industries we can't tunnel under.
switch (type) {
case IT_COAL_MINE:
case IT_COPPER_MINE:
case IT_IRON_MINE:
case IT_GOLD_MINE:
case IT_DIAMOND_MINE:
case IT_OIL_WELL:
case IT_PLASTIC_FOUNTAINS:
case IT_SUGAR_MINE:
case IT_WATER_SUPPLY:
for (z=ti.z;z==0;z--) //loop throught all height levels
if (!CheckTunnelInWay(tile, z*8)) { //check for tunnels
break;
return_cmd_error(STR_1002_EXCAVATION_WOULD_DAMAGE);
}
default:
break;
}
Any ideas, please?
- Attachments
-
- no_tunnels_under_mines_2005_10_18_r3059.patch
- Diff against r3059
- (2.14 KiB) Downloaded 262 times
Fixed, fixed
Updated against 3065
Now industries can't be built\bought over a tunnel.
Loop is still a bit tricky, but it would be easy to fix.
Anyway, the question is about adding a cheat allowing to tunnel through shafts. This is mainly to developers, since they might i.e. not want to add next cheat...

Updated against 3065
Now industries can't be built\bought over a tunnel.
Loop is still a bit tricky, but it would be easy to fix.
Anyway, the question is about adding a cheat allowing to tunnel through shafts. This is mainly to developers, since they might i.e. not want to add next cheat...
- Attachments
-
- no_tunnels_under_mines_2005_10_19_r3065.patch
- diff against 3065
- (2.16 KiB) Downloaded 262 times
Finished.
No mines\wells can be built over tunnels
Patch against r3070
Submitted to the SF
No mines\wells can be built over tunnels
Patch against r3070
Submitted to the SF
- Attachments
-
- no_tunnels_under_mines_2005_10_19_r3070.patch
- (2.13 KiB) Downloaded 248 times
- belugas
- OpenTTD Developer
- Posts: 1507
- Joined: 05 Apr 2005 01:48
- Location: Deep down the deepest blue
- Contact:
I did a search on difficulty level
I though it was saved within the game, well.. I think I was wrong.
I did found out it was saved in the config file instead...
Although I could be wrong... again...
From settings_gui.c
and
Now, following the path of CMD_CHANGE_DIFFICULTY_LEVEL, you fall into misc_cmd.c , function
So, I guess your patch would be complete if we can make that difficulty level thing going on... I guess! 
I though it was saved within the game, well.. I think I was wrong.
I did found out it was saved in the config file instead...
Although I could be wrong... again...

From settings_gui.c
Code: Select all
void SetDifficultyLevel(int mode, GameOptions *gm_opt)
{
int i;
assert(mode <= 3);
gm_opt->diff_level = mode;
if (mode != 3) { // not custom
for (i = 0; i != GAME_DIFFICULTY_NUM; i++)
((int*)&gm_opt->diff)[i] = _default_game_diff[mode][i];
}
}
Code: Select all
DoCommandP(0, -1, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
Code: Select all
int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)

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
-
- Tycoon
- Posts: 3849
- Joined: 20 Jan 2003 14:51
- Location: Broadstone, Dorset
- Contact:
Is it the right thread you wanted to post? Sorry but I don't know what do you mean... You mean adding option to the difficulity settings that would allow to dig through obstacles?belugas wrote:I did a search on difficulty level
I though it was saved within the game, well.. I think I was wrong.
I did found out it was saved in the config file instead...
Although I could be wrong... again...![]()
From settings_gui.candCode: Select all
void SetDifficultyLevel(int mode, GameOptions *gm_opt) { int i; assert(mode <= 3); gm_opt->diff_level = mode; if (mode != 3) { // not custom for (i = 0; i != GAME_DIFFICULTY_NUM; i++) ((int*)&gm_opt->diff)[i] = _default_game_diff[mode][i]; } }
Now, following the path of CMD_CHANGE_DIFFICULTY_LEVEL, you fall into misc_cmd.c , functionCode: Select all
DoCommandP(0, -1, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
So, I guess your patch would be complete if we can make that difficulty level thing going on... I guess!Code: Select all
int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
I'll see if it won't break the savegame and upload new version if possible. Thank you for the naming idea, tooProf. Frink wrote:MeusH: Maybe you should make the 'tunnel through mineshafts' cheat part of the 'crossing tunnels' cheat.
Rename it to something like "Allow tunnels through undergound obstacles"

- belugas
- OpenTTD Developer
- Posts: 1507
- Joined: 05 Apr 2005 01:48
- Location: Deep down the deepest blue
- Contact:
MeusH wrote:Yes, if I go into enchancing this and keeping-not-as-simple, I'd do this.belugas wrote:Suggestion : what about "parametrizing" the "depth" at which one can drill a tunnel?
It could be linked to a difficulty setting...
I'd also make a cheat that allows to build such a tunnels...
This is what I meant.belugas wrote:But I think that cheat,as well as difficulty levels, are saved within the game.
Is there room for new stuff on it? Got to check it out!
And that was the result of my search...
I guess I was looking for the wrong thing

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
Who is online
Users browsing this forum: Majestic-12 [Bot] and 16 guests