(svn r4193) -Codechange: Add and make use of an accessor function to create company HQs
authorcelestar
Fri, 31 Mar 2006 08:44:53 +0000
changeset 3385 18e4ca6d3ef4
parent 3384 486b8091f166
child 3386 6d088afdabf4
(svn r4193) -Codechange: Add and make use of an accessor function to create company HQs
unmovable_cmd.c
unmovable_map.h
--- a/unmovable_cmd.c	Fri Mar 31 08:39:10 2006 +0000
+++ b/unmovable_cmd.c	Fri Mar 31 08:44:53 2006 +0000
@@ -89,10 +89,8 @@
 
 		p->location_of_house = tile;
 
-		ModifyTile(tile + TileDiffXY(0, 0), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x80);
-		ModifyTile(tile + TileDiffXY(0, 1), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x81);
-		ModifyTile(tile + TileDiffXY(1, 0), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x82);
-		ModifyTile(tile + TileDiffXY(1, 1), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x83);
+		MakeCompanyHQ(tile, _current_player);
+
 		UpdatePlayerHouse(p, score);
 		InvalidateWindow(WC_COMPANY, p->index);
 	}
--- a/unmovable_map.h	Fri Mar 31 08:39:10 2006 +0000
+++ b/unmovable_map.h	Fri Mar 31 08:44:53 2006 +0000
@@ -4,7 +4,11 @@
 	UNMOVABLE_TRANSMITTER = 0,
 	UNMOVABLE_LIGHTHOUSE  = 1,
 	UNMOVABLE_STATUE      = 2,
-	UNMOVABLE_OWNED_LAND  = 3
+	UNMOVABLE_OWNED_LAND  = 3,
+	UNMOVABLE_HQ_NORTH    = 0x80,
+	UNMOVABLE_HQ_WEST     = 0x81,
+	UNMOVABLE_HQ_EAST     = 0x82,
+	UNMOVABLE_HQ_SOUTH    = 0x83,
 } UnmovableType;
 
 
@@ -65,3 +69,12 @@
 {
 	MakeUnmovable(t, UNMOVABLE_OWNED_LAND, o);
 }
+
+static inline void MakeCompanyHQ(TileIndex t, Owner o)
+{
+	MakeUnmovable(t + TileDiffXY(0, 0), UNMOVABLE_HQ_NORTH, o);
+	MakeUnmovable(t + TileDiffXY(0, 1), UNMOVABLE_HQ_WEST, o);
+	MakeUnmovable(t + TileDiffXY(1, 0), UNMOVABLE_HQ_EAST, o);
+	MakeUnmovable(t + TileDiffXY(1, 1), UNMOVABLE_HQ_SOUTH, o);
+}
+