src/player_gui.cpp
changeset 7934 c1b897797d7a
parent 7932 6c3d71e8a129
child 7997 df87ccd00a96
equal deleted inserted replaced
7933:b2bb6a4aafd4 7934:c1b897797d7a
   973 { WWT_PUSHTXTBTN,   RESIZE_NONE,    14,   180,   359,   158,   169, STR_7078_SELL_25_SHARE_IN_COMPANY, STR_707A_SELL_25_SHARE_IN_THIS_COMPANY},
   973 { WWT_PUSHTXTBTN,   RESIZE_NONE,    14,   180,   359,   158,   169, STR_7078_SELL_25_SHARE_IN_COMPANY, STR_707A_SELL_25_SHARE_IN_THIS_COMPANY},
   974 { WWT_PUSHTXTBTN,   RESIZE_NONE,    14,   266,   355,   138,   149, STR_COMPANY_PASSWORD,              STR_COMPANY_PASSWORD_TOOLTIP},
   974 { WWT_PUSHTXTBTN,   RESIZE_NONE,    14,   266,   355,   138,   149, STR_COMPANY_PASSWORD,              STR_COMPANY_PASSWORD_TOOLTIP},
   975 {   WIDGETS_END},
   975 {   WIDGETS_END},
   976 };
   976 };
   977 
   977 
       
   978 
       
   979 /**
       
   980  * Draws text "Vehicles:" and number of all vehicle types, or "(none)"
       
   981  * @param player ID of player to print statistics of
       
   982  */
   978 static void DrawPlayerVehiclesAmount(PlayerID player)
   983 static void DrawPlayerVehiclesAmount(PlayerID player)
   979 {
   984 {
   980 	const int x = 110;
   985 	const int x = 110;
   981 	int y = 72;
   986 	int y = 63;
   982 	const Vehicle *v;
   987 	const Vehicle *v;
   983 	uint train = 0;
   988 	uint train = 0;
   984 	uint road  = 0;
   989 	uint road  = 0;
   985 	uint air   = 0;
   990 	uint air   = 0;
   986 	uint ship  = 0;
   991 	uint ship  = 0;
  1033 				 (p->share_owners[1] == owner) +
  1038 				 (p->share_owners[1] == owner) +
  1034 				 (p->share_owners[2] == owner) +
  1039 				 (p->share_owners[2] == owner) +
  1035 				 (p->share_owners[3] == owner);
  1040 				 (p->share_owners[3] == owner);
  1036 }
  1041 }
  1037 
  1042 
       
  1043 /**
       
  1044  * Draws list of all companies with shares
       
  1045  * @param p pointer to the Player structure
       
  1046  */
  1038 static void DrawCompanyOwnerText(const Player *p)
  1047 static void DrawCompanyOwnerText(const Player *p)
  1039 {
  1048 {
  1040 	const Player *p2;
  1049 	const Player *p2;
  1041 	uint num = 0;
  1050 	uint num = 0;
  1042 	const byte height = GetCharacterHeight(FS_NORMAL);
  1051 	const byte height = GetCharacterHeight(FS_NORMAL);
  1099 			SetDParam(0, p->index);
  1108 			SetDParam(0, p->index);
  1100 			SetDParam(1, p->index);
  1109 			SetDParam(1, p->index);
  1101 
  1110 
  1102 			DrawWindowWidgets(w);
  1111 			DrawWindowWidgets(w);
  1103 
  1112 
  1104 			SetDParam(0, p->inaugurated_year);
  1113 			/* Player face */
  1105 			DrawString(110, 25, STR_7038_INAUGURATED, TC_FROMSTRING);
       
  1106 
       
  1107 			DrawPlayerVehiclesAmount((PlayerID)w->window_number);
       
  1108 
       
  1109 			DrawString(110, 48, STR_7006_COLOR_SCHEME, TC_FROMSTRING);
       
  1110 			/* Draw company-colour bus */
       
  1111 			DrawSprite(SPR_VEH_BUS_SW_VIEW, PLAYER_SPRITE_COLOR(p->index), 215, 49);
       
  1112 
       
  1113 			DrawPlayerFace(p->face, p->player_color, 2, 16);
  1114 			DrawPlayerFace(p->face, p->player_color, 2, 16);
  1114 
  1115 
       
  1116 			/* "xxx (Manager)" */
  1115 			SetDParam(0, p->index);
  1117 			SetDParam(0, p->index);
  1116 			DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, 94);
  1118 			DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, 94);
  1117 
  1119 
       
  1120 			/* "Inaugurated:" */
       
  1121 			SetDParam(0, p->inaugurated_year);
       
  1122 			DrawString(110, 23, STR_7038_INAUGURATED, TC_FROMSTRING);
       
  1123 
       
  1124 			/* "Colour scheme:" */
       
  1125 			DrawString(110, 43, STR_7006_COLOR_SCHEME, TC_FROMSTRING);
       
  1126 			/* Draw company-colour bus */
       
  1127 			DrawSprite(SPR_VEH_BUS_SW_VIEW, PLAYER_SPRITE_COLOR(p->index), 215, 44);
       
  1128 
       
  1129 			/* "Vehicles:" */
       
  1130 			DrawPlayerVehiclesAmount((PlayerID)w->window_number);
       
  1131 
       
  1132 			/* "Company value:" */
  1118 			SetDParam(0, CalculateCompanyValue(p));
  1133 			SetDParam(0, CalculateCompanyValue(p));
  1119 			DrawString(110, 106, STR_7076_COMPANY_VALUE, TC_FROMSTRING);
  1134 			DrawString(110, 106, STR_7076_COMPANY_VALUE, TC_FROMSTRING);
  1120 
  1135 
       
  1136 			/* Shares list */
  1121 			DrawCompanyOwnerText(p);
  1137 			DrawCompanyOwnerText(p);
  1122 
  1138 
  1123 			break;
  1139 			break;
  1124 		}
  1140 		}
  1125 
  1141