src/main_gui.cpp
branchNewGRF_ports
changeset 6868 7eb395287b3d
parent 6800 6c09e1e86fcb
child 6870 ca3fd1fbe311
equal deleted inserted replaced
6867:a4ad48192617 6868:7eb395287b3d
    88 		DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME));
    88 		DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME));
    89 		break;
    89 		break;
    90 #ifdef ENABLE_NETWORK
    90 #ifdef ENABLE_NETWORK
    91 	case 3: { // Give money, you can only give money in excess of loan
    91 	case 3: { // Give money, you can only give money in excess of loan
    92 		const Player *p = GetPlayer(_current_player);
    92 		const Player *p = GetPlayer(_current_player);
    93 		Money money = min(p->player_money - p->current_loan, atoi(str) / _currency->rate);
    93 		Money money = min(p->player_money - p->current_loan, (Money)(atoi(str) / _currency->rate));
    94 
    94 
    95 		uint32 money_c = clamp(ClampToI32(money), 0, 20000000); // Clamp between 20 million and 0
    95 		uint32 money_c = clamp(ClampToI32(money), 0, 20000000); // Clamp between 20 million and 0
    96 
    96 
    97 		/* Give 'id' the money, and substract it from ourself */
    97 		/* Give 'id' the money, and substract it from ourself */
    98 		DoCommandP(0, money_c, id, CcGiveMoney, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS));
    98 		DoCommandP(0, money_c, id, CcGiveMoney, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS));
  1084 
  1084 
  1085 	if (_terraform_size == 1) {
  1085 	if (_terraform_size == 1) {
  1086 		StringID msg =
  1086 		StringID msg =
  1087 			mode ? STR_0808_CAN_T_RAISE_LAND_HERE : STR_0809_CAN_T_LOWER_LAND_HERE;
  1087 			mode ? STR_0808_CAN_T_RAISE_LAND_HERE : STR_0809_CAN_T_LOWER_LAND_HERE;
  1088 
  1088 
  1089 		DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(msg));
  1089 		DoCommandP(tile, SLOPE_N, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(msg));
  1090 	} else {
  1090 	} else {
  1091 		SndPlayTileFx(SND_1F_SPLAT, tile);
  1091 		SndPlayTileFx(SND_1F_SPLAT, tile);
  1092 
  1092 
  1093 		assert(_terraform_size != 0);
  1093 		assert(_terraform_size != 0);
  1094 		/* check out for map overflows */
  1094 		/* check out for map overflows */
  1111 			} END_TILE_LOOP(tile2, sizex, sizey, tile)
  1111 			} END_TILE_LOOP(tile2, sizex, sizey, tile)
  1112 		}
  1112 		}
  1113 
  1113 
  1114 		BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) {
  1114 		BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) {
  1115 			if (TileHeight(tile2) == h) {
  1115 			if (TileHeight(tile2) == h) {
  1116 				DoCommandP(tile2, 8, (uint32)mode, NULL, CMD_TERRAFORM_LAND | CMD_AUTO);
  1116 				DoCommandP(tile2, SLOPE_N, (uint32)mode, NULL, CMD_TERRAFORM_LAND | CMD_AUTO);
  1117 			}
  1117 			}
  1118 		} END_TILE_LOOP(tile2, sizex, sizey, tile)
  1118 		} END_TILE_LOOP(tile2, sizex, sizey, tile)
  1119 	}
  1119 	}
  1120 
  1120 
  1121 	_generating_world = false;
  1121 	_generating_world = false;