#include "stdafx.h" #include "openttd.h" #include "table/strings.h" #include "player.h" #include "gui.h" #include "variables.h" #include "network.h" #include "gfx.h" #include "subsidiaries.h" #include "command.h" #include "functions.h" #include "economy.h" /** * External functions */ extern void DrawPlayerIcon(int p, int x, int y); extern Player *DoStartupNewPlayer(bool is_ai); /** * Pre-declarations */ static void ShowSubsidiaryMoneyTransfer(PlayerID player, bool send); void AskMergeSubsidiaries(PlayerID player); /** * Variables */ int32 _ask_send_money_amount; static uint64 _subsidiaries_money_amount = 0; static byte _subsidiaries_money_target = 0; /** * Widgets */ static const Widget _ask_merge_subsidiaries_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_NULL}, { WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_SUBSIDIARY_ASK_MERGER_TITLE, STR_NULL}, { WWT_PANEL, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL}, { WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL}, { WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL}, { WIDGETS_END}, }; static const Widget _ask_send_money_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_NULL}, { WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_SUBSIDIARY_CASH_REQUEST, STR_NULL}, { WWT_PANEL, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL}, { WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL}, { WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL}, { WIDGETS_END}, }; static const Widget _ask_sell_share_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_NULL}, { WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_SUBSIDIARY_SELL_SHARE_TITLE, STR_NULL}, { WWT_PANEL, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL}, { WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL}, { WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL}, { WIDGETS_END}, }; static const Widget _subsidiary_send_money[] = { { WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, 14, 11, 319, 0, 13, STR_SUBSIDIARY_SEND_TO, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_PANEL, RESIZE_NONE, 14, 0, 319, 14, 72, 0x0, STR_NULL}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 159, 73, 84, STR_SUBSIDIARY_ADD_CASH, STR_SUBSIDIARY_ADD_CASH_E}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 160, 319, 73, 84, STR_SUBSIDIARY_SUB_CASH, STR_SUBSIDIARY_SUB_CASH_E}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 182, 317, 16, 27, STR_SUBSIDIARIES_SEND_MONEY, STR_SUBSIDIARIES_SEND_MONEY_E}, { WIDGETS_END}, }; static const Widget _subsidiary_request_money[] = { { WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, 14, 11, 319, 0, 13, STR_SUBSIDIARY_REQUEST_FROM, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_PANEL, RESIZE_NONE, 14, 0, 319, 14, 72, 0x0, STR_NULL}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 159, 73, 84, STR_SUBSIDIARY_ADD_CASH, STR_SUBSIDIARY_ADD_CASH_E}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 160, 319, 73, 84, STR_SUBSIDIARY_SUB_CASH, STR_SUBSIDIARY_SUB_CASH_E}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 182, 317, 16, 27, STR_SUBSIDIARIES_REQUEST_MONEY,STR_SUBSIDIARIES_REQUEST_MONEY_E}, { WIDGETS_END}, }; static Widget _subsidiary_management_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, 14, 11, 379, 0, 13, STR_YOUR_SUBSIDIARIES, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_PANEL, RESIZE_NONE, 14, 0, 379, 14, 120, 0x0, STR_NULL}, { WWT_PANEL, RESIZE_NONE, 14, 2, 247, 16, 27, 0x0,STR_SUBSIDIARY_TOGGLE}, { WWT_PANEL, RESIZE_NONE, 14, 2, 247, 35, 46, 0x0,STR_SUBSIDIARY_TOGGLE}, { WWT_PANEL, RESIZE_NONE, 14, 2, 247, 47, 58, 0x0,STR_SUBSIDIARY_TOGGLE}, { WWT_PANEL, RESIZE_NONE, 14, 2, 247, 59, 70, 0x0,STR_SUBSIDIARY_TOGGLE}, { WWT_PANEL, RESIZE_NONE, 14, 2, 247, 71, 82, 0x0,STR_SUBSIDIARY_TOGGLE}, { WWT_PANEL, RESIZE_NONE, 14, 2, 247, 83, 94, 0x0,STR_SUBSIDIARY_TOGGLE}, { WWT_PANEL, RESIZE_NONE, 14, 2, 247, 95, 106, 0x0,STR_SUBSIDIARY_TOGGLE}, { WWT_PANEL, RESIZE_NONE, 14, 2, 247, 107, 118, 0x0,STR_SUBSIDIARY_TOGGLE}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 264, 377, 18, 29, STR_SUBSIDIARIES_ADMINISTRATE, STR_SUBSIDIARIES_ADMINISTRATE_E}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 264, 377, 32, 43, STR_SUBSIDIARIES_SEND_MONEY, STR_SUBSIDIARIES_SEND_MONEY_E}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 264, 377, 46, 57, STR_SUBSIDIARIES_REQUEST_MONEY, STR_SUBSIDIARIES_REQUEST_MONEY_E}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 264, 377, 60, 71, STR_SUBSIDIARIES_MERGER, STR_SUBSIDIARIES_MERGER_E}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 264, 377, 107, 118, STR_SUBSIDIARY_CREATE, STR_SUBSIDIARY_CREATE_E}, { WIDGETS_END}, }; /** * Window Procs */ static void AskSellShareWndProc(Window *w, WindowEvent *e) { // int i = 0; WindowClass clss; WindowNumber n; Player *p; Player *local; p = GetPlayer(w->window_number); local = GetPlayer(_local_player); /* Ugly hack to go around the w pointer modification during DoAcquireCompany() calls */ clss = w->window_class; n = w->window_number; switch(e->event) { case WE_PAINT: DrawWindowWidgets(w); SetDParam(0, p->name_1); SetDParam(1, p->name_2); SetDParam(2, _ask_send_money_amount); DrawStringMultiCenter(0x5A, 0x26, STR_SUBSIDIARY_SELL_SHARE, 178); return; case WE_CLICK: switch(e->we.click.widget) { case 3: DoCommandP(0, n, 0, NULL, CMD_SUBSIDIARY_BUY_SHARE_RESPONSE | CMD_MSG(STR_SUBSIDIARY_GET_ERROR)|CMD_NO_TEST_IF_IN_NETWORK); DeleteWindowById(clss, n); break; case 4: do_send:; DoCommandP(0, n, 1, NULL, CMD_SUBSIDIARY_BUY_SHARE_RESPONSE | CMD_MSG(STR_SUBSIDIARY_GET_ERROR)|CMD_NO_TEST_IF_IN_NETWORK); DeleteWindowById(clss,n); break; } break; case WE_KEYPRESS: /* Perform the merger on pressing 'Enter' */ if (e->we.keypress.keycode == WKC_RETURN) goto do_send; break; } } static void AskSendMoneyWndProc(Window *w, WindowEvent *e) { // int i = 0; WindowClass clss; WindowNumber n; Player *p; Player *local; p = GetPlayer(w->window_number); local = GetPlayer(_local_player); /* Ugly hack to go around the w pointer modification during DoAcquireCompany() calls */ clss = w->window_class; n = w->window_number; switch(e->event) { case WE_PAINT: DrawWindowWidgets(w); SetDParam(0, p->name_1); SetDParam(1, p->name_2); SetDParam(2, _ask_send_money_amount); DrawStringMultiCenter(0x5A, 0x26, STR_SUBSIDIARY_CASH_REQUESTED, 178); return; case WE_CLICK: switch(e->we.click.widget) { case 3: DoCommandP(0, n, -1, NULL, CMD_SUBSIDIARY_SEND_MONEY_ON_REQUEST | CMD_MSG(STR_SUBSIDIARY_GET_ERROR)); DeleteWindowById(clss, n); break; case 4: do_send:; DoCommandP(0, n, _ask_send_money_amount, NULL, CMD_SUBSIDIARY_SEND_MONEY_ON_REQUEST | CMD_MSG(STR_SUBSIDIARY_GET_ERROR)); DeleteWindowById(clss,n); break; } break; case WE_KEYPRESS: /* Perform the merger on pressing 'Enter' */ if (e->we.keypress.keycode == WKC_RETURN) goto do_send; break; } } static void SubsidiaryManagementWndProc(Window *w, WindowEvent *e) { int i = 0; int selected = -1; Player *selectedPlayer; Player *p; switch(e->event) { case WE_PAINT: { bool disabled; w->caption_color = _local_player; disabled = GetSubsidiariesCount() <= 1 || (!IsWindowWidgetLowered(w, 3) && !IsWindowWidgetLowered(w, 4) && !IsWindowWidgetLowered(w, 5) && !IsWindowWidgetLowered(w, 6) && !IsWindowWidgetLowered(w, 7) && !IsWindowWidgetLowered(w, 8) && !IsWindowWidgetLowered(w, 9) && !IsWindowWidgetLowered(w, 10)); // disable create new sub in network mode SetWindowWidgetsDisabledState(w, _networking || disabled, 11, 14, WIDGET_LIST_END); SetWindowWidgetsDisabledState(w, disabled, 12, 13, WIDGET_LIST_END); SetWindowWidgetDisabledState(w, 15, _networking); DrawWindowWidgets(w); // highlight commanded company if(_local_player == GetMotherCompany(GetPlayer(_local_player))){ DrawFrameRect(2, 16, 247, 27, 5, 0x60); }else{ FOR_ALL_PLAYERS(p) { if(_local_player == p->index){ DrawFrameRect(2, 35+i*12, 247, 46+i*12, 5, 0x60); break; } if(IsSubsidiary(p) && p->index != GetMotherCompany(p) && p->is_active) i++; } } p = GetPlayer(GetMotherCompany(GetPlayer(_local_player))); DrawPlayerIcon(p->index, 4, 18); SetDParam(0, p->name_1); SetDParam(1, p->name_2); SetDParam(2, GetPlayerNameString(p->index, 3)); DrawString(21,17,STR_7021, !IsWindowWidgetLowered(w, 3) ? 0x10 : 0xC); i = 0; FOR_ALL_PLAYERS(p) { if (!p->is_active || !IsSubsidiary(p) || p->index == GetMotherCompany(GetPlayer(_local_player))) continue; DrawPlayerIcon(p->index, 4, 37+i*12); SetDParam(0, p->name_1); SetDParam(1, p->name_2); SetDParam(2, GetPlayerNameString(p->index, 3)); DrawString(21,36+i*12,STR_7021, !IsWindowWidgetLowered(w, 4 + i) ? 0x10 : 0xC); i++; } } break; case WE_CLICK: if (IS_INT_INSIDE(e->we.click.widget, 3, 3+GetSubsidiariesCount())) { i = 1; FOR_ALL_PLAYERS(p){ if(_local_player == p->index){ if(GetMotherCompany(GetPlayer(_local_player)) == _local_player) i = 0; break; } if(GetMotherCompany(GetPlayer(_local_player)) == p->index) continue; if(IsSubsidiary(p) && p->is_active) i++; } if(i+3 != e->we.click.widget){ int j; for (j = 3; j < 11; j++) SetWindowWidgetLoweredState(w, j, !IsWindowWidgetLowered(w, j) && e->we.click.widget == j); SetWindowDirty(w); } }else{ // determin selected Subsidiary, if any for(i = 3; i < (3+GetSubsidiariesCount());i++){ if(IsWindowWidgetLowered(w , i)){ selected = i-3; } } //determin selected player i = 0; if(selected == 0){ selectedPlayer = GetPlayer(GetMotherCompany(GetPlayer(_local_player))); }else{ i = 1; FOR_ALL_PLAYERS(selectedPlayer) { if (!selectedPlayer->is_active || !IsSubsidiary(selectedPlayer) || (GetMotherCompany(GetPlayer(_local_player)) == selectedPlayer->index)) continue; if (i == selected) break; i++; } } switch(e->we.click.widget){ case 11: /* Administrate */ p = GetPlayer(_local_player); RaiseWindowWidget(w, selected + 3); _local_player = selectedPlayer->index; MarkWholeScreenDirty(); break; case 12: /* Send Money */ DeleteWindowById(WC_SUBSIDIARIES_MONEY, w->window_number); ShowSubsidiaryMoneyTransfer(selectedPlayer->index, true); RaiseWindowWidget(w, selected + 3); SetWindowDirty(w); break; case 13: /* Request Money */ DeleteWindowById(WC_SUBSIDIARIES_MONEY, w->window_number); ShowSubsidiaryMoneyTransfer(selectedPlayer->index, false); RaiseWindowWidget(w, selected + 3); SetWindowDirty(w); break; case 14: /* Merger */ AskMergeSubsidiaries(selectedPlayer->index); RaiseWindowWidget(w, selected + 3); SetWindowDirty(w); break; case 15:{/* Create */ Player *newp; int i = 0; newp = DoStartupNewPlayer(false); if(newp == 0){ ShowErrorMessage(STR_SUBSIDIARY_PLAYER_ERROR, STR_TOO_MANY_PLAYERS, 0,0); break; } newp->money64 = newp->player_money = newp->current_loan = 0; for(i = 0; i < 4; i++){ newp->share_owners[i] = w->window_number; } ShowPlayerCompany(newp->index); RaiseWindowWidget(w, selected + 3); MarkWholeScreenDirty(); }break; } //clear the selection } break; case WE_MOUSELOOP: /* redraw the window every now and then */ if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); break; case WE_DESTROY: /* Destroy side windows */ DeleteWindowById(WC_SUBSIDIARIES_MONEY, w->window_number); break; } } static void SubsidiaryMoneyTransferWndProc(Window *w, WindowEvent *e) { Player *p = GetPlayer(_subsidiaries_money_target); uint64 max_amount=(((uint64)((int64) -1))/2); switch(e->event){ case WE_PAINT: SetDParam(0, p->name_1); SetDParam(1, p->name_2); SetDParam(2, GetPlayerNameString(p->index, 3)); SetDParam(3, 10000); w->caption_color = _local_player; DrawWindowWidgets(w); DrawString(10, 32, STR_SUBSIDIARY_TARGET_HAS, 0); SetDParam64(0, p->player_money); DrawStringRightAligned(315, 32, STR_SUBSIDIARY_AMOUNT_TARGET, 0); DrawString(10, 46, STR_SUBSIDIARY_SEND_AMOUNT, 0); DrawString(10, 60, STR_SUBSIDIARY_REQUEST_AMOUNT, 0); SetDParam64(0, _subsidiaries_money_amount); DrawStringRightAligned(315, 46, STR_SUBSIDIARY_AMOUNT_SEND, 0); SetDParam64(0, _subsidiaries_money_amount - (_subsidiaries_money_amount / 16)); DrawStringRightAligned(315, 60, STR_SUBSIDIARY_AMOUNT_GET, 0); break; case WE_CLICK: switch(e->we.click.widget){ case 3:{ /* Increase amount */ uint64 oldAmount = _subsidiaries_money_amount; if(_shift_pressed){ _subsidiaries_money_amount += 100000; }else if(_ctrl_pressed){ _subsidiaries_money_amount *= 2; }else{ _subsidiaries_money_amount += 10000; } if(_subsidiaries_money_amount > max_amount) _subsidiaries_money_amount = oldAmount; SetWindowDirty(w); }break; case 4:{ /* Decrease amount */ uint64 oldAmount = _subsidiaries_money_amount; if(_shift_pressed){ _subsidiaries_money_amount -= 100000; }else if(_ctrl_pressed){ _subsidiaries_money_amount /= 2; }else{ _subsidiaries_money_amount -= 10000; } if(_subsidiaries_money_amount > max_amount) _subsidiaries_money_amount = oldAmount; SetWindowDirty(w); }break; case 5:{/* Perform transaction */ WindowNumber wn = w->window_number; // Player *me = GetPlayer(_local_player); if(IsWindowOfPrototype(w,_subsidiary_send_money)){ if(!DoCommandP(0,_subsidiaries_money_target,_subsidiaries_money_amount, NULL, CMD_SUBSIDIARY_SEND_MONEY | CMD_MSG(STR_SUBSIDIARY_GET_ERROR))){ SetDParam(0,_subsidiaries_money_amount); ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, STR_SUBSIDIARY_GET_ERROR, 0,0); } }else{ if(!_networking){ // don't ask for getting money _current_player = p->index; if(!DoCommandP(0, _local_player, _subsidiaries_money_amount, NULL, CMD_SUBSIDIARY_SEND_MONEY | CMD_MSG(STR_SUBSIDIARY_GET_ERROR))){ SetDParam(0,_subsidiaries_money_amount); ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, STR_SUBSIDIARY_GET_ERROR, 0,0); } _current_player = _local_player; }else{ // ask target company if it allows to get money DoCommandP(0, p->index, _subsidiaries_money_amount,NULL, CMD_SUBSIDIARY_GET_MONEY); } } DeleteWindowById(WC_SUBSIDIARIES_MONEY, wn); }break; } break; case WE_MOUSELOOP: /* redraw the window every now and then */ if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); break; } } static void AskMergeSubsidiariesWndProc(Window *w, WindowEvent *e) { int i = 0; WindowClass clss; WindowNumber n; Player *p; Player *local; p = GetPlayer(w->window_number); local = GetPlayer(_local_player); switch(e->event) { case WE_PAINT: DrawWindowWidgets(w); if((GetMotherCompany(GetPlayer(_local_player)) == w->window_number)){ SetDParam(0, local->name_1); SetDParam(1, local->name_2); SetDParam(2, p->name_1); SetDParam(3, p->name_2); }else{ SetDParam(0, p->name_1); SetDParam(1, p->name_2); SetDParam(2, local->name_1); SetDParam(3, local->name_2); } DrawStringMultiCenter(0x5A, 0x26, STR_SUBSIDIARY_ASK_MERGER, 178); return; case WE_CLICK: switch(e->we.click.widget) { case 3: DeleteWindowById(WC_SUBSIDIARIES_ASK_MERGER, w->window_number); break; case 4: do_merger:; /* Ugly hack to go around the w pointer modification during DoAcquireCompany() calls */ clss = w->window_class; n = w->window_number; if((GetMotherCompany(GetPlayer(_local_player)) == w->window_number)){ i = _current_player; _current_player = w->window_number; _local_player = w->window_number; DoAcquireCompany(GetPlayer(i)); }else{ DoAcquireCompany(GetPlayer(w->window_number)); } DeleteWindowById(clss,n); break; } break; case WE_KEYPRESS: /* Perform the merger on pressing 'Enter' */ if (e->we.keypress.keycode == WKC_RETURN) goto do_merger; break; } } /** * Window descriptions */ static const WindowDesc _subsidiary_send_money_desc = { WDP_AUTO, WDP_AUTO, 320, 85, WC_SUBSIDIARIES_MONEY, 0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _subsidiary_send_money, SubsidiaryMoneyTransferWndProc }; static const WindowDesc _subsidiary_request_money_desc = { WDP_AUTO, WDP_AUTO, 320, 85, WC_SUBSIDIARIES_MONEY, 0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _subsidiary_request_money, SubsidiaryMoneyTransferWndProc }; static const WindowDesc _subsidiary_management_desc = { WDP_AUTO, WDP_AUTO, 380, 121, WC_SUBSIDIARIES, 0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _subsidiary_management_widgets, SubsidiaryManagementWndProc }; static const WindowDesc _ask_merge_subsidiaries_desc = { WDP_CENTER, WDP_CENTER, 180, 92, WC_SUBSIDIARIES_ASK_MERGER,0, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, _ask_merge_subsidiaries_widgets, AskMergeSubsidiariesWndProc }; static const WindowDesc _ask_send_money_desc = { WDP_CENTER, WDP_CENTER, 180, 92, WC_SUBSIDIARIES_ASK_MERGER,0, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, _ask_send_money_widgets, AskSendMoneyWndProc }; static const WindowDesc _ask_sell_share_desc = { WDP_CENTER, WDP_CENTER, 180, 92, WC_SUBSIDIARIES_ASK_MERGER,0, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, _ask_sell_share_widgets, AskSellShareWndProc }; /** * Show window functions */ static void ShowSubsidiaryMoneyTransfer(PlayerID player, bool send) { Window *w; _subsidiaries_money_target = player; _subsidiaries_money_amount = 0; w = AllocateWindowDescFront( send ? &_subsidiary_send_money_desc : &_subsidiary_request_money_desc, GetMotherCompany(GetPlayer(player))); } void ShowSubsidiariesManagement(void) { AllocateWindowDescFront(&_subsidiary_management_desc , ((Player*)GetPlayer(GetMotherCompany(GetPlayer(_local_player))))->index); } void AskMergeSubsidiaries(PlayerID player) { AllocateWindowDescFront(&_ask_merge_subsidiaries_desc, player); } void AskSendMoney(PlayerID player, int32 amount) { _ask_send_money_amount = amount; AllocateWindowDescFront(&_ask_send_money_desc, player); } void AskSellShare(PlayerID player) { AllocateWindowDescFront(&_ask_sell_share_desc, player); }