src/player_gui.cpp
branchcpp_gui
changeset 6235 5077e6ed3788
parent 6144 5a0ffbf27ced
child 6237 bce32e54c993
equal deleted inserted replaced
6234:42bf2d268a86 6235:5077e6ed3788
   170 		switch (e->we.click.widget) {
   170 		switch (e->we.click.widget) {
   171 		case 2: {/* toggle size */
   171 		case 2: {/* toggle size */
   172 			byte mode = (byte)WP(w,def_d).data_1;
   172 			byte mode = (byte)WP(w,def_d).data_1;
   173 			bool stickied = !!(w->flags4 & WF_STICKY);
   173 			bool stickied = !!(w->flags4 & WF_STICKY);
   174 			PlayerID player = (PlayerID)w->window_number;
   174 			PlayerID player = (PlayerID)w->window_number;
   175 			DeleteWindow(w);
   175 			w->Close();
   176 			DoShowPlayerFinances(player, !HASBIT(mode, 0), stickied);
   176 			DoShowPlayerFinances(player, !HASBIT(mode, 0), stickied);
   177 		} break;
   177 		} break;
   178 
   178 
   179 		case 6: /* increase loan */
   179 		case 6: /* increase loan */
   180 			DoCommandP(0, 0, _ctrl_pressed, NULL, CMD_INCREASE_LOAN | CMD_MSG(STR_702C_CAN_T_BORROW_ANY_MORE_MONEY));
   180 			DoCommandP(0, 0, _ctrl_pressed, NULL, CMD_INCREASE_LOAN | CMD_MSG(STR_702C_CAN_T_BORROW_ANY_MORE_MONEY));
   430 					if (_ctrl_pressed) {
   430 					if (_ctrl_pressed) {
   431 						TOGGLEBIT(WP(w, livery_d).sel, j);
   431 						TOGGLEBIT(WP(w, livery_d).sel, j);
   432 					} else {
   432 					} else {
   433 						WP(w, livery_d).sel = 1 << j;
   433 						WP(w, livery_d).sel = 1 << j;
   434 					}
   434 					}
   435 					SetWindowDirty(w);
   435 					w->SetDirty();
   436 					break;
   436 					break;
   437 				}
   437 				}
   438 			}
   438 			}
   439 			break;
   439 			break;
   440 		}
   440 		}
   516 		DrawPlayerFace(WP(w,facesel_d).face, p->player_color, 2, 16);
   516 		DrawPlayerFace(WP(w,facesel_d).face, p->player_color, 2, 16);
   517 	} break;
   517 	} break;
   518 
   518 
   519 	case WE_CLICK:
   519 	case WE_CLICK:
   520 		switch (e->we.click.widget) {
   520 		switch (e->we.click.widget) {
   521 		case 3: DeleteWindow(w); break;
   521 		case 3: w->Close(); break;
   522 		case 4: /* ok click */
   522 		case 4: /* ok click */
   523 			DoCommandP(0, 0, WP(w,facesel_d).face, NULL, CMD_SET_PLAYER_FACE);
   523 			DoCommandP(0, 0, WP(w,facesel_d).face, NULL, CMD_SET_PLAYER_FACE);
   524 			DeleteWindow(w);
   524 			w->Close();
   525 			break;
   525 			break;
   526 		case 5: /* male click */
   526 		case 5: /* male click */
   527 		case 6: /* female click */
   527 		case 6: /* female click */
   528 			RaiseWindowWidget(w, WP(w, facesel_d).gender + 5);
   528 			RaiseWindowWidget(w, WP(w, facesel_d).gender + 5);
   529 			WP(w, facesel_d).gender = e->we.click.widget - 5;
   529 			WP(w, facesel_d).gender = e->we.click.widget - 5;
   530 			LowerWindowWidget(w, WP(w, facesel_d).gender + 5);
   530 			LowerWindowWidget(w, WP(w, facesel_d).gender + 5);
   531 			SetWindowDirty(w);
   531 			w->SetDirty();
   532 			break;
   532 			break;
   533 		case 7:
   533 		case 7:
   534 			WP(w,facesel_d).face = (WP(w,facesel_d).gender << 31) + GB(InteractiveRandom(), 0, 31);
   534 			WP(w,facesel_d).face = (WP(w,facesel_d).gender << 31) + GB(InteractiveRandom(), 0, 31);
   535 			SetWindowDirty(w);
   535 			w->SetDirty();
   536 			break;
   536 			break;
   537 		}
   537 		}
   538 		break;
   538 		break;
   539 	}
   539 	}
   540 }
   540 }
   820 			}
   820 			}
   821 			break;
   821 			break;
   822 
   822 
   823 		case WE_MOUSELOOP:
   823 		case WE_MOUSELOOP:
   824 			/* redraw the window every now and then */
   824 			/* redraw the window every now and then */
   825 			if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w);
   825 			if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
   826 			break;
   826 			break;
   827 
   827 
   828 		case WE_PLACE_OBJ:
   828 		case WE_PLACE_OBJ:
   829 			if (DoCommandP(e->we.place.tile, 0, 0, NULL, CMD_BUILD_COMPANY_HQ | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_7071_CAN_T_BUILD_COMPANY_HEADQUARTERS)))
   829 			if (DoCommandP(e->we.place.tile, 0, 0, NULL, CMD_BUILD_COMPANY_HQ | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_7071_CAN_T_BUILD_COMPANY_HEADQUARTERS)))
   830 				ResetObjectToPlace();
   830 				ResetObjectToPlace();
   831 				w->widget[PCW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; // this button can now behave as a normal push button
   831 				w->widget[PCW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; // this button can now behave as a normal push button
   832 				RaiseWindowButtons(w);
   832 				w->RaiseButtons();
   833 			break;
   833 			break;
   834 
   834 
   835 		case WE_ABORT_PLACE_OBJ:
   835 		case WE_ABORT_PLACE_OBJ:
   836 			RaiseWindowButtons(w);
   836 			w->RaiseButtons();
   837 			break;
   837 			break;
   838 
   838 
   839 		case WE_DESTROY:
   839 		case WE_DESTROY:
   840 			DeleteWindowById(WC_PLAYER_FACE, w->window_number);
   840 			DeleteWindowById(WC_PLAYER_FACE, w->window_number);
   841 			break;
   841 			break;
   906 	}
   906 	}
   907 
   907 
   908 	case WE_CLICK:
   908 	case WE_CLICK:
   909 		switch (e->we.click.widget) {
   909 		switch (e->we.click.widget) {
   910 		case 3:
   910 		case 3:
   911 			DeleteWindow(w);
   911 			w->Close();
   912 			break;
   912 			break;
   913 		case 4: {
   913 		case 4: {
   914 			DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY));
   914 			DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY));
   915 			break;
   915 			break;
   916 		}
   916 		}
   993 			SetDParam(2, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
   993 			SetDParam(2, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
   994 			DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640);
   994 			DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640);
   995 		}
   995 		}
   996 	} break;
   996 	} break;
   997 	case WE_CLICK: /* Close the window (and show the highscore window) */
   997 	case WE_CLICK: /* Close the window (and show the highscore window) */
   998 		DeleteWindow(w);
   998 		w->Close();
   999 		break;
   999 		break;
  1000 	case WE_DESTROY: /* Show the highscore window when this one is closed */
  1000 	case WE_DESTROY: /* Show the highscore window when this one is closed */
  1001 		if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
  1001 		if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
  1002 		ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank);
  1002 		ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank);
  1003 		break;
  1003 		break;
  1033 			}
  1033 			}
  1034 		}
  1034 		}
  1035 	} break;
  1035 	} break;
  1036 
  1036 
  1037 	case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */
  1037 	case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */
  1038 		DeleteWindow(w);
  1038 		w->Close();
  1039 		break;
  1039 		break;
  1040 
  1040 
  1041 	case WE_DESTROY: /* Get back all the hidden windows */
  1041 	case WE_DESTROY: /* Get back all the hidden windows */
  1042 		if (_game_mode != GM_MENU) ShowVitalWindows();
  1042 		if (_game_mode != GM_MENU) ShowVitalWindows();
  1043 
  1043