Changeset - r2:9221be573970
[Not reviewed]
master
0 7 0
darkvater - 20 years ago 2004-08-10 14:32:17
darkvater@openttd.org
(svn r3) -[1005611] Player Window patch: When looking in dropdownlist for player stuff, it will say
for all human players (Player #), not only for the first 2
7 files changed with 17 insertions and 15 deletions:
0 comments (0 inline, 0 general)
functions.h
Show inline comments
 
@@ -74,25 +74,25 @@ void DrawTrainDepotSprite(int x, int y, 
 
void DrawRoadDepotSprite(int x, int y, int image);
 

	
 
/* water_land.c */
 
void DrawShipDepotSprite(int x, int y, int image);
 
void TileLoop_Water(uint tile);
 

	
 
/* players.c */
 
bool CheckPlayerHasMoney(int32 cost);
 
void SubtractMoneyFromPlayer(int32 cost);
 
void SubtractMoneyFromPlayerFract(byte player, int32 cost);
 
bool CheckOwnership(byte owner);
 
bool CheckTileOwnership(uint tile);
 
StringID GetPlayerNameString(byte player);
 
StringID GetPlayerNameString(byte player, byte index);
 

	
 
/* standard */
 
void ShowInfo(const char *str);
 
void CDECL ShowInfoF(const char *str, ...);
 
void NORETURN CDECL error(const char *str, ...);
 
void memswap(void *a, void *b, size_t size);
 

	
 
/* ttd.c */
 
uint32 Random();
 
uint RandomRange(uint max);
 

	
 
uint32 InteractiveRandom(); /* Used for random sequences that are not the same on the other end of the multiplayer link */
graph_gui.c
Show inline comments
 
@@ -203,25 +203,25 @@ static void GraphLegendWndProc(Window *w
 
		}
 
		w->click_state = ((~_legend_showbits) << 3);
 
		DrawWindowWidgets(w);
 

	
 
		FOR_ALL_PLAYERS(p) {
 
			if (!p->is_active)
 
				continue;
 

	
 
			DrawPlayerIcon(p->index, 4, 18+p->index*12);
 

	
 
			SET_DPARAM16(0, p->name_1);
 
			SET_DPARAM32(1, p->name_2);
 
			SET_DPARAM16(2, GetPlayerNameString(p->index));
 
			SET_DPARAM16(2, GetPlayerNameString(p->index, 3));
 
			DrawString(21,17+p->index*12,STR_7021,HASBIT(_legend_showbits, p->index) ? 0x10 : 0xC);
 
		}
 
		break;
 

	
 
	case WE_CLICK:
 
		if (IS_INT_INSIDE(e->click.widget, 3, 11)) {
 
			_legend_showbits ^= (1 << (e->click.widget-3));
 
			SetWindowDirty(w);
 
			InvalidateWindow(WC_INCOME_GRAPH, 0);
 
			InvalidateWindow(WC_OPERATING_PROFIT, 0);
 
			InvalidateWindow(WC_DELIVERED_CARGO, 0);
 
			InvalidateWindow(WC_PERFORMANCE_HISTORY, 0);
 
@@ -814,26 +814,26 @@ static void CompanyLeagueWndProc(Window 
 
		}
 
		assert(pl_num > 0);
 
		
 
		qsort(plist, pl_num, sizeof(Player*), _perf_hist_comp);
 

	
 
		i = 0;
 
		do {
 
			SET_DPARAM16(0, i + 1 + STR_01AB);
 
			p = plist[i];
 
			SET_DPARAM16(1, p->name_1);
 
			SET_DPARAM32(2, p->name_2);
 
			
 
			SET_DPARAM16(3, GetPlayerNameString(p->index));
 
			SET_DPARAM16(4, GetPerformanceTitleFromValue(p->old_economy[1].performance_history));
 
			SET_DPARAM16(3, GetPlayerNameString(p->index, 4));
 
			SET_DPARAM16(5, GetPerformanceTitleFromValue(p->old_economy[1].performance_history));
 

	
 
			DrawString(2, 15 + i * 10, i == 0 ? STR_7054 : STR_7055, 0);
 
			DrawPlayerIcon(p->index, 27, 16 + i * 10);
 
		} while (++i != pl_num);
 

	
 
		break;
 
	}
 
	}
 
}
 

	
 

	
 
