src/player_gui.cpp
branchgamebalance
changeset 9912 1ac8aac92385
parent 9910 0b2aebc8283e
child 9913 e79cd19772dd
equal deleted inserted replaced
9911:0b8b245a2391 9912:1ac8aac92385
    15 #include "command.h"
    15 #include "command.h"
    16 #include "vehicle.h"
    16 #include "vehicle.h"
    17 #include "economy.h"
    17 #include "economy.h"
    18 #include "network/network.h"
    18 #include "network/network.h"
    19 #include "variables.h"
    19 #include "variables.h"
       
    20 #include "roadveh.h"
    20 #include "train.h"
    21 #include "train.h"
    21 #include "aircraft.h"
    22 #include "aircraft.h"
    22 #include "date.h"
    23 #include "date.h"
    23 #include "newgrf.h"
    24 #include "newgrf.h"
    24 #include "network/network_data.h"
    25 #include "network/network_data.h"
   275 	LC_OTHER,
   276 	LC_OTHER,
   276 	LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL,
   277 	LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL,
   277 	LC_ROAD, LC_ROAD,
   278 	LC_ROAD, LC_ROAD,
   278 	LC_SHIP, LC_SHIP,
   279 	LC_SHIP, LC_SHIP,
   279 	LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT,
   280 	LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT,
       
   281 	LC_ROAD, LC_ROAD,
   280 };
   282 };
   281 
   283 
   282 /* Number of liveries in each class, used to determine the height of the livery window */
   284 /* Number of liveries in each class, used to determine the height of the livery window */
   283 static const byte livery_height[] = {
   285 static const byte livery_height[] = {
   284 	1,
   286 	1,
   285 	11,
   287 	11,
   286 	2,
   288 	4,
   287 	2,
   289 	2,
   288 	3,
   290 	3,
   289 };
   291 };
   290 
   292 
   291 struct livery_d {
   293 struct livery_d {
   321 static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e)
   323 static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e)
   322 {
   324 {
   323 	switch (e->event) {
   325 	switch (e->event) {
   324 		case WE_CREATE:
   326 		case WE_CREATE:
   325 			LowerWindowWidget(w, WP(w, livery_d).livery_class + 2);
   327 			LowerWindowWidget(w, WP(w, livery_d).livery_class + 2);
   326 			if (!_have_2cc) {
   328 			if (!HASBIT(_loaded_newgrf_features, GRFLOADED_2CC)) {
   327 				HideWindowWidget(w, 11);
   329 				HideWindowWidget(w, 11);
   328 				HideWindowWidget(w, 12);
   330 				HideWindowWidget(w, 12);
   329 			}
   331 			}
   330 			break;
   332 			break;
   331 
   333 
   363 					DrawString(15, y, STR_LIVERY_DEFAULT + scheme, sel ? 0xC : 0x10);
   365 					DrawString(15, y, STR_LIVERY_DEFAULT + scheme, sel ? 0xC : 0x10);
   364 
   366 
   365 					DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour1), 152, y);
   367 					DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour1), 152, y);
   366 					DrawString(165, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour1, sel ? 0xC : 2);
   368 					DrawString(165, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour1, sel ? 0xC : 2);
   367 
   369 
   368 					if (_have_2cc) {
   370 					if (HASBIT(_loaded_newgrf_features, GRFLOADED_2CC)) {
   369 						DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour2), 277, y);
   371 						DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour2), 277, y);
   370 						DrawString(290, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour2, sel ? 0xC : 2);
   372 						DrawString(290, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour2, sel ? 0xC : 2);
   371 					}
   373 					}
   372 
   374 
   373 					y += 14;
   375 					y += 14;
   646 
   648 
   647 	FOR_ALL_VEHICLES(v) {
   649 	FOR_ALL_VEHICLES(v) {
   648 		if (v->owner == player) {
   650 		if (v->owner == player) {
   649 			switch (v->type) {
   651 			switch (v->type) {
   650 				case VEH_TRAIN:    if (IsFrontEngine(v)) train++; break;
   652 				case VEH_TRAIN:    if (IsFrontEngine(v)) train++; break;
   651 				case VEH_ROAD:     road++; break;
   653 				case VEH_ROAD:     if (IsRoadVehFront(v)) road++; break;
   652 				case VEH_AIRCRAFT: if (IsNormalAircraft(v)) air++; break;
   654 				case VEH_AIRCRAFT: if (IsNormalAircraft(v)) air++; break;
   653 				case VEH_SHIP:     ship++; break;
   655 				case VEH_SHIP:     ship++; break;
   654 				default: break;
   656 				default: break;
   655 			}
   657 			}
   656 		}
   658 		}
   791 					}
   793 					}
   792 					break;
   794 					break;
   793 				}
   795 				}
   794 
   796 
   795 				case PCW_WIDGET_COLOR_SCHEME: {
   797 				case PCW_WIDGET_COLOR_SCHEME: {
   796 					Window *wf = AllocateWindowDescFront(_have_2cc ? &_select_player_livery_2cc_desc : &_select_player_livery_desc, w->window_number);
   798 					Window *wf = AllocateWindowDescFront(HASBIT(_loaded_newgrf_features, GRFLOADED_2CC) ? &_select_player_livery_2cc_desc : &_select_player_livery_desc, w->window_number);
   797 					if (wf != NULL) {
   799 					if (wf != NULL) {
   798 						wf->caption_color = wf->window_number;
   800 						wf->caption_color = wf->window_number;
   799 						WP(wf, livery_d).livery_class = LC_OTHER;
   801 						WP(wf, livery_d).livery_class = LC_OTHER;
   800 						WP(wf, livery_d).sel = 1;
   802 						WP(wf, livery_d).sel = 1;
   801 						LowerWindowWidget(wf, 2);
   803 						LowerWindowWidget(wf, 2);