main_gui.c
changeset 1962 51ee4f459268
parent 1932 275d72f700e2
child 1977 4392ae3d8e31
equal deleted inserted replaced
1961:10ce7350f76b 1962:51ee4f459268
    82 			SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str);
    82 			SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str);
    83 		else
    83 		else
    84 			NetworkServer_HandleChat(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str, NETWORK_SERVER_INDEX);
    84 			NetworkServer_HandleChat(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str, NETWORK_SERVER_INDEX);
    85 		break;
    85 		break;
    86 	case 3: { /* Give money, you can only give money in excess of loan */
    86 	case 3: { /* Give money, you can only give money in excess of loan */
    87 		const Player *p = DEREF_PLAYER(_current_player);
    87 		const Player *p = GetPlayer(_current_player);
    88 		int32 money = min(p->money64 - p->current_loan, atoi(e->edittext.str) / GetCurrentCurrencyRate());
    88 		int32 money = min(p->money64 - p->current_loan, atoi(e->edittext.str) / GetCurrentCurrencyRate());
    89 		char msg[20];
    89 		char msg[20];
    90 
    90 
    91 		money = clamp(money, 0, 20000000); // Clamp between 20 million and 0
    91 		money = clamp(money, 0, 20000000); // Clamp between 20 million and 0
    92 
    92 
   327 	ShowPlayerAircraft(index, -1);
   327 	ShowPlayerAircraft(index, -1);
   328 }
   328 }
   329 
   329 
   330 static void MenuClickBuildRail(int index)
   330 static void MenuClickBuildRail(int index)
   331 {
   331 {
   332 	Player *p = DEREF_PLAYER(_local_player);
   332 	Player *p = GetPlayer(_local_player);
   333 	_last_built_railtype = min(index, p->max_railtype-1);
   333 	_last_built_railtype = min(index, p->max_railtype-1);
   334 	ShowBuildRailToolbar(_last_built_railtype, -1);
   334 	ShowBuildRailToolbar(_last_built_railtype, -1);
   335 }
   335 }
   336 
   336 
   337 static void MenuClickBuildRoad(int index)
   337 static void MenuClickBuildRoad(int index)
   939 	}
   939 	}
   940 }
   940 }
   941 
   941 
   942 static void ToolbarBuildRailClick(Window *w)
   942 static void ToolbarBuildRailClick(Window *w)
   943 {
   943 {
   944 	Player *p = DEREF_PLAYER(_local_player);
   944 	Player *p = GetPlayer(_local_player);
   945 	Window *w2;
   945 	Window *w2;
   946 	w2 = PopupMainToolbMenu(w, 457, 19, STR_1015_RAILROAD_CONSTRUCTION, p->max_railtype);
   946 	w2 = PopupMainToolbMenu(w, 457, 19, STR_1015_RAILROAD_CONSTRUCTION, p->max_railtype);
   947 	WP(w2,menu_d).sel_index = _last_built_railtype;
   947 	WP(w2,menu_d).sel_index = _last_built_railtype;
   948 }
   948 }
   949 
   949 
  2209 
  2209 
  2210 static void StatusBarWndProc(Window *w, WindowEvent *e)
  2210 static void StatusBarWndProc(Window *w, WindowEvent *e)
  2211 {
  2211 {
  2212 	switch (e->event) {
  2212 	switch (e->event) {
  2213 	case WE_PAINT: {
  2213 	case WE_PAINT: {
  2214 		const Player *p = (_local_player == OWNER_SPECTATOR) ? NULL : DEREF_PLAYER(_local_player);
  2214 		const Player *p = (_local_player == OWNER_SPECTATOR) ? NULL : GetPlayer(_local_player);
  2215 
  2215 
  2216 		DrawWindowWidgets(w);
  2216 		DrawWindowWidgets(w);
  2217 		SetDParam(0, _date);
  2217 		SetDParam(0, _date);
  2218 		DrawStringCentered(70, 1, ((_pause||_patches.status_long_date)?STR_00AF:STR_00AE), 0);
  2218 		DrawStringCentered(70, 1, ((_pause||_patches.status_long_date)?STR_00AF:STR_00AE), 0);
  2219 
  2219