static const Widget _company_league_widgets[] = {
lang/english.txt
Show inline comments
 
@@ -1715,26 +1715,25 @@ STR_6833_9_MONTHS_AFTER_PLAYER			:9 mont
 
STR_6834_AT_END_OF_LINE_AND_AT_STATIONS	:At end of line, and at stations
 
STR_6835_AT_END_OF_LINE_ONLY			:At end of line only
 
STR_6836_OFF							:Off
 
STR_6837_ON								:On
 
STR_6838_SHOW_HI_SCORE_CHART			:{BLACK}Show hi-score chart
 
STR_6839_PERMISSIVE		:Permissive
 
STR_683A_TOLERANT			:Tolerant
 
STR_683B_HOSTILE			:Hostile
 

	
 
##id 0x7000
 
STR_7000								:
 
STR_7001								:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7002_PLAYER_1						: (Player 1)
 
STR_7003_PLAYER_2						: (Player 2)
 
STR_7002_PLAYER						: (Player {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}New Face
 
STR_7005_COLOR_SCHEME					:{BLACK}Color Scheme
 
STR_7006_COLOR_SCHEME					:{GOLD}Color Scheme:
 
STR_7007_NEW_COLOR_SCHEME				:{WHITE}New Color Scheme
 
STR_7008_COMPANY_NAME					:{BLACK}Company Name
 
STR_7009_PRESIDENT_NAME					:{BLACK}President Name
 
STR_700A_COMPANY_NAME					:Company Name
 
STR_700B_PRESIDENT_S_NAME				:President's Name
 
STR_700C_CAN_T_CHANGE_COMPANY_NAME		:{WHITE}Can't change company name...
 
STR_700D_CAN_T_CHANGE_PRESIDENT			:{WHITE}Can't change president's name...
 
STR_700E_FINANCES						:{WHITE}{STRING} Finances{BLACK}{STRING}
 
STR_700F_EXPENDITURE_INCOME				:{WHITE}Expenditure/Income
main_gui.c
Show inline comments
 
@@ -495,25 +495,25 @@ static void PlayerMenuWndProc(Window *w,
 
		sel = WP(w,menu_d).sel_index;
 
		chk = WP(w,menu_d).checked_items; // let this mean gray items.
 
		
 
		FOR_ALL_PLAYERS(p) {
 
			if (p->is_active) {
 
				if (p->index == sel) {
 
					GfxFillRect(x, y, x + 0xEE, y + 9, 0);
 
				}
 
				DrawSprite( ((p->player_color + 0x307)<<16)+0x82EB, x+2, y+1);
 
			
 
				SET_DPARAM16(0, p->name_1);
 
				SET_DPARAM32(1, p->name_2);
 
				SET_DPARAM16(2, GetPlayerNameString(p->index));
 
				SET_DPARAM16(2, GetPlayerNameString(p->index, 3));
 
							
 
				color = (byte)((p->index==sel) ? 0xC : 0x10);
 
				if (chk&1) color = 14;
 
				DrawString(x+0x13, y, STR_7021, color);
 
				
 
				y += 10;
 
			}	
 
			chk >>= 1;		
 
		}
 
		break;
 
		}
 

	
player_gui.c
Show inline comments
 
@@ -125,26 +125,26 @@ static const Widget _player_finances_sma
 

	
 

	
 
static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
 
{
 
	switch(e->event) {
 
	case WE_PAINT: {
 
		Player *p = DEREF_PLAYER(w->window_number);
 
		
 
		w->disabled_state = p->current_loan != 0 ? 0 : (1 << 6);
 

	
 
		SET_DPARAM16(0, p->name_1);
 
		SET_DPARAM32(1, p->name_2);
 
		SET_DPARAM16(2, GetPlayerNameString((byte)w->window_number));
 
		SET_DPARAM32(3, 10000);
 
		SET_DPARAM16(2, GetPlayerNameString((byte)w->window_number, 3));
 
		SET_DPARAM32(4, 10000);
 
		DrawWindowWidgets(w);
 

	
 
		DrawPlayerEconomyStats(p, (byte)WP(w,def_d).data_1);
 
	} break;
 

	
 
	case WE_CLICK:
 
		switch(e->click.widget) {
 
		case 2: {/* toggle size */
 
			byte mode = (byte)WP(w,def_d).data_1;
 
			int player = w->window_number;
 
			DeleteWindow(w);
 
			DoShowPlayerFinances(player, (mode & 1) == 0);
 
@@ -471,25 +471,25 @@ static void PlayerCompanyWndProc(Window 
 
{
 
	switch(e->event) {
 
	case WE_PAINT: {
 
		Player *p = DEREF_PLAYER(w->window_number);
 
		uint32 dis;
 

	
 
		if (w->widget == _my_player_company_widgets &&
 
				p->location_of_house != 0)
 
					w->widget = _my_player_company_bh_widgets;
 
	
 
		SET_DPARAM16(0, p->name_1);
 
		SET_DPARAM32(1, p->name_2);
 
		SET_DPARAM16(2, GetPlayerNameString((byte)w->window_number));
 
		SET_DPARAM16(2, GetPlayerNameString((byte)w->window_number, 3));
 

	
 
		dis = 0;
 
		if (GetAmountOwnedBy(p, 0xFF) == 0) dis |= 1 << 8;
 
		if (GetAmountOwnedBy(p, _local_player) == 0) dis |= 1 << 9;
 

	
 
		w->disabled_state = dis;
 
		DrawWindowWidgets(w);
 

	
 
		SET_DPARAM16(0, p->inaugurated_year + 1920);
 
		DrawString(110, 25, STR_7038_INAUGURATED, 0);
 

	
 
		DrawPlayerVehiclesAmount(w->window_number);
players.c
Show inline comments
 
@@ -550,28 +550,31 @@ void RunOtherPlayersLoop()
 
	FOR_ALL_PLAYERS(p) {
 
		if (p->is_active) {
 
			_current_player = p->index;
 
			AiDoGameLoop(p);
 
		}
 
	}
 

	
 
	_is_ai_player = false;
 
// XXX: is this needed?
 
	_current_player = 0;
 
}
 

	
 
StringID GetPlayerNameString(byte player)
 
// index is the next parameter in _decode_parameters to set up
 
StringID GetPlayerNameString(byte player, byte index)
 
{
 
	if (IS_HUMAN_PLAYER(player) && player < 2) // temporarily fixes the names in the list.
 
		return STR_7002_PLAYER_1+player;
 
	if (IS_HUMAN_PLAYER(player) && player < MAX_PLAYERS) {
 
		SET_DPARAM16(index, player+1);
 
		return STR_7002_PLAYER;
 
	}
 
	return STR_EMPTY;
 
}
 

	
 
extern void ShowPlayerFinances(int player);
 

	
 
void PlayersYearlyLoop()
 
{
 
	Player *p;
 

	
 
	// Copy statistics
 
	FOR_ALL_PLAYERS(p) {
 
		if (p->is_active) {
town_gui.c
Show inline comments
 
@@ -105,37 +105,37 @@ static void TownAuthorityWndProc(Window 
 
			DrawWindowWidgets(w);
 

	
 
			DrawString(2, 15, STR_2023_TRANSPORT_COMPANY_RATINGS, 0);
 
			
 
			// Draw list of players
 
			y = 25;
 
			FOR_ALL_PLAYERS(p) {
 
				if (p->is_active && HASBIT(t->have_ratings, p->index)) {
 
					DrawPlayerIcon(p->index, 2, y);
 
					
 
					SET_DPARAM16(0, p->name_1);
 
					SET_DPARAM32(1, p->name_2);
 
					SET_DPARAM16(2, GetPlayerNameString(p->index));
 
					SET_DPARAM16(2, GetPlayerNameString(p->index, 3));
 

	
 
					r = t->ratings[p->index];
 
					(str = STR_3035_APPALLING, r <= -400) ||	// Apalling
 
					(str++, r <= -200) ||											// Very Poor
 
					(str++, r <= 0) ||												// Poor
 
					(str++, r <= 200) ||											// Mediocore
 
					(str++, r <= 400) ||											// Good
 
					(str++, r <= 600) ||											// Very Good
 
					(str++, r <= 800) ||											// Excellent
 
					(str++, true);														// Outstanding
 

	
 
					SET_DPARAM16(3, str);
 
					SET_DPARAM16(4, str);
 
					DrawString(19, y, STR_2024, 0);
 
					y+=10;
 
				}
 
			}
 
		}
 

	
 
		// Draw actions list
 
		{
 
			int y = 107, i;
 
			int pos = w->vscroll.pos;
 

	
 
			if (--pos < 0) {
0 comments (0 inline, 0 general)