src/unmovable_cmd.cpp
author rubidium
Tue, 06 May 2008 22:17:12 +0000
changeset 9117 87f472043e9e
parent 9111 48ce04029fe4
child 9126 5648d696456b
permissions -rw-r--r--
(svn r12977) -Codechange: remove quite some redundant (duplicate) function declarations.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
9111
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 9056
diff changeset
     3
/** @file unmovable_cmd.cpp Handling of unmovable tiles. */
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1891
862800791170 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1796
diff changeset
     6
#include "openttd.h"
8119
52b48108425a (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents: 8116
diff changeset
     7
#include "tile_cmd.h"
6453
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6427
diff changeset
     8
#include "landscape.h"
8116
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents: 8108
diff changeset
     9
#include "command_func.h"
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8210
diff changeset
    10
#include "viewport_func.h"
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8230
diff changeset
    11
#include "player_func.h"
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8230
diff changeset
    12
#include "player_base.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
#include "gui.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
#include "town.h"
405
415546028e8d (svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents: 384
diff changeset
    15
#include "sprite.h"
7202
dc312a87f450 (svn r10480) -Fix: Don't allow building lighthouses and transmitters under bridges in the scenario editor, or during world generation.
maedhros
parents: 6953
diff changeset
    16
#include "bridge_map.h"
3310
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
    17
#include "unmovable_map.h"
2159
f6284cf5fab0 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2150
diff changeset
    18
#include "variables.h"
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
    19
#include "genworld.h"
6160
fa42299e967e (svn r8908) -Codechange: declaration of DrawBridgeMiddle does not belong in a map accessors header.
rubidium
parents: 5668
diff changeset
    20
#include "bridge.h"
7582
80c8517b08d1 (svn r11107) -Feature: some tool so one can still build tunnels under rails (and other structures) when the owner of the structure built it on foundations and if you have enough "empty" space ofcourse. One could use the tool for some other construction needs too. Patch by frosch.
rubidium
parents: 7549
diff changeset
    21
#include "autoslope.h"
7849
0a1c0af2c96c (svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents: 7795
diff changeset
    22
#include "transparency.h"
8131
160939e24ed3 (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents: 8119
diff changeset
    23
#include "functions.h"
160939e24ed3 (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents: 8119
diff changeset
    24
#include "window_func.h"
8210
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
    25
#include "vehicle_func.h"
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8230
diff changeset
    26
#include "player_gui.h"
8962
1b263c69799d (svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents: 8806
diff changeset
    27
#include "station_type.h"
1b263c69799d (svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents: 8806
diff changeset
    28
#include "economy_func.h"
8965
29a591456a2f (svn r12757) -Codechange: move all cheat related stuff from all over the place to a single location.
rubidium
parents: 8962
diff changeset
    29
#include "cheat_func.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
8264
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    31
#include "table/strings.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    32
#include "table/sprites.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    33
#include "table/unmovable_land.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    34
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    35
/** Destroy a HQ.
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    36
 * During normal gameplay you can only implicitely destroy a HQ when you are
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    37
 * rebuilding it. Otherwise, only water can destroy it.
6484
79156627e1ba (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections...
belugas
parents: 6453
diff changeset
    38
 * @param pid Player requesting the destruction of his HQ
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    39
 * @param flags docommand flags of calling function
6484
79156627e1ba (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections...
belugas
parents: 6453
diff changeset
    40
 * @return cost of the operation
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    41
 */
6943
1914f26aee04 (svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents: 6720
diff changeset
    42
static CommandCost DestroyCompanyHQ(PlayerID pid, uint32 flags)
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    43
{
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
    44
	Player *p = GetPlayer(pid);
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    45
4060
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
    46
	if (flags & DC_EXEC) {
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
    47
		TileIndex t = p->location_of_house;
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    48
4060
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
    49
		DoClearSquare(t + TileDiffXY(0, 0));
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
    50
		DoClearSquare(t + TileDiffXY(0, 1));
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
    51
		DoClearSquare(t + TileDiffXY(1, 0));
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
    52
		DoClearSquare(t + TileDiffXY(1, 1));
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
    53
		p->location_of_house = 0; // reset HQ position
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
    54
		InvalidateWindow(WC_COMPANY, pid);
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
    55
	}
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    56
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
    57
	/* cost of relocating company is 1% of company value */
8230
64f28fe2d5c8 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium
parents: 8224
diff changeset
    58
	return CommandCost(EXPENSES_PROPERTY, CalculateCompanyValue(p) / 100);
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    59
}
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    60
3386
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    61
void UpdateCompanyHQ(Player *p, uint score)
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    62
{
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    63
	byte val;
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    64
	TileIndex tile = p->location_of_house;
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    65
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
    66
	if (tile == 0) return;
3386
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    67
3388
e94795a55f13 (svn r4196) -Codechange: Add and make use of an accessor that modifies the size of the Company HQ
celestar
parents: 3386
diff changeset
    68
	(val = 0, score < 170) ||
e94795a55f13 (svn r4196) -Codechange: Add and make use of an accessor that modifies the size of the Company HQ
celestar
parents: 3386
diff changeset
    69
	(val++, score < 350) ||
e94795a55f13 (svn r4196) -Codechange: Add and make use of an accessor that modifies the size of the Company HQ
celestar
parents: 3386
diff changeset
    70
	(val++, score < 520) ||
e94795a55f13 (svn r4196) -Codechange: Add and make use of an accessor that modifies the size of the Company HQ
celestar
parents: 3386
diff changeset
    71
	(val++, score < 720) ||
e94795a55f13 (svn r4196) -Codechange: Add and make use of an accessor that modifies the size of the Company HQ
celestar
parents: 3386
diff changeset
    72
	(val++, true);
3386
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    73
3388
e94795a55f13 (svn r4196) -Codechange: Add and make use of an accessor that modifies the size of the Company HQ
celestar
parents: 3386
diff changeset
    74
	EnlargeCompanyHQ(tile, val);
3386
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    75
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    76
	MarkTileDirtyByTile(tile + TileDiffXY(0, 0));
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    77
	MarkTileDirtyByTile(tile + TileDiffXY(0, 1));
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    78
	MarkTileDirtyByTile(tile + TileDiffXY(1, 0));
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    79
	MarkTileDirtyByTile(tile + TileDiffXY(1, 1));
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    80
}
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
    81
7795
8ce3c983c7a3 (svn r11345) -Cleanup: a bit of comment style fixing
belugas
parents: 7601
diff changeset
    82
extern CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID *station, bool check_clear = true);
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
    83
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    84
/** Build or relocate the HQ. This depends if the HQ is already built or not
3491
35d747bb5e82 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents: 3427
diff changeset
    85
 * @param tile tile where the HQ will be built or relocated to
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
    86
 * @param flags type of operation
2473
37fb41e00282 (svn r2999) Do not pass if the HQ gets built for the first time or gets relocated as parameter - the command function has to check this anyway
tron
parents: 2436
diff changeset
    87
 * @param p1 unused
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    88
 * @param p2 unused
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    89
 */
6943
1914f26aee04 (svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents: 6720
diff changeset
    90
CommandCost CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    91
{
1962
8254df1b359b (svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents: 1902
diff changeset
    92
	Player *p = GetPlayer(_current_player);
8230
64f28fe2d5c8 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium
parents: 8224
diff changeset
    93
	CommandCost cost(EXPENSES_PROPERTY);
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    94
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
    95
	cost = CheckFlatLandBelow(tile, 2, 2, flags, 0, NULL);
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
    96
	if (CmdFailed(cost)) return cost;
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
    97
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
    98
	if (p->location_of_house != 0) { // Moving HQ
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
    99
		cost.AddCost(DestroyCompanyHQ(_current_player, flags));
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   100
	}
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   101
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   102
	if (flags & DC_EXEC) {
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   103
		int score = UpdateCompanyRatingAndValue(p, false);
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   104
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   105
		p->location_of_house = tile;
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   106
3385
18e4ca6d3ef4 (svn r4193) -Codechange: Add and make use of an accessor function to create company HQs
celestar
parents: 3310
diff changeset
   107
		MakeCompanyHQ(tile, _current_player);
18e4ca6d3ef4 (svn r4193) -Codechange: Add and make use of an accessor function to create company HQs
celestar
parents: 3310
diff changeset
   108
3386
6d088afdabf4 (svn r4194) -Codechange: Renamed UpdatePlayerHouse to UpdateCompanyHQ because the rest of the code calls it Comapany HQ. Moved it to unmovable_cmd.c because CompanyHQ is an unmovable and has nothing to do with economy.
celestar
parents: 3385
diff changeset
   109
		UpdateCompanyHQ(p, score);
3017
a75caf4efa2d (svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
tron
parents: 2951
diff changeset
   110
		InvalidateWindow(WC_COMPANY, p->index);
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   111
	}
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   112
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   113
	return cost;
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   114
}
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1792
diff changeset
   115
8210
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   116
/** Purchase a land area. Actually you only purchase one tile, so
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   117
 * the name is a bit confusing ;p
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   118
 * @param tile the tile the player is purchasing
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   119
 * @param flags for this command type
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   120
 * @param p1 unused
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   121
 * @param p2 unused
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   122
 * @return error of cost of operation
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   123
 */
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   124
CommandCost CmdPurchaseLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   125
{
8230
64f28fe2d5c8 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium
parents: 8224
diff changeset
   126
	CommandCost cost(EXPENSES_CONSTRUCTION);
8210
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   127
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   128
	if (IsOwnedLandTile(tile) && IsTileOwner(tile, _current_player)) {
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   129
		return_cmd_error(STR_5807_YOU_ALREADY_OWN_IT);
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   130
	}
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   131
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   132
	cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   133
	if (CmdFailed(cost)) return CMD_ERROR;
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   134
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   135
	if (flags & DC_EXEC) {
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   136
		MakeOwnedLand(tile, _current_player);
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   137
		MarkTileDirtyByTile(tile);
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   138
	}
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   139
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   140
	return cost.AddCost(_price.clear_roughland * 10);
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   141
}
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   142
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   143
/** Sell a land area. Actually you only sell one tile, so
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   144
 * the name is a bit confusing ;p
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   145
 * @param tile the tile the player is selling
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   146
 * @param flags for this command type
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   147
 * @param p1 unused
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   148
 * @param p2 unused
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   149
 * @return error or cost of operation
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   150
 */
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   151
CommandCost CmdSellLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   152
{
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   153
	if (!IsOwnedLandTile(tile)) return CMD_ERROR;
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   154
	if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER) return CMD_ERROR;
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   155
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   156
	if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   157
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   158
	if (flags & DC_EXEC) DoClearSquare(tile);
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   159
8969
6d1c74e0e2cd (svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents: 8965
diff changeset
   160
	return CommandCost(EXPENSES_CONSTRUCTION, - _price.clear_roughland * 2);
8210
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   161
}
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8139
diff changeset
   162
7549
53483e249123 (svn r11069) -Codechange: allow slopes under statues. Patch by kaan.
rubidium
parents: 7494
diff changeset
   163
static Foundation GetFoundation_Unmovable(TileIndex tile, Slope tileh);
53483e249123 (svn r11069) -Codechange: allow slopes under statues. Patch by kaan.
rubidium
parents: 7494
diff changeset
   164
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
static void DrawTile_Unmovable(TileInfo *ti)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   166
{
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   167
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   168
	switch (GetUnmovableType(ti->tile)) {
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   169
		case UNMOVABLE_TRANSMITTER:
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   170
		case UNMOVABLE_LIGHTHOUSE: {
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   171
			const DrawTileSeqStruct *dtu = &_draw_tile_transmitterlighthouse_data[GetUnmovableType(ti->tile)];
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   172
7335
141c6b86ec1f (svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium
parents: 7333
diff changeset
   173
			if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   174
			DrawClearLandTile(ti, 2);
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   175
8806
4fe163e0b52a (svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents: 8785
diff changeset
   176
			if (IsInvisibilitySet(TO_STRUCTURES)) break;
4fe163e0b52a (svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents: 8785
diff changeset
   177
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   178
			AddSortableSpriteToDraw(
8576
7e9bd8e52966 (svn r12157) -Codechange: Remove a structure definition and replace it with another one closely matching
belugas
parents: 8571
diff changeset
   179
				dtu->image.sprite, PAL_NONE, ti->x | dtu->delta_x, ti->y | dtu->delta_y,
7e9bd8e52966 (svn r12157) -Codechange: Remove a structure definition and replace it with another one closely matching
belugas
parents: 8571
diff changeset
   180
				dtu->size_x, dtu->size_y, dtu->size_z, ti->z,
7849
0a1c0af2c96c (svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents: 7795
diff changeset
   181
				IsTransparencySet(TO_STRUCTURES)
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   182
			);
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   183
			break;
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   184
		}
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   185
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   186
		case UNMOVABLE_STATUE:
7549
53483e249123 (svn r11069) -Codechange: allow slopes under statues. Patch by kaan.
rubidium
parents: 7494
diff changeset
   187
			/* This should prevent statues from sinking into the ground when on a slope. */
53483e249123 (svn r11069) -Codechange: allow slopes under statues. Patch by kaan.
rubidium
parents: 7494
diff changeset
   188
			if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, GetFoundation_Unmovable(ti->tile, ti->tileh));
53483e249123 (svn r11069) -Codechange: allow slopes under statues. Patch by kaan.
rubidium
parents: 7494
diff changeset
   189
5668
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5601
diff changeset
   190
			DrawGroundSprite(SPR_CONCRETE_GROUND, PAL_NONE);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
8806
4fe163e0b52a (svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents: 8785
diff changeset
   192
			if (IsInvisibilitySet(TO_STRUCTURES)) break;
4fe163e0b52a (svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents: 8785
diff changeset
   193
7849
0a1c0af2c96c (svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents: 7795
diff changeset
   194
			AddSortableSpriteToDraw(SPR_STATUE_COMPANY, PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)), ti->x, ti->y, 16, 16, 25, ti->z, IsTransparencySet(TO_STRUCTURES));
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   195
			break;
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   196
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   197
		case UNMOVABLE_OWNED_LAND:
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   198
			DrawClearLandTile(ti, 0);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   199
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   200
			AddSortableSpriteToDraw(
7333
e48228e44be8 (svn r10696) -Codechange: remove duplication of the "make sprite transparent" code.
rubidium
parents: 7202
diff changeset
   201
				SPR_BOUGHT_LAND, PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)),
7601
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7582
diff changeset
   202
				ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, BB_HEIGHT_UNDER_BRIDGE, GetSlopeZ(ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
			);
5385
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4848
diff changeset
   204
			DrawBridgeMiddle(ti);
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   205
			break;
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   206
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   207
		default: {
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   208
			assert(IsCompanyHQ(ti->tile));
7335
141c6b86ec1f (svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium
parents: 7333
diff changeset
   209
			if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   210
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   211
			SpriteID palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   212
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   213
			const DrawTileSprites *t = &_unmovable_display_datas[GetCompanyHQSection(ti->tile)];
8571
53c94d717e99 (svn r12149) -Codechange: Merge 'ground_sprite' and 'ground_pal' of DrawTileSprites into one PalSpriteID
frosch
parents: 8570
diff changeset
   214
			DrawGroundSprite(t->ground.sprite, palette);
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   215
8806
4fe163e0b52a (svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents: 8785
diff changeset
   216
			if (IsInvisibilitySet(TO_STRUCTURES)) break;
4fe163e0b52a (svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents: 8785
diff changeset
   217
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   218
			const DrawTileSeqStruct *dtss;
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   219
			foreach_draw_tile_seq(dtss, t->seq) {
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   220
				AddSortableSpriteToDraw(
8570
f50de4804ff1 (svn r12148) -Codechange: Merge 'image' and 'pal' of DrawTileSeqStruct into one PalSpriteID
frosch
parents: 8468
diff changeset
   221
					dtss->image.sprite, palette,
4230
f4e93251e2f6 (svn r5787) Rename width, height and unk of struct DrawTileSeqStruct to size_{x,y,z}
tron
parents: 4083
diff changeset
   222
					ti->x + dtss->delta_x, ti->y + dtss->delta_y,
f4e93251e2f6 (svn r5787) Rename width, height and unk of struct DrawTileSeqStruct to size_{x,y,z}
tron
parents: 4083
diff changeset
   223
					dtss->size_x, dtss->size_y,
7333
e48228e44be8 (svn r10696) -Codechange: remove duplication of the "make sprite transparent" code.
rubidium
parents: 7202
diff changeset
   224
					dtss->size_z, ti->z + dtss->delta_z,
7849
0a1c0af2c96c (svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents: 7795
diff changeset
   225
					IsTransparencySet(TO_STRUCTURES)
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   226
				);
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   227
			}
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   228
			break;
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4060
diff changeset
   229
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   230
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   231
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   232
4231
2823b3643862 (svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents: 4230
diff changeset
   233
static uint GetSlopeZ_Unmovable(TileIndex tile, uint x, uint y)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
{
4231
2823b3643862 (svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents: 4230
diff changeset
   235
	if (IsOwnedLand(tile)) {
2823b3643862 (svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents: 4230
diff changeset
   236
		uint z;
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5584
diff changeset
   237
		Slope tileh = GetTileSlope(tile, &z);
4231
2823b3643862 (svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents: 4230
diff changeset
   238
2823b3643862 (svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents: 4230
diff changeset
   239
		return z + GetPartialZ(x & 0xF, y & 0xF, tileh);
3282
d026008a8f7c (svn r3996) -Fix: Slope and height information returned for some tile types is wrong
tron
parents: 3183
diff changeset
   240
	} else {
4231
2823b3643862 (svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents: 4230
diff changeset
   241
		return GetTileMaxZ(tile);
3282
d026008a8f7c (svn r3996) -Fix: Slope and height information returned for some tile types is wrong
tron
parents: 3183
diff changeset
   242
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   243
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   244
7335
141c6b86ec1f (svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium
parents: 7333
diff changeset
   245
static Foundation GetFoundation_Unmovable(TileIndex tile, Slope tileh)
39
d177340ed556 (svn r40) Final slope graphics fix
dominik
parents: 0
diff changeset
   246
{
7335
141c6b86ec1f (svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium
parents: 7333
diff changeset
   247
	return IsOwnedLand(tile) ? FOUNDATION_NONE : FlatteningFoundation(tileh);
39
d177340ed556 (svn r40) Final slope graphics fix
dominik
parents: 0
diff changeset
   248
}
d177340ed556 (svn r40) Final slope graphics fix
dominik
parents: 0
diff changeset
   249
6943
1914f26aee04 (svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents: 6720
diff changeset
   250
static CommandCost ClearTile_Unmovable(TileIndex tile, byte flags)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   251
{
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   252
	if (IsCompanyHQ(tile)) {
4060
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
   253
		if (_current_player == OWNER_WATER) {
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
   254
			return DestroyCompanyHQ(GetTileOwner(tile), DC_EXEC);
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
   255
		} else {
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
   256
			return_cmd_error(STR_5804_COMPANY_HEADQUARTERS_IN);
376824550cef (svn r5348) -Fix: A HQ could only be flooded at its northern tile, the other 3 were immune to water
tron
parents: 3657
diff changeset
   257
		}
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   258
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
3310
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   260
	if (IsOwnedLand(tile)) {
3491
35d747bb5e82 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents: 3427
diff changeset
   261
		return DoCommand(tile, 0, 0, flags, CMD_SELL_LAND_AREA);
3310
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   262
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   263
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   264
	/* checks if you're allowed to remove unmovable things */
149
5f7d4b21df01 (svn r150) -Fix: [1010833] Turning on the magic bulldozer removes oil rigs
darkvater
parents: 147
diff changeset
   265
	if (_game_mode != GM_EDITOR && _current_player != OWNER_WATER && ((flags & DC_AUTO || !_cheats.magic_bulldozer.value)) )
5f7d4b21df01 (svn r150) -Fix: [1010833] Turning on the magic bulldozer removes oil rigs
darkvater
parents: 147
diff changeset
   266
		return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   267
6257
5e5a864cacf6 (svn r9066) -Fix [FS#638]: store the owner of a statue, so when it gets removed, the town is notified of it
truelight
parents: 6247
diff changeset
   268
	if (IsStatue(tile)) {
8461
126aeb3ebd1d (svn r12031) -Fix [FS#1689,FS#1719]: Prevent towns from removing or claiming ownership of player owned tiles when growing.
peter1138
parents: 8264
diff changeset
   269
		if (flags & DC_AUTO) return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);
126aeb3ebd1d (svn r12031) -Fix [FS#1689,FS#1719]: Prevent towns from removing or claiming ownership of player owned tiles when growing.
peter1138
parents: 8264
diff changeset
   270
6257
5e5a864cacf6 (svn r9066) -Fix [FS#638]: store the owner of a statue, so when it gets removed, the town is notified of it
truelight
parents: 6247
diff changeset
   271
		TownID town = GetStatueTownID(tile);
8462
3641e3510d48 (svn r12032) -Fix: When removing a statue, remove town statue flag for the statue owner, not current player.
peter1138
parents: 8461
diff changeset
   272
		ClrBit(GetTown(town)->statues, GetTileOwner(tile));
6257
5e5a864cacf6 (svn r9066) -Fix [FS#638]: store the owner of a statue, so when it gets removed, the town is notified of it
truelight
parents: 6247
diff changeset
   273
		InvalidateWindow(WC_TOWN_AUTHORITY, town);
5e5a864cacf6 (svn r9066) -Fix [FS#638]: store the owner of a statue, so when it gets removed, the town is notified of it
truelight
parents: 6247
diff changeset
   274
	}
5e5a864cacf6 (svn r9066) -Fix [FS#638]: store the owner of a statue, so when it gets removed, the town is notified of it
truelight
parents: 6247
diff changeset
   275
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   276
	if (flags & DC_EXEC) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   277
		DoClearSquare(tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   278
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   279
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   280
	return CommandCost();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   281
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   282
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1962
diff changeset
   283
static void GetAcceptedCargo_Unmovable(TileIndex tile, AcceptedCargo ac)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   284
{
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   285
	if (!IsCompanyHQ(tile)) return;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   286
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   287
	/* HQ accepts passenger and mail; but we have to divide the values
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   288
	 * between 4 tiles it occupies! */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   289
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   290
	/* HQ level (depends on company performance) in the range 1..5. */
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   291
	uint level = GetCompanyHQSize(tile) + 1;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   292
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   293
	/* Top town building generates 10, so to make HQ interesting, the top
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   294
	 * type makes 20. */
5601
d58f82901b2f (svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
celestar
parents: 5587
diff changeset
   295
	ac[CT_PASSENGERS] = max(1U, level);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   296
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   297
	/* Top town building generates 4, HQ can make up to 8. The
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   298
	 * proportion passengers:mail is different because such a huge
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   299
	 * commercial building generates unusually high amount of mail
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   300
	 * correspondence per physical visitor. */
5601
d58f82901b2f (svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
celestar
parents: 5587
diff changeset
   301
	ac[CT_MAIL] = max(1U, level / 2);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   302
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   303
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   304
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1962
diff changeset
   305
static void GetTileDesc_Unmovable(TileIndex tile, TileDesc *td)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   306
{
3310
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   307
	switch (GetUnmovableType(tile)) {
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   308
		case UNMOVABLE_TRANSMITTER: td->str = STR_5801_TRANSMITTER; break;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   309
		case UNMOVABLE_LIGHTHOUSE:  td->str = STR_5802_LIGHTHOUSE; break;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   310
		case UNMOVABLE_STATUE:      td->str = STR_2016_STATUE; break;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   311
		case UNMOVABLE_OWNED_LAND:  td->str = STR_5805_COMPANY_OWNED_LAND; break;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   312
		default:                    td->str = STR_5803_COMPANY_HEADQUARTERS; break;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   313
	}
1901
03bf9bf99319 (svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents: 1891
diff changeset
   314
	td->owner = GetTileOwner(tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   315
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   316
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1962
diff changeset
   317
static void AnimateTile_Unmovable(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   318
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   319
	/* not used */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   320
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   321
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1962
diff changeset
   322
static void TileLoop_Unmovable(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   323
{
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   324
	if (!IsCompanyHQ(tile)) return;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   325
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   326
	/* HQ accepts passenger and mail; but we have to divide the values
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   327
	 * between 4 tiles it occupies! */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   328
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   329
	/* HQ level (depends on company performance) in the range 1..5. */
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   330
	uint level = GetCompanyHQSize(tile) + 1;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   331
	assert(level < 6);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   332
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   333
	uint r = Random();
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   334
	/* Top town buildings generate 250, so the top HQ type makes 256. */
2150
f710b959b1c4 (svn r2660) Get rid of some more shifting/anding/casting
tron
parents: 2148
diff changeset
   335
	if (GB(r, 0, 8) < (256 / 4 / (6 - level))) {
f710b959b1c4 (svn r2660) Get rid of some more shifting/anding/casting
tron
parents: 2148
diff changeset
   336
		uint amt = GB(r, 0, 8) / 8 / 4 + 1;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   337
		if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   338
		MoveGoodsToStation(tile, 2, 2, CT_PASSENGERS, amt);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   339
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   340
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   341
	/* Top town building generates 90, HQ can make up to 196. The
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   342
	 * proportion passengers:mail is about the same as in the acceptance
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6357
diff changeset
   343
	 * equations. */
2150
f710b959b1c4 (svn r2660) Get rid of some more shifting/anding/casting
tron
parents: 2148
diff changeset
   344
	if (GB(r, 8, 8) < (196 / 4 / (6 - level))) {
f710b959b1c4 (svn r2660) Get rid of some more shifting/anding/casting
tron
parents: 2148
diff changeset
   345
		uint amt = GB(r, 8, 8) / 8 / 4 + 1;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   346
		if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   347
		MoveGoodsToStation(tile, 2, 2, CT_MAIL, amt);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   348
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   349
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   350
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   351
8616
fd862a55c47f (svn r12199) -Codechange: Remove magic around the results of GetTileTrackStatus().
frosch
parents: 8596
diff changeset
   352
static TrackStatus GetTileTrackStatus_Unmovable(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   353
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   354
	return 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   355
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   356
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1962
diff changeset
   357
static void ClickTile_Unmovable(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   358
{
3427
3a512f7b7f6a (svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
celestar
parents: 3422
diff changeset
   359
	if (IsCompanyHQ(tile)) ShowPlayerCompany(GetTileOwner(tile));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   360
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   361
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   362
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   363
/* checks, if a radio tower is within a 9x9 tile square around tile */
4083
09ca2e8a41ea (svn r5398) Rename checkRadioTowerNearby() to IsRadioTowerNearby() and flip its return value to make it a bit less ambiguous
tron
parents: 4077
diff changeset
   364
static bool IsRadioTowerNearby(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   365
{
1981
3c9c682f1212 (svn r2487) Replace TILE_XY by TileXY/TileDiffXY
tron
parents: 1980
diff changeset
   366
	TileIndex tile_s = tile - TileDiffXY(4, 4);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   367
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   368
	BEGIN_TILE_LOOP(tile, 9, 9, tile_s)
4083
09ca2e8a41ea (svn r5398) Rename checkRadioTowerNearby() to IsRadioTowerNearby() and flip its return value to make it a bit less ambiguous
tron
parents: 4077
diff changeset
   369
		if (IsTransmitterTile(tile)) return true;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   370
	END_TILE_LOOP(tile, 9, 9, tile_s)
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
   371
4083
09ca2e8a41ea (svn r5398) Rename checkRadioTowerNearby() to IsRadioTowerNearby() and flip its return value to make it a bit less ambiguous
tron
parents: 4077
diff changeset
   372
	return false;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   373
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   374
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6160
diff changeset
   375
void GenerateUnmovables()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   376
{
6357
f0f5e7d1713c (svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents: 6258
diff changeset
   377
	if (_opt.landscape == LT_TOYLAND) return;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   378
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   379
	/* add radio tower */
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   380
	int radiotowser_to_build = ScaleByMapSize(15); // maximum number of radio towers on the map
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   381
	int lighthouses_to_build = _opt.landscape == LT_TROPIC ? 0 : ScaleByMapSize1D((Random() & 3) + 7);
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   382
	SetGeneratingWorldProgress(GWP_UNMOVABLE, radiotowser_to_build + lighthouses_to_build);
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
   383
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   384
	for (uint i = ScaleByMapSize(1000); i != 0; i--) {
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   385
		TileIndex tile = RandomTile();
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   386
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   387
		uint h;
7202
dc312a87f450 (svn r10480) -Fix: Don't allow building lighthouses and transmitters under bridges in the scenario editor, or during world generation.
maedhros
parents: 6953
diff changeset
   388
		if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == SLOPE_FLAT && h >= TILE_HEIGHT * 4 && !IsBridgeAbove(tile)) {
4083
09ca2e8a41ea (svn r5398) Rename checkRadioTowerNearby() to IsRadioTowerNearby() and flip its return value to make it a bit less ambiguous
tron
parents: 4077
diff changeset
   389
			if (IsRadioTowerNearby(tile)) continue;
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   390
3310
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents: 3282
diff changeset
   391
			MakeTransmitter(tile);
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
   392
			IncreaseGeneratingWorldProgress(GWP_UNMOVABLE);
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   393
			if (--radiotowser_to_build == 0) break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   394
		}
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   395
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   396
6357
f0f5e7d1713c (svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents: 6258
diff changeset
   397
	if (_opt.landscape == LT_TROPIC) return;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   398
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   399
	/* add lighthouses */
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   400
	uint maxx = MapMaxX();
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   401
	uint maxy = MapMaxY();
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   402
	for (int loop_count = 0; loop_count < 1000 && lighthouses_to_build != 0; loop_count++) {
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   403
		uint r = Random();
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
   404
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
   405
		/* Scatter the lighthouses more evenly around the perimeter */
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   406
		int perimeter = (GB(r, 16, 16) % (2 * (maxx + maxy))) - maxy;
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   407
		DiagDirection dir;
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
   408
		for (dir = DIAGDIR_NE; perimeter > 0; dir++) {
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
   409
			perimeter -= (DiagDirToAxis(dir) == AXIS_X) ? maxx : maxy;
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
   410
		}
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4231
diff changeset
   411
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   412
		TileIndex tile;
3164
3b7658159a12 (svn r3791) Replace home grown direction handling for placing lighthouses by standard DiagDir
tron
parents: 3017
diff changeset
   413
		switch (dir) {
3b7658159a12 (svn r3791) Replace home grown direction handling for placing lighthouses by standard DiagDir
tron
parents: 3017
diff changeset
   414
			default:
3b7658159a12 (svn r3791) Replace home grown direction handling for placing lighthouses by standard DiagDir
tron
parents: 3017
diff changeset
   415
			case DIAGDIR_NE: tile = TileXY(maxx,     r % maxy); break;
3b7658159a12 (svn r3791) Replace home grown direction handling for placing lighthouses by standard DiagDir
tron
parents: 3017
diff changeset
   416
			case DIAGDIR_SE: tile = TileXY(r % maxx, 0);        break;
3b7658159a12 (svn r3791) Replace home grown direction handling for placing lighthouses by standard DiagDir
tron
parents: 3017
diff changeset
   417
			case DIAGDIR_SW: tile = TileXY(0,        r % maxy); break;
3b7658159a12 (svn r3791) Replace home grown direction handling for placing lighthouses by standard DiagDir
tron
parents: 3017
diff changeset
   418
			case DIAGDIR_NW: tile = TileXY(r % maxx, maxy);     break;
3b7658159a12 (svn r3791) Replace home grown direction handling for placing lighthouses by standard DiagDir
tron
parents: 3017
diff changeset
   419
		}
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   420
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   421
		for (int j = 0; j < 20; j++) {
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   422
			uint h;
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   423
			if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == SLOPE_FLAT && h <= TILE_HEIGHT * 2 && !IsBridgeAbove(tile)) {
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   424
				MakeLighthouse(tile);
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   425
				IncreaseGeneratingWorldProgress(GWP_UNMOVABLE);
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   426
				lighthouses_to_build--;
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   427
				assert(tile == TILE_MASK(tile));
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   428
				break;
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   429
			}
4559
aa0c13e39840 (svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents: 4300
diff changeset
   430
			tile = TILE_MASK(tile + TileOffsByDiagDir(dir));
9056
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   431
		}
3eaa69a933c5 (svn r12898) -Codechange: coding style in unmovable_cmd.cpp.
rubidium
parents: 8969
diff changeset
   432
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   433
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   434
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2186
diff changeset
   435
static void ChangeTileOwner_Unmovable(TileIndex tile, PlayerID old_player, PlayerID new_player)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   436
{
1901
03bf9bf99319 (svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents: 1891
diff changeset
   437
	if (!IsTileOwner(tile, old_player)) return;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   438
4848
45f848b46222 (svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents: 4559
diff changeset
   439
	if (IsOwnedLand(tile) && new_player != PLAYER_SPECTATOR) {
1902
86b7fb11f938 (svn r2408) Introduce SetTileOwner() and use it
tron
parents: 1901
diff changeset
   440
		SetTileOwner(tile, new_player);
8468
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   441
	} else if (IsStatueTile(tile)) {
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   442
		TownID town = GetStatueTownID(tile);
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   443
		Town *t = GetTown(town);
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   444
		ClrBit(t->statues, old_player);
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   445
		if (new_player != PLAYER_SPECTATOR && !HasBit(t->statues, new_player)) {
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   446
			/* Transfer ownership to the new company */
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   447
			SetBit(t->statues, new_player);
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   448
			SetTileOwner(tile, new_player);
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   449
		} else {
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   450
			DoClearSquare(tile);
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   451
		}
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   452
c21aff50e6f5 (svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
peter1138
parents: 8462
diff changeset
   453
		InvalidateWindow(WC_TOWN_AUTHORITY, town);
2026
567e3bc9af72 (svn r2535) Tabs
tron
parents: 1981
diff changeset
   454
	} else {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   455
		DoClearSquare(tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   456
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   457
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   458
7494
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7335
diff changeset
   459
static CommandCost TerraformTile_Unmovable(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7335
diff changeset
   460
{
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7335
diff changeset
   461
	/* Owned land remains unsold */
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7335
diff changeset
   462
	if (IsOwnedLand(tile) && CheckTileOwnership(tile)) return CommandCost();
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7335
diff changeset
   463
7582
80c8517b08d1 (svn r11107) -Feature: some tool so one can still build tunnels under rails (and other structures) when the owner of the structure built it on foundations and if you have enough "empty" space ofcourse. One could use the tool for some other construction needs too. Patch by frosch.
rubidium
parents: 7549
diff changeset
   464
	if (AutoslopeEnabled() && (IsStatue(tile) || IsCompanyHQ(tile))) {
8230
64f28fe2d5c8 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium
parents: 8224
diff changeset
   465
		if (!IsSteepSlope(tileh_new) && (z_new + GetSlopeMaxZ(tileh_new) == GetTileMaxZ(tile))) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
7582
80c8517b08d1 (svn r11107) -Feature: some tool so one can still build tunnels under rails (and other structures) when the owner of the structure built it on foundations and if you have enough "empty" space ofcourse. One could use the tool for some other construction needs too. Patch by frosch.
rubidium
parents: 7549
diff changeset
   466
	}
80c8517b08d1 (svn r11107) -Feature: some tool so one can still build tunnels under rails (and other structures) when the owner of the structure built it on foundations and if you have enough "empty" space ofcourse. One could use the tool for some other construction needs too. Patch by frosch.
rubidium
parents: 7549
diff changeset
   467
7494
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7335
diff changeset
   468
	return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7335
diff changeset
   469
}
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7335
diff changeset
   470
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5584
diff changeset
   471
extern const TileTypeProcs _tile_type_unmovable_procs = {
1493
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   472
	DrawTile_Unmovable,             /* draw_tile_proc */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   473
	GetSlopeZ_Unmovable,            /* get_slope_z_proc */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   474
	ClearTile_Unmovable,            /* clear_tile_proc */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   475
	GetAcceptedCargo_Unmovable,     /* get_accepted_cargo_proc */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   476
	GetTileDesc_Unmovable,          /* get_tile_desc_proc */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   477
	GetTileTrackStatus_Unmovable,   /* get_tile_track_status_proc */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   478
	ClickTile_Unmovable,            /* click_tile_proc */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   479
	AnimateTile_Unmovable,          /* animate_tile_proc */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   480
	TileLoop_Unmovable,             /* tile_loop_clear */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   481
	ChangeTileOwner_Unmovable,      /* change_tile_owner_clear */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   482
	NULL,                           /* get_produced_cargo_proc */
414b3608df4d (svn r1997) Fixed errorneous tab expansion on the indentation side which happenned in r1993. Pointed out by Tron.
pasky
parents: 1489
diff changeset
   483
	NULL,                           /* vehicle_enter_tile_proc */
7335
141c6b86ec1f (svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium
parents: 7333
diff changeset
   484
	GetFoundation_Unmovable,        /* get_foundation_proc */
7494
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7335
diff changeset
   485
	TerraformTile_Unmovable,        /* terraform_tile_proc */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   486
};