(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
authorDarkvater
Sat, 14 Oct 2006 15:49:43 +0000
changeset 4848 45f848b46222
parent 4847 84e4a64db23c
child 4849 1c6f21eb97f2
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
put it into player.h where it belongs (instead of map.h)
ai/ai.c
airport_gui.c
command.c
dock_gui.c
economy.c
engine.c
genworld.c
industry_gui.c
main_gui.c
map.h
network.c
network_client.c
network_gui.c
network_server.c
openttd.c
player.h
player_gui.c
players.c
rail_cmd.c
rail_gui.c
road_cmd.c
road_gui.c
screenshot.c
station_cmd.c
terraform_gui.c
town_gui.c
tunnelbridge_cmd.c
unmovable_cmd.c
video/dedicated_v.c
water_cmd.c
--- a/ai/ai.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/ai/ai.c	Sat Oct 14 15:49:43 2006 +0000
@@ -225,7 +225,7 @@
 void AI_PlayerDied(PlayerID player)
 {
 	if (_ai.network_client && _ai.network_playas == player) {
-		_ai.network_playas = OWNER_SPECTATOR;
+		_ai.network_playas = PLAYER_SPECTATOR;
 	}
 
 	/* Called if this AI died */
@@ -246,7 +246,7 @@
 	memset(&_ai_player, 0, sizeof(_ai_player));
 
 	_ai.network_client = ai_network_client;
-	_ai.network_playas = OWNER_SPECTATOR;
+	_ai.network_playas = PLAYER_SPECTATOR;
 	_ai.enabled = true;
 }
 
--- a/airport_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/airport_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -133,7 +133,7 @@
 
 void ShowBuildAirToolbar(void)
 {
-	if (_current_player == OWNER_SPECTATOR) return;
+	if (_current_player == PLAYER_SPECTATOR) return;
 	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
 	AllocateWindowDescFront(&_air_toolbar_desc, 0);
 	if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
--- a/command.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/command.c	Sat Oct 14 15:49:43 2006 +0000
@@ -426,7 +426,7 @@
 
 	/** Spectator has no rights except for the dedicated server which
 	 * is a spectator but is the server, so can do anything */
-	if (_current_player == OWNER_SPECTATOR && !_network_dedicated) {
+	if (_current_player == PLAYER_SPECTATOR && !_network_dedicated) {
 		ShowErrorMessage(_error_message, error_part1, x, y);
 		_cmd_text = NULL;
 		return false;
@@ -500,7 +500,7 @@
 	if (_networking && !(cmd & CMD_NETWORK_COMMAND)) {
 		if (_network_dedicated) _local_player = 0;
 		NetworkSend_Command(tile, p1, p2, cmd, callback);
-		if (_network_dedicated) _local_player = OWNER_SPECTATOR;
+		if (_network_dedicated) _local_player = PLAYER_SPECTATOR;
 		_docommand_recursive = 0;
 		_cmd_text = NULL;
 		return true;
--- a/dock_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/dock_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -214,7 +214,7 @@
 
 void ShowBuildDocksToolbar(void)
 {
-	if (_current_player == OWNER_SPECTATOR) return;
+	if (_current_player == PLAYER_SPECTATOR) return;
 	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
 	AllocateWindowDesc(&_build_docks_toolbar_desc);
 	if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
--- a/economy.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/economy.c	Sat Oct 14 15:49:43 2006 +0000
@@ -240,7 +240,7 @@
 	return score;
 }
 
-// use OWNER_SPECTATOR as new_player to delete the player.
+// use PLAYER_SPECTATOR as new_player to delete the player.
 void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
 {
 	PlayerID old = _current_player;
@@ -249,12 +249,12 @@
 	/* Temporarily increase the player's money, to be sure that
 	 * removing his/her property doesn't fail because of lack of money.
 	 * Not too drastically though, because it could overflow */
-	if (new_player == OWNER_SPECTATOR) {
+	if (new_player == PLAYER_SPECTATOR) {
 		GetPlayer(old_player)->money64 = MAX_UVALUE(uint64) >>2; // jackpot ;p
 		UpdatePlayerMoney32(GetPlayer(old_player));
 	}
 
-	if (new_player == OWNER_SPECTATOR) {
+	if (new_player == PLAYER_SPECTATOR) {
 		Subsidy *s;
 
 		for (s = _subsidies; s != endof(_subsidies); s++) {
@@ -265,7 +265,7 @@
 	}
 
 	/* Take care of rating in towns */
-	if (new_player != OWNER_SPECTATOR) {
+	if (new_player != PLAYER_SPECTATOR) {
 		Town *t;
 		FOR_ALL_TOWNS(t) {
 			/* If a player takes over, give the ratings to that player. */
@@ -306,7 +306,7 @@
 
 		FOR_ALL_VEHICLES(v) {
 			if (v->owner == old_player && IS_BYTE_INSIDE(v->type, VEH_Train, VEH_Aircraft + 1)) {
-				if (new_player == OWNER_SPECTATOR) {
+				if (new_player == PLAYER_SPECTATOR) {
 					DeleteWindowById(WC_VEHICLE_VIEW, v->index);
 					DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
 					DeleteWindowById(WC_VEHICLE_ORDERS, v->index);
@@ -334,7 +334,7 @@
 	}
 
 	// Change color of existing windows
-	if (new_player != OWNER_SPECTATOR) {
+	if (new_player != PLAYER_SPECTATOR) {
 		Window *w;
 		for (w = _windows; w != _last_window; w++) {
 			if (w->caption_color == old_player) w->caption_color = new_player;
@@ -350,14 +350,14 @@
 			for (i = 0; i < 4; i++) {
 				/* 'Sell' the share if this player has any */
 				if (p->share_owners[i] == _current_player) {
-					p->share_owners[i] = OWNER_SPECTATOR;
+					p->share_owners[i] = PLAYER_SPECTATOR;
 				}
 			}
 		}
 		p = GetPlayer(_current_player);
 		/* Sell all the shares that people have on this company */
 		for (i = 0; i < 4; i++)
-			p->share_owners[i] = OWNER_SPECTATOR;
+			p->share_owners[i] = PLAYER_SPECTATOR;
 	}
 
 	_current_player = old;
@@ -429,7 +429,7 @@
 					FOR_ALL_CLIENTS(cs) {
 						ci = DEREF_CLIENT_INFO(cs);
 						if ((ci->client_playas-1) == owner) {
-							ci->client_playas = OWNER_SPECTATOR;
+							ci->client_playas = PLAYER_SPECTATOR;
 							// Send the new info to all the clients
 							NetworkUpdateClientInfo(_network_own_client_index);
 						}
@@ -438,12 +438,12 @@
 				// Make sure the player no longer controls the company
 				if (IsHumanPlayer(owner) && owner == _local_player) {
 					// Switch the player to spectator..
-					_local_player = OWNER_SPECTATOR;
+					_local_player = PLAYER_SPECTATOR;
 				}
 #endif /* ENABLE_NETWORK */
 
 				/* Remove the player */
-				ChangeOwnershipOfPlayerItems(owner, OWNER_SPECTATOR);
+				ChangeOwnershipOfPlayerItems(owner, PLAYER_SPECTATOR);
 				// Register the player as not-active
 				p->is_active = false;
 
@@ -1516,7 +1516,7 @@
 
 	value = CalculateCompanyValue(p) >> 2;
 	for (i = 0; i != 4; i++) {
-		if (p->share_owners[i] != OWNER_SPECTATOR) {
+		if (p->share_owners[i] != PLAYER_SPECTATOR) {
 			owner = GetPlayer(p->share_owners[i]);
 			owner->money64 += value;
 			owner->yearly_expenses[0][EXPENSES_OTHER] += value;
@@ -1552,17 +1552,17 @@
 	if (_cur_year - p->inaugurated_year < 6) return_cmd_error(STR_7080_PROTECTED);
 
 	/* Those lines are here for network-protection (clients can be slow) */
-	if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) return 0;
+	if (GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0) return 0;
 
 	/* We can not buy out a real player (temporarily). TODO: well, enable it obviously */
-	if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) return 0;
+	if (GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 1 && !p->is_ai) return 0;
 
 	cost = CalculateCompanyValue(p) >> 2;
 	if (flags & DC_EXEC) {
 		PlayerID* b = p->share_owners;
 		int i;
 
-		while (*b != OWNER_SPECTATOR) b++; /* share owners is guaranteed to contain at least one OWNER_SPECTATOR */
+		while (*b != PLAYER_SPECTATOR) b++; /* share owners is guaranteed to contain at least one PLAYER_SPECTATOR */
 		*b = _current_player;
 
 		for (i = 0; p->share_owners[i] == _current_player;) {
@@ -1603,7 +1603,7 @@
 	if (flags & DC_EXEC) {
 		PlayerID* b = p->share_owners;
 		while (*b != _current_player) b++; /* share owners is guaranteed to contain player */
-		*b = OWNER_SPECTATOR;
+		*b = PLAYER_SPECTATOR;
 		InvalidateWindow(WC_COMPANY, p1);
 	}
 	return cost;
--- a/engine.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/engine.c	Sat Oct 14 15:49:43 2006 +0000
@@ -227,7 +227,7 @@
 
 	do {
 		best_hist = -1;
-		best_player = OWNER_SPECTATOR;
+		best_player = PLAYER_SPECTATOR;
 		FOR_ALL_PLAYERS(p) {
 			if (p->is_active && p->block_preview == 0 && !HASBIT(mask, p->index) &&
 					p->old_economy[0].performance_history > best_hist) {
@@ -236,7 +236,7 @@
 			}
 		}
 
-		if (best_player == OWNER_SPECTATOR) return OWNER_SPECTATOR;
+		if (best_player == PLAYER_SPECTATOR) return PLAYER_SPECTATOR;
 
 		SETBIT(mask, best_player);
 	} while (--pp != 0);
@@ -263,7 +263,7 @@
 			} else if (e->preview_player != 0xFF) {
 				PlayerID best_player = GetBestPlayer(e->preview_player);
 
-				if (best_player == OWNER_SPECTATOR) {
+				if (best_player == PLAYER_SPECTATOR) {
 					e->preview_player = 0xFF;
 					continue;
 				}
--- a/genworld.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/genworld.c	Sat Oct 14 15:49:43 2006 +0000
@@ -235,7 +235,7 @@
 	_gw.threaded      = true;
 
 	/* This disables some commands and stuff */
-	_local_player   = OWNER_SPECTATOR;
+	_local_player   = PLAYER_SPECTATOR;
 	/* Make sure everything is done via OWNER_NONE */
 	_current_player = OWNER_NONE;
 
--- a/industry_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/industry_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -265,7 +265,7 @@
 
 void ShowBuildIndustryWindow(void)
 {
-	if (_current_player == OWNER_SPECTATOR) return;
+	if (_current_player == PLAYER_SPECTATOR) return;
 	AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape],0);
 }
 
--- a/main_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/main_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -736,9 +736,9 @@
 	w = AllocateWindow(x, 0x16, 0xF1, 0x52, PlayerMenuWndProc, WC_TOOLBAR_MENU, _player_menu_widgets);
 	w->flags4 &= ~WF_WHITE_BORDER_MASK;
 	WP(w,menu_d).item_count = 0;
-	WP(w,menu_d).sel_index = (_local_player != OWNER_SPECTATOR) ? _local_player : GetPlayerIndexFromMenu(0);
+	WP(w,menu_d).sel_index = (_local_player != PLAYER_SPECTATOR) ? _local_player : GetPlayerIndexFromMenu(0);
 	if (_networking && main_button == 9) {
-		if (_local_player != OWNER_SPECTATOR) {
+		if (_local_player != PLAYER_SPECTATOR) {
 			WP(w,menu_d).sel_index++;
 		} else {
 			/* Select client list by default for spectators */
@@ -802,7 +802,7 @@
 static void ToolbarIndustryClick(Window *w)
 {
 	/* Disable build-industry menu if we are a spectator */
-	PopupMainToolbMenu(w, 12, STR_INDUSTRY_DIR, 2, (_current_player == OWNER_SPECTATOR) ? (1 << 1) : 0);
+	PopupMainToolbMenu(w, 12, STR_INDUSTRY_DIR, 2, (_current_player == PLAYER_SPECTATOR) ? (1 << 1) : 0);
 }
 
 static void ToolbarTrainClick(Window *w)
@@ -1807,7 +1807,7 @@
 		/* If spectator, disable all construction buttons
 		 * ie : Build road, rail, ships, airports and landscaping
 		 * Since enabled state is the default, just disable when needed */
-		SetWindowWidgetsDisabledState(w, _current_player == OWNER_SPECTATOR, 19, 20, 21, 22, 23, WIDGET_LIST_END);
+		SetWindowWidgetsDisabledState(w, _current_player == PLAYER_SPECTATOR, 19, 20, 21, 22, 23, WIDGET_LIST_END);
 		/* disable company list drop downs, if there are no companies */
 		SetWindowWidgetsDisabledState(w, ActivePlayerCount() == 0, 7, 8, 13, 14, 15, 16, WIDGET_LIST_END);
 
@@ -1820,7 +1820,7 @@
 	} break;
 
 	case WE_KEYPRESS: {
-		PlayerID local = (_local_player != OWNER_SPECTATOR) ? _local_player : 0;
+		PlayerID local = (_local_player != PLAYER_SPECTATOR) ? _local_player : 0;
 
 		switch (e->we.keypress.keycode) {
 		case WKC_F1: case WKC_PAUSE:
@@ -2140,7 +2140,7 @@
 {
 	switch (e->event) {
 	case WE_PAINT: {
-		const Player *p = (_local_player == OWNER_SPECTATOR) ? NULL : GetPlayer(_local_player);
+		const Player *p = (_local_player == PLAYER_SPECTATOR) ? NULL : GetPlayer(_local_player);
 
 		DrawWindowWidgets(w);
 		SetDParam(0, _date);
@@ -2185,7 +2185,7 @@
 	case WE_CLICK:
 		switch (e->we.click.widget) {
 			case 1: ShowLastNewsMessage(); break;
-			case 2: if (_local_player != OWNER_SPECTATOR) ShowPlayerFinances(_local_player); break;
+			case 2: if (_local_player != PLAYER_SPECTATOR) ShowPlayerFinances(_local_player); break;
 			default: ResetObjectToPlace();
 		}
 		break;
--- a/map.h	Sat Oct 14 15:44:28 2006 +0000
+++ b/map.h	Sat Oct 14 15:49:43 2006 +0000
@@ -72,8 +72,6 @@
 	OWNER_NONE      = 0x10, // nobody owns the tile
 	OWNER_WATER     = 0x11, // "water" owns the tile
 	OWNER_END       = 0x12,
-
-	OWNER_SPECTATOR = 0xFF, // spectator in MP or in scenario editor
 } Owner;
 
 enum {
--- a/network.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/network.c	Sat Oct 14 15:49:43 2006 +0000
@@ -108,7 +108,7 @@
 	byte count = 0;
 
 	FOR_ALL_CLIENTS(cs) {
-		if (DEREF_CLIENT_INFO(cs)->client_playas == OWNER_SPECTATOR) count++;
+		if (DEREF_CLIENT_INFO(cs)->client_playas == PLAYER_SPECTATOR) count++;
 	}
 
 	return count;
@@ -1035,7 +1035,7 @@
 
 	ci->client_index = NETWORK_SERVER_INDEX;
 	if (_network_dedicated) {
-		ci->client_playas = OWNER_SPECTATOR;
+		ci->client_playas = PLAYER_SPECTATOR;
 	} else {
 		ci->client_playas = _local_player + 1;
 	}
--- a/network_client.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/network_client.c	Sat Oct 14 15:49:43 2006 +0000
@@ -342,7 +342,7 @@
 
 		/* Are we a ai-network-client? Are we not joining as a SPECTATOR (playas == 0, means SPECTATOR) */
 		if (_ai.network_client && playas != 0) {
-			if (_ai.network_playas == OWNER_SPECTATOR)
+			if (_ai.network_playas == PLAYER_SPECTATOR)
 				AI_StartNewAI(playas - 1);
 
 			_ai.network_playas = playas - 1;
@@ -521,16 +521,16 @@
 		if (_network_playas == 0 || _network_playas > MAX_PLAYERS ||
 				!GetPlayer(_network_playas - 1)->is_active) {
 
-			if (_network_playas == OWNER_SPECTATOR) {
+			if (_network_playas == PLAYER_SPECTATOR) {
 				// The client wants to be a spectator..
-				_local_player = OWNER_SPECTATOR;
+				_local_player = PLAYER_SPECTATOR;
 				DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 			} else {
 				/* We have arrived and ready to start playing; send a command to make a new player;
 				 * the server will give us a client-id and let us in */
 				_local_player = 0;
 				NetworkSend_Command(0, 0, 0, CMD_PLAYER_CTRL, NULL);
-				_local_player = OWNER_SPECTATOR;
+				_local_player = PLAYER_SPECTATOR;
 			}
 		} else {
 			// take control over an existing company
@@ -544,9 +544,9 @@
 		/* Check if we are an ai-network-client, and if so, disable GUI */
 		if (_ai.network_client) {
 			_ai.network_playas = _local_player;
-			_local_player      = OWNER_SPECTATOR;
+			_local_player      = PLAYER_SPECTATOR;
 
-			if (_ai.network_playas != OWNER_SPECTATOR) {
+			if (_ai.network_playas != PLAYER_SPECTATOR) {
 				/* If we didn't join the game as a spectator, activate the AI */
 				AI_StartNewAI(_ai.network_playas);
 			}
@@ -745,7 +745,7 @@
 {
 	// To trottle the reconnects a bit, every clients waits
 	//  his _local_player value before reconnecting
-	// OWNER_SPECTATOR is currently 255, so to avoid long wait periods
+	// PLAYER_SPECTATOR is currently 255, so to avoid long wait periods
 	//  set the max to 10.
 	_network_reconnect = min(_local_player + 1, 10);
 	_switch_mode_errorstr = STR_NETWORK_SERVER_REBOOT;
--- a/network_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/network_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -933,7 +933,7 @@
 			NetworkClientConnectGame(_network_last_host, _network_last_port);
 			break;
 		case 9: /* Spectate game */
-			_network_playas = OWNER_SPECTATOR;
+			_network_playas = PLAYER_SPECTATOR;
 			NetworkClientConnectGame(_network_last_host, _network_last_port);
 			break;
 		case 10: /* Refresh */
--- a/network_server.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/network_server.c	Sat Oct 14 15:49:43 2006 +0000
@@ -602,7 +602,7 @@
 				return;
 			}
 			break;
-		case OWNER_SPECTATOR: /* Spectator */
+		case PLAYER_SPECTATOR: /* Spectator */
 			if (NetworkSpectatorCount() >= _network_game_info.spectators_max) {
 				SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_FULL);
 				return;
--- a/openttd.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/openttd.c	Sat Oct 14 15:49:43 2006 +0000
@@ -586,7 +586,7 @@
 {
 	/* In a dedicated server, the server does not play */
 	if (_network_dedicated) {
-		_local_player = OWNER_SPECTATOR;
+		_local_player = PLAYER_SPECTATOR;
 		return;
 	}
 
@@ -794,7 +794,7 @@
 			/* Delete all players */
 			FOR_ALL_PLAYERS(p) {
 				if (p->is_active) {
-					ChangeOwnershipOfPlayerItems(p->index, OWNER_SPECTATOR);
+					ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
 					p->is_active = false;
 				}
 			}
@@ -874,7 +874,7 @@
 {
 	char buf[200];
 
-	if (_patches.keep_all_autosave && _local_player != OWNER_SPECTATOR) {
+	if (_patches.keep_all_autosave && _local_player != PLAYER_SPECTATOR) {
 		const Player *p = GetPlayer(_local_player);
 		char *s;
 		sprintf(buf, "%s%s", _path.autosave_dir, PATHSEP);
--- a/player.h	Sat Oct 14 15:44:28 2006 +0000
+++ b/player.h	Sat Oct 14 15:49:43 2006 +0000
@@ -211,7 +211,13 @@
 VARDEF PlayerID _local_player;
 VARDEF PlayerID _current_player;
 
-#define MAX_PLAYERS 8
+/* Player identifiers All players below MAX_PLAYERS are playable
+ * players, above, they are special, computer controlled players */
+enum {
+	PLAYER_SPECTATOR   = 255, ///< Spectator in Multiplayer or the player in the scenario editor
+	MAX_PLAYERS        = 8,
+};
+
 VARDEF Player _players[MAX_PLAYERS];
 // NOSAVE: can be determined from player structs
 VARDEF byte _player_colors[MAX_PLAYERS];
--- a/player_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/player_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -693,16 +693,16 @@
 			if (!local) {
 				if (_patches.allow_shares) { // Shares are allowed
 					/* If all shares are owned by someone (none by nobody), disable buy button */
-					SetWindowWidgetDisabledState(w, PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0 ||
+					SetWindowWidgetDisabledState(w, PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0 ||
 							/* Only 25% left to buy. If the player is human, disable buying it up.. TODO issues! */
-							(GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) ||
+							(GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 1 && !p->is_ai) ||
 							/* Spectators cannot do anything of course */
-							_local_player == OWNER_SPECTATOR);
+							_local_player == PLAYER_SPECTATOR);
 
 					/* If the player doesn't own any shares, disable sell button */
 					SetWindowWidgetDisabledState(w, PCW_WIDGET_SELL_SHARE, (GetAmountOwnedBy(p, _local_player) == 0) ||
 							/* Spectators cannot do anything of course */
-							_local_player == OWNER_SPECTATOR);
+							_local_player == PLAYER_SPECTATOR);
 				} else { // Shares are not allowed, disable buy/sell buttons
 					DisableWindowWidget(w, PCW_WIDGET_BUY_SHARE);
 					DisableWindowWidget(w, PCW_WIDGET_SELL_SHARE);
@@ -1105,7 +1105,7 @@
 
 		WP(w, highscore_d).background_img = SPR_TYCOON_IMG1_BEGIN;
 
-		if (_local_player != OWNER_SPECTATOR) {
+		if (_local_player != PLAYER_SPECTATOR) {
 			const Player *p = GetPlayer(_local_player);
 			if (p->old_economy[0].performance_history == SCORE_MAX)
 				WP(w, highscore_d).background_img = SPR_TYCOON_IMG2_BEGIN;
--- a/players.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/players.c	Sat Oct 14 15:49:43 2006 +0000
@@ -33,7 +33,7 @@
 	/* Get the color for DrawString-subroutines which matches the color of the
 	 * player
 	 */
-	if (player == OWNER_SPECTATOR || player == OWNER_SPECTATOR - 1) return 1;
+	if (player == PLAYER_SPECTATOR || player == PLAYER_SPECTATOR - 1) return 1;
 	return (_colour_gradient[_player_colors[player]][4]) | IS_PALETTE_COLOR;
 }
 
@@ -498,7 +498,7 @@
 
 	p->is_ai = is_ai;
 	p->ai.state = 5; /* AIS_WANT_NEW_ROUTE */
-	p->share_owners[0] = p->share_owners[1] = p->share_owners[2] = p->share_owners[3] = OWNER_SPECTATOR;
+	p->share_owners[0] = p->share_owners[1] = p->share_owners[2] = p->share_owners[3] = PLAYER_SPECTATOR;
 
 	p->avail_railtypes = GetPlayerRailtypes(p->index);
 	p->inaugurated_year = _cur_year;
@@ -606,7 +606,7 @@
 		}
 	}
 
-	if (_patches.show_finances && _local_player != OWNER_SPECTATOR) {
+	if (_patches.show_finances && _local_player != PLAYER_SPECTATOR) {
 		ShowPlayerFinances(_local_player);
 		p = GetPlayer(_local_player);
 		if (p->num_valid_stat_ent > 5 && p->old_economy[0].performance_history < p->old_economy[4].performance_history) {
@@ -829,25 +829,25 @@
 		p = DoStartupNewPlayer(false);
 
 #ifdef ENABLE_NETWORK
-		if (_networking && !_network_server && _local_player == OWNER_SPECTATOR) {
+		if (_networking && !_network_server && _local_player == PLAYER_SPECTATOR) {
 			/* In case we are a client joining a server... */
 			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 		}
 #endif /* ENABLE_NETWORK */
 
 		if (p != NULL) {
-			if (_local_player == OWNER_SPECTATOR &&
-					(!_ai.network_client || _ai.network_playas == OWNER_SPECTATOR)) {
+			if (_local_player == PLAYER_SPECTATOR &&
+					(!_ai.network_client || _ai.network_playas == PLAYER_SPECTATOR)) {
 				/* Check if we do not want to be a spectator in network */
 				if (!_networking ||
 						(_network_server && !_network_dedicated) ||
-						_network_playas != OWNER_SPECTATOR ||
+						_network_playas != PLAYER_SPECTATOR ||
 						_ai.network_client) {
 					if (_ai.network_client) {
 						/* As ai-network-client, we have our own rulez (disable GUI and stuff) */
 						_ai.network_playas = p->index;
-						_local_player      = OWNER_SPECTATOR;
-						if (_ai.network_playas != OWNER_SPECTATOR) {
+						_local_player      = PLAYER_SPECTATOR;
+						if (_ai.network_playas != PLAYER_SPECTATOR) {
 							/* If we didn't join the game as a spectator, activate the AI */
 							AI_StartNewAI(_ai.network_playas);
 						}
@@ -895,7 +895,7 @@
 			 * server-side in network_server.c:838, function
 			 * DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) */
 			NetworkClientInfo *ci = &_network_client_info[pid];
-			ci->client_playas = OWNER_SPECTATOR;
+			ci->client_playas = PLAYER_SPECTATOR;
 			NetworkUpdateClientInfo(ci->client_index);
 #endif /* ENABLE_NETWORK */
 		}
@@ -927,7 +927,7 @@
 			AddNewsItem( (StringID)(p->index + 16*3), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
 
 			/* Remove the company */
-			ChangeOwnershipOfPlayerItems(p->index, OWNER_SPECTATOR);
+			ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
 			p->is_active = false;
 		}
 		RemoveAllEngineReplacementForPlayer(p);
--- a/rail_cmd.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/rail_cmd.c	Sat Oct 14 15:49:43 2006 +0000
@@ -1952,7 +1952,7 @@
 {
 	if (!IsTileOwner(tile, old_player)) return;
 
-	if (new_player != OWNER_SPECTATOR) {
+	if (new_player != PLAYER_SPECTATOR) {
 		SetTileOwner(tile, new_player);
 	} else {
 		DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
--- a/rail_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/rail_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -589,7 +589,7 @@
 {
 	Window *w;
 
-	if (_current_player == OWNER_SPECTATOR) return;
+	if (_current_player == PLAYER_SPECTATOR) return;
 	if (!ValParamRailtype(railtype)) return;
 
 	// don't recreate the window if we're clicking on a button and the window exists.
--- a/road_cmd.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/road_cmd.c	Sat Oct 14 15:49:43 2006 +0000
@@ -1069,12 +1069,12 @@
 static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID new_player)
 {
 	if (IsLevelCrossing(tile) && GetCrossingRoadOwner(tile) == old_player) {
-		SetCrossingRoadOwner(tile, new_player == OWNER_SPECTATOR ? OWNER_NONE : new_player);
+		SetCrossingRoadOwner(tile, new_player == PLAYER_SPECTATOR ? OWNER_NONE : new_player);
 	}
 
 	if (!IsTileOwner(tile, old_player)) return;
 
-	if (new_player != OWNER_SPECTATOR) {
+	if (new_player != PLAYER_SPECTATOR) {
 		SetTileOwner(tile, new_player);
 	} else {
 		switch (GetRoadTileType(tile)) {
--- a/road_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/road_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -318,7 +318,7 @@
 
 void ShowBuildRoadToolbar(void)
 {
-	if (_current_player == OWNER_SPECTATOR) return;
+	if (_current_player == PLAYER_SPECTATOR) return;
 	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
 	AllocateWindowDesc(&_build_road_desc);
 	if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
--- a/screenshot.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/screenshot.c	Sat Oct 14 15:49:43 2006 +0000
@@ -497,7 +497,7 @@
 	char *base;
 	int serial;
 
-	if (_game_mode == GM_EDITOR || _game_mode == GM_MENU || _local_player == OWNER_SPECTATOR) {
+	if (_game_mode == GM_EDITOR || _game_mode == GM_MENU || _local_player == PLAYER_SPECTATOR) {
 		sprintf(_screenshot_name, "screenshot");
 	} else {
 		const Player* p = GetPlayer(_local_player);
--- a/station_cmd.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/station_cmd.c	Sat Oct 14 15:49:43 2006 +0000
@@ -444,7 +444,7 @@
 	Station* st;
 
 	FOR_ALL_STATIONS(st) {
-		if ((owner == OWNER_SPECTATOR || st->owner == owner)) {
+		if ((owner == PLAYER_SPECTATOR || st->owner == owner)) {
 			uint cur_dist = DistanceManhattan(tile, st->xy);
 
 			if (cur_dist < threshold) {
@@ -2814,7 +2814,7 @@
 {
 	if (!IsTileOwner(tile, old_player)) return;
 
-	if (new_player != OWNER_SPECTATOR) {
+	if (new_player != PLAYER_SPECTATOR) {
 		Station* st = GetStationByTile(tile);
 
 		SetTileOwner(tile, new_player);
--- a/terraform_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/terraform_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -274,6 +274,6 @@
 
 void ShowTerraformToolbar(void)
 {
-	if (_current_player == OWNER_SPECTATOR) return;
+	if (_current_player == PLAYER_SPECTATOR) return;
 	AllocateWindowDescFront(&_terraform_desc, 0);
 }
--- a/town_gui.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/town_gui.c	Sat Oct 14 15:49:43 2006 +0000
@@ -44,7 +44,7 @@
 	uint avail_buttons = 0x7F; // by default all buttons except bribe are enabled.
 	uint buttons = 0;
 
-	if (pid != OWNER_SPECTATOR) {
+	if (pid != PLAYER_SPECTATOR) {
 		uint i;
 
 		// bribe option enabled?
--- a/tunnelbridge_cmd.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/tunnelbridge_cmd.c	Sat Oct 14 15:49:43 2006 +0000
@@ -1314,7 +1314,7 @@
 {
 	if (!IsTileOwner(tile, old_player)) return;
 
-	if (new_player != OWNER_SPECTATOR) {
+	if (new_player != PLAYER_SPECTATOR) {
 		SetTileOwner(tile, new_player);
 	} else {
 		if (IsBridge(tile) && IsBridgeMiddle(tile) && IsTransportUnderBridge(tile)) {
--- a/unmovable_cmd.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/unmovable_cmd.c	Sat Oct 14 15:49:43 2006 +0000
@@ -388,7 +388,7 @@
 {
 	if (!IsTileOwner(tile, old_player)) return;
 
-	if (IsOwnedLand(tile) && new_player != OWNER_SPECTATOR) {
+	if (IsOwnedLand(tile) && new_player != PLAYER_SPECTATOR) {
 		SetTileOwner(tile, new_player);
 	} else {
 		DoClearSquare(tile);
--- a/video/dedicated_v.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/video/dedicated_v.c	Sat Oct 14 15:49:43 2006 +0000
@@ -238,8 +238,8 @@
 	// Load the dedicated server stuff
 	_is_network_server = true;
 	_network_dedicated = true;
-	_network_playas = OWNER_SPECTATOR;
-	_local_player = OWNER_SPECTATOR;
+	_network_playas = PLAYER_SPECTATOR;
+	_local_player = PLAYER_SPECTATOR;
 
 	/* If SwitchMode is SM_LOAD, it means that the user used the '-g' options */
 	if (_switch_mode != SM_LOAD) {
--- a/water_cmd.c	Sat Oct 14 15:44:28 2006 +0000
+++ b/water_cmd.c	Sat Oct 14 15:49:43 2006 +0000
@@ -729,7 +729,7 @@
 {
 	if (!IsTileOwner(tile, old_player)) return;
 
-	if (new_player != OWNER_SPECTATOR) {
+	if (new_player != PLAYER_SPECTATOR) {
 		SetTileOwner(tile, new_player);
 	} else {
 		DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);