economy.c
changeset 1962 51ee4f459268
parent 1935 f43f062c9498
child 1977 4392ae3d8e31
--- a/economy.c	Tue Jun 21 14:50:08 2005 +0000
+++ b/economy.c	Tue Jun 21 16:28:17 2005 +0000
@@ -378,7 +378,7 @@
 					p->share_owners[i] = 0xFF;
 			}
 		}
-		p = DEREF_PLAYER(_current_player);
+		p = GetPlayer(_current_player);
 		/* Sell all the shares that people have on this company */
 		for (i = 0; i < 4; i++)
 			p->share_owners[i] = 0xFF;
@@ -484,7 +484,7 @@
 
 	DrawNewsBorder(w);
 
-	p = DEREF_PLAYER(WP(w,news_d).ni->string_id & 15);
+	p = GetPlayer(WP(w,news_d).ni->string_id & 15);
 	DrawPlayerFace(p->face, p->player_color, 2, 23);
 	GfxFillRect(3, 23, 3+91, 23+118, 0x4323);
 
@@ -553,7 +553,7 @@
 
 StringID GetNewsStringBankrupcy(NewsItem *ni)
 {
-	Player *p = DEREF_PLAYER(ni->string_id & 0xF);
+	Player *p = GetPlayer(ni->string_id & 0xF);
 
 	switch(ni->string_id >> 4) {
 	case 1:
@@ -1199,7 +1199,7 @@
 			pair = SetupSubsidyDecodeParam(s, 0);
 			InjectDParam(2);
 
-			p = DEREF_PLAYER(_current_player);
+			p = GetPlayer(_current_player);
 			SetDParam(0, p->name_1);
 			SetDParam(1, p->name_2);
 			AddNewsItem(
@@ -1224,7 +1224,7 @@
 
 	// Update player statistics
 	{
-		Player *p = DEREF_PLAYER(_current_player);
+		Player *p = GetPlayer(_current_player);
 		p->cur_economy.delivered_cargo += num_pieces;
 		SETBIT(p->cargo_types, cargo_type);
 	}
@@ -1525,14 +1525,14 @@
 	ChangeOwnershipOfPlayerItems(pi, _current_player);
 
 	if (p->bankrupt_value == 0) {
-		owner = DEREF_PLAYER(_current_player);
+		owner = GetPlayer(_current_player);
 		owner->current_loan += p->current_loan;
 	}
 
 	value = CalculateCompanyValue(p) >> 2;
 	for(i=0; i!=4; i++) {
 		if (p->share_owners[i] != 0xFF) {
-			owner = DEREF_PLAYER(p->share_owners[i]);
+			owner = GetPlayer(p->share_owners[i]);
 			owner->money64 += value;
 			owner->yearly_expenses[0][EXPENSES_OTHER] += value;
 			UpdatePlayerMoney32(owner);
@@ -1561,7 +1561,7 @@
 	if (p1 >= MAX_PLAYERS || !_patches.allow_shares) return CMD_ERROR;
 
 	SET_EXPENSES_TYPE(EXPENSES_OTHER);
-	p = DEREF_PLAYER(p1);
+	p = GetPlayer(p1);
 
 	/* Protect new companies from hostile takeovers */
 	if (_cur_year - p->inaugurated_year < 6) return_cmd_error(STR_7080_PROTECTED);
@@ -1606,7 +1606,7 @@
 	if (p1 >= MAX_PLAYERS || !_patches.allow_shares) return CMD_ERROR;
 
 	SET_EXPENSES_TYPE(EXPENSES_OTHER);
-	p = DEREF_PLAYER(p1);
+	p = GetPlayer(p1);
 
 	/* Those lines are here for network-protection (clients can be slow) */
 	if (GetAmountOwnedBy(p, _current_player) == 0) return 0;
@@ -1640,7 +1640,7 @@
 	if (p1 >= MAX_PLAYERS || _networking) return CMD_ERROR;
 
 	SET_EXPENSES_TYPE(EXPENSES_OTHER);
-	p = DEREF_PLAYER(p1);
+	p = GetPlayer(p1);
 
 	if (!p->is_ai) return CMD_ERROR;