Page 1 of 2
No tunnels under mines\wells [hello sourceforge]
Posted: 14 Oct 2005 22:40
by MeusH
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.
Posted: 15 Oct 2005 00:40
by Conditional Zenith
Where's the diff?
Posted: 15 Oct 2005 03:53
by SirkoZ
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)...
Posted: 15 Oct 2005 09:08
by MeusH
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
SirkoZ wrote:You could maybe limit the limit to the "shaft" parts of the mines (where the elevators go to the ground)...
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-simple
Posted: 15 Oct 2005 17:45
by Gorre
Aaaa, MeusH, thank you! I just hope it is going to be in CVS soon.
Posted: 15 Oct 2005 18:23
by DaleStan
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>
Posted: 15 Oct 2005 18:30
by Gorre
Posted: 15 Oct 2005 19:08
by webfreakz.nl
G0RR3 wrote:

Posted: 16 Oct 2005 05:49
by spaceman-spiff
Stick to some sort of encouraging word please
Posted: 16 Oct 2005 19:28
by belugas
I really like the idea (and the patch!) Good work!
I always found it to be unrealistic, to drill tunnels almost anywhere...
Suggestion : what about "parametrizing" the "depth" at which one can drill a tunnel?
It could be linked to a difficulty setting...
Posted: 17 Oct 2005 04:10
by MeusH
belugas wrote:Suggestion : what about "parametrizing" the "depth" at which one can drill a tunnel?
It could be linked to a difficulty setting...
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...
Posted: 17 Oct 2005 15:13
by belugas
MeusH 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...
Cheat is easy ! Simply remove the feature

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!
Posted: 18 Oct 2005 17:44
by MeusH
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:
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;
}
Unfortunatelly, this doesn't block industries from being placed there.
Any ideas, please?
Posted: 19 Oct 2005 10:09
by MeusH
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...
Posted: 19 Oct 2005 21:47
by MeusH
Finished.
No mines\wells can be built over tunnels
Patch against r3070
Submitted to the SF
Posted: 20 Oct 2005 13:46
by belugas
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
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];
}
}
and
Code: Select all
DoCommandP(0, -1, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
Now, following the path of
CMD_CHANGE_DIFFICULTY_LEVEL, you fall into misc_cmd.c , function
Code: Select all
int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
So, I guess your patch would be complete if we can make that difficulty level thing going on... I guess!

Posted: 20 Oct 2005 18:10
by Prof. Frink
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"
Posted: 20 Oct 2005 18:48
by MeusH
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.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];
}
}
and
Code: Select all
DoCommandP(0, -1, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
Now, following the path of
CMD_CHANGE_DIFFICULTY_LEVEL, you fall into misc_cmd.c , function
Code: Select all
int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
So, I guess your patch would be complete if we can make that difficulty level thing going on... I guess!

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?
Prof. 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"
I'll see if it won't break the savegame and upload new version if possible. Thank you for the naming idea, too

Posted: 20 Oct 2005 19:00
by belugas
MeusH wrote:belugas wrote:Suggestion : what about "parametrizing" the "depth" at which one can drill a tunnel?
It could be linked to a difficulty setting...
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...
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!
This is what I meant.
And that was the result of my search...
I guess I was looking for the wrong thing

Posted: 20 Oct 2005 19:04
by MeusH
Difficulity levels and patches are saved in the .cfg, you can take a look at the more disasters patch.
As for cheats, there is a table, I'll report as soon as I finalize something