Fixed Android compilation and warnings
This commit is contained in:
@@ -59,6 +59,8 @@ add_files(
|
||||
base_media_base.h
|
||||
base_media_func.h
|
||||
base_station_base.h
|
||||
build_confirmation_func.h
|
||||
build_confirmation_gui.cpp
|
||||
bitmap_type.h
|
||||
bmp.cpp
|
||||
bmp.h
|
||||
@@ -447,6 +449,8 @@ add_files(
|
||||
tunnelbridge.h
|
||||
tunnelbridge_cmd.cpp
|
||||
tunnelbridge_map.h
|
||||
tutorial_gui.cpp
|
||||
tutorial_gui.h
|
||||
vehicle.cpp
|
||||
vehicle_base.h
|
||||
vehicle_cmd.cpp
|
||||
|
||||
@@ -217,9 +217,9 @@ public:
|
||||
|
||||
/* Reduce overbright strength */
|
||||
ob /= 2;
|
||||
return Colour16( r >= 31 ? 31 : min(r + ob * (31 - r) / 32, 31),
|
||||
g >= 63 ? 63 : min(g + ob * (63 - g) / 64, 63),
|
||||
b >= 31 ? 31 : min(b + ob * (31 - b) / 32, 31) );
|
||||
return Colour16( r >= 31 ? 31 : std::min(r + ob * (31 - r) / 32, 31),
|
||||
g >= 63 ? 63 : std::min(g + ob * (63 - g) / 64, 63),
|
||||
b >= 31 ? 31 : std::min(b + ob * (31 - b) / 32, 31) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ Sprite *Blitter_16bppSimple::Encode(const SpriteLoader::Sprite *sprite, Allocato
|
||||
dst[i].v = 0;
|
||||
} else {
|
||||
/* Get brightest value */
|
||||
uint8 rgb_max = max(src->r, max(src->g, src->b));
|
||||
uint8 rgb_max = std::max(src->r, std::max(src->g, src->b));
|
||||
#if 0
|
||||
/* Pre-convert the mapping channel to a RGB value,
|
||||
use 32bpp AdjustBrightness() variant for better colors,
|
||||
|
||||
@@ -13,6 +13,10 @@ add_files(
|
||||
8bpp_optimized.hpp
|
||||
8bpp_simple.cpp
|
||||
8bpp_simple.hpp
|
||||
16bpp_base.cpp
|
||||
16bpp_base.hpp
|
||||
16bpp_simple.cpp
|
||||
16bpp_simple.hpp
|
||||
CONDITION NOT OPTION_DEDICATED
|
||||
)
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ struct BuildInfoWindow : public Window
|
||||
CLRBITS(this->flags, WF_WHITE_BORDER);
|
||||
}
|
||||
|
||||
virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
|
||||
Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override
|
||||
{
|
||||
Point pt;
|
||||
pt.y = GetMainViewTop();
|
||||
@@ -76,7 +76,7 @@ struct BuildInfoWindow : public Window
|
||||
return pt;
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
size->width = GetStringBoundingBox(STR_STATION_BUILD_COVERAGE_AREA_TITLE).width * 2.5;
|
||||
size->height = GetStringHeight(STR_STATION_BUILD_COVERAGE_AREA_TITLE, size->width) * (this->station ? 3 : 1);
|
||||
@@ -86,7 +86,7 @@ struct BuildInfoWindow : public Window
|
||||
size->height += 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
{
|
||||
/* There is only one widget. */
|
||||
GfxFillRect(r.left, r.top, r.right, r.bottom, PC_BLACK);
|
||||
@@ -164,7 +164,7 @@ struct BuildConfirmationWindow : Window {
|
||||
BuildConfirmationWindow::shown = false;
|
||||
}
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count)
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_BC_OK:
|
||||
@@ -185,7 +185,7 @@ struct BuildConfirmationWindow : Window {
|
||||
HideBuildConfirmationWindow(); // this == NULL after this call
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_BC_OK:
|
||||
@@ -195,7 +195,7 @@ struct BuildConfirmationWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnPaint()
|
||||
void OnPaint() override
|
||||
{
|
||||
this->DrawWidgets();
|
||||
|
||||
@@ -255,7 +255,7 @@ void ShowBuildConfirmationWindow()
|
||||
w->viewport->left += w->left - old_left;
|
||||
w->viewport->top += w->top - old_top;
|
||||
w->SetDirty();
|
||||
SetDirtyBlocks(0, 0, _screen.width, _screen.height); // I don't know what does this do, but it looks important
|
||||
MarkWholeScreenDirty(); // I don't know what does this do, but it looks important
|
||||
|
||||
BuildInfoWindow::show();
|
||||
}
|
||||
|
||||
@@ -306,10 +306,10 @@ struct BuildDocksToolbarWindow : Window {
|
||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||
}
|
||||
|
||||
virtual void SelectLastTool()
|
||||
void SelectLastTool() override
|
||||
{
|
||||
// User misplaced something - activate last selected tool again
|
||||
if (this->last_clicked_widget == WIDGET_LIST_END)
|
||||
if (this->last_clicked_widget == WID_DT_INVALID)
|
||||
return;
|
||||
Point dummy = {0, 0};
|
||||
this->RaiseWidget(this->last_clicked_widget);
|
||||
|
||||
@@ -732,15 +732,14 @@ public:
|
||||
break;
|
||||
|
||||
case WID_SL_LOAD_NETWORK_BUTTON: {
|
||||
char savePath[PATH_MAX];
|
||||
FiosMakeSavegameName(savePath, NETWORK_SAVE_FILENAME, lastof(savePath));
|
||||
std::string savePath = FiosMakeSavegameName(NETWORK_SAVE_FILENAME);
|
||||
#ifdef __ANDROID__
|
||||
if (!SDL_ANDROID_CloudLoad(savePath, NULL, "OpenTTD")) {
|
||||
if (!SDL_ANDROID_CloudLoad(savePath.c_str(), NULL, "OpenTTD")) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
_file_to_saveload.SetMode(FIOS_TYPE_FILE);
|
||||
_file_to_saveload.SetName(savePath);
|
||||
_file_to_saveload.SetName(savePath.c_str());
|
||||
_file_to_saveload.SetTitle("Network Save");
|
||||
_switch_mode = SM_LOAD_GAME;
|
||||
break;
|
||||
|
||||
@@ -208,7 +208,7 @@ static inline int Center(int top, int height, uint size = FONT_HEIGHT_NORMAL)
|
||||
*/
|
||||
static inline int RescaleFrom854x480(int value)
|
||||
{
|
||||
return min(value * _cur_resolution.width / 854, value * _cur_resolution.height / 480);
|
||||
return std::min(value * _cur_resolution.width / 854, value * _cur_resolution.height / 480);
|
||||
}
|
||||
|
||||
extern DrawPixelInfo *_cur_dpi;
|
||||
|
||||
@@ -648,12 +648,12 @@ public:
|
||||
MoveAllWindowsOffScreen();
|
||||
}
|
||||
|
||||
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
|
||||
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
|
||||
{
|
||||
VpSelectTilesWithMethod(pt.x, pt.y, select_method);
|
||||
}
|
||||
|
||||
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
|
||||
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
|
||||
{
|
||||
if (pt.x == -1) return;
|
||||
assert(end_tile == start_tile);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "error.h"
|
||||
#include "news_gui.h"
|
||||
#include "tutorial_gui.h"
|
||||
#include "gui.h"
|
||||
|
||||
#include "saveload/saveload.h"
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ void Android_MidiMixMusic(Sint16 *stream, int len)
|
||||
Sint16 buf[16384];
|
||||
while( len > 0 )
|
||||
{
|
||||
int minlen = min(sizeof(buf), len);
|
||||
mid_song_read_wave(_midi.song, buf, min(sizeof(buf), len*2));
|
||||
int minlen = std::min<int>(sizeof(buf), len);
|
||||
mid_song_read_wave(_midi.song, buf, std::min<int>(sizeof(buf), len*2));
|
||||
for( Uint16 i = 0; i < minlen; i++ )
|
||||
stream[i] += buf[i];
|
||||
stream += minlen;
|
||||
|
||||
@@ -543,7 +543,7 @@ struct MusicTrackSelectionWindow : public Window {
|
||||
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK);
|
||||
|
||||
int y = r.top + WD_FRAMERECT_TOP;
|
||||
uint vscroll_max = min(this->left_sb->GetPosition() + this->left_sb->GetCapacity(), NUM_SONGS_AVAILABLE);
|
||||
uint vscroll_max = std::min<uint>(this->left_sb->GetPosition() + this->left_sb->GetCapacity(), NUM_SONGS_AVAILABLE);
|
||||
uint i = 0;
|
||||
for (MusicSystem::Playlist::const_iterator song = _music.music_set.begin(); song != _music.music_set.end(); ++song, i++) {
|
||||
if (i < this->left_sb->GetPosition()) continue;
|
||||
@@ -561,7 +561,7 @@ struct MusicTrackSelectionWindow : public Window {
|
||||
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK);
|
||||
|
||||
int y = r.top + WD_FRAMERECT_TOP;
|
||||
uint vscroll_max = min(this->right_sb->GetPosition() + this->right_sb->GetCapacity(), this->GetNumberOfTracksOfTracklist());
|
||||
uint vscroll_max = std::min<uint>(this->right_sb->GetPosition() + this->right_sb->GetCapacity(), this->GetNumberOfTracksOfTracklist());
|
||||
uint i = 0;
|
||||
for (MusicSystem::Playlist::const_iterator song = _music.music_set.begin(); song != _music.music_set.end(); ++song, i++) {
|
||||
if (i < this->right_sb->GetPosition()) continue;
|
||||
@@ -620,7 +620,7 @@ struct MusicTrackSelectionWindow : public Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnResize()
|
||||
void OnResize() override
|
||||
{
|
||||
this->left_sb->SetCapacityFromWidget(this, WID_MTS_LIST_LEFT);
|
||||
this->right_sb->SetCapacityFromWidget(this, WID_MTS_LIST_RIGHT);
|
||||
|
||||
@@ -1772,15 +1772,15 @@ struct NetworkClientListPopupWindow : Window {
|
||||
void OnMouseLoop() override
|
||||
{
|
||||
/* We selected an action */
|
||||
uint index = (_cursor.pos.y - this->top - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL;
|
||||
int index = (_cursor.pos.y - this->top - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL;
|
||||
|
||||
if (_left_button_down) {
|
||||
if (index == this->sel_index || index >= this->actions.size()) return;
|
||||
if (index == this->sel_index || index >= (int)this->actions.size()) return;
|
||||
|
||||
this->sel_index = index;
|
||||
this->SetDirty();
|
||||
} else {
|
||||
if (index < this->actions.size() && _cursor.pos.y >= this->top) {
|
||||
if (index < (int)this->actions.size() && _cursor.pos.y >= this->top) {
|
||||
const NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(this->client_id);
|
||||
if (ci != nullptr) this->actions[index].proc(ci);
|
||||
}
|
||||
@@ -1862,7 +1862,7 @@ struct NetworkClientListWindow : Window {
|
||||
|
||||
int cols = 1 + (num - 1) / MAX_ROWS;
|
||||
cols *= this->line_width;
|
||||
num = min(num, MAX_ROWS);
|
||||
num = std::min<int>(num, MAX_ROWS);
|
||||
num *= this->line_height;
|
||||
|
||||
int diffx = (cols + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT) - (this->GetWidget<NWidgetBase>(WID_CL_PANEL)->current_x);
|
||||
|
||||
@@ -387,7 +387,7 @@ struct NewsWindow : Window {
|
||||
Dimension d2 = GetStringBoundingBox(this->GetWidget<NWidgetCore>(WID_N_SHOW_GROUP)->widget_data);
|
||||
d2.height += WD_CAPTIONTEXT_TOP + WD_CAPTIONTEXT_BOTTOM;
|
||||
d2.width += WD_CAPTIONTEXT_LEFT + WD_CAPTIONTEXT_RIGHT;
|
||||
d2.width = max(d2.width, GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL));
|
||||
d2.width = std::max(d2.width, GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL));
|
||||
*size = d2;
|
||||
} else {
|
||||
/* Hide 'Show group window' button if this news is not about a vehicle. */
|
||||
|
||||
@@ -1173,17 +1173,16 @@ void SwitchToMode(SwitchMode new_mode)
|
||||
DeleteWindowById(WC_SAVELOAD, 0);
|
||||
#ifdef __ANDROID__
|
||||
if (_settings_client.gui.save_to_network) {
|
||||
char screenshotFile[PATH_MAX] = "";
|
||||
const char* lastPart = strrchr(_file_to_saveload.name, PATHSEPCHAR);
|
||||
const char* lastPart = strrchr(_file_to_saveload.name.c_str(), PATHSEPCHAR);
|
||||
if (!lastPart) {
|
||||
lastPart = _file_to_saveload.name;
|
||||
lastPart = _file_to_saveload.name.c_str();
|
||||
} else {
|
||||
lastPart++;
|
||||
}
|
||||
MakeScreenshot(SC_VIEWPORT, NETWORK_SAVE_SCREENSHOT_FILE);
|
||||
FioFindFullPath(screenshotFile, lastof(screenshotFile), SCREENSHOT_DIR, NETWORK_SAVE_SCREENSHOT_FILE_PNG);
|
||||
std::string screenshotFile = FioFindFullPath(SCREENSHOT_DIR, NETWORK_SAVE_SCREENSHOT_FILE_PNG);
|
||||
uint64_t playedTime = abs(_date - DAYS_TILL(_settings_newgame.game_creation.starting_year)) * 1000;
|
||||
int ret = SDL_ANDROID_CloudSave(_file_to_saveload.name, lastPart, "OpenTTD", lastPart, screenshotFile, playedTime);
|
||||
int ret = SDL_ANDROID_CloudSave(_file_to_saveload.name.c_str(), lastPart, "OpenTTD", lastPart, screenshotFile.c_str(), playedTime);
|
||||
if (_settings_client.gui.save_to_network == 2) {
|
||||
_settings_client.gui.save_to_network = ret ? 1 : 0;
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ static const int INTER_KEY_SPACE = 2; // Number of pixels between two keys.
|
||||
*/
|
||||
static void AddKey(NWidgetHorizontal *hor, int height, int num_half, WidgetType widtype, int widnum, uint16 widdata, int *biggest_index)
|
||||
{
|
||||
int min_half_key = max<int>(GetMinSizing(NWST_BUTTON), HALF_KEY_WIDTH);
|
||||
int min_half_key = std::max<int>(GetMinSizing(NWST_BUTTON), HALF_KEY_WIDTH);
|
||||
int key_width = min_half_key + (INTER_KEY_SPACE + min_half_key) * (num_half - 1);
|
||||
|
||||
if (widtype == NWID_SPACER) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "../../widgets/autoreplace_widget.h"
|
||||
#include "../../widgets/bootstrap_widget.h"
|
||||
#include "../../widgets/bridge_widget.h"
|
||||
#include "../../widgets/build_confirmation_widget.h"
|
||||
#include "../../widgets/build_vehicle_widget.h"
|
||||
#include "../../widgets/cheat_widget.h"
|
||||
#include "../../widgets/company_widget.h"
|
||||
|
||||
@@ -500,8 +500,7 @@ struct GameOptionsWindow : Window {
|
||||
|
||||
case WID_GO_8BPP_BUTTON:
|
||||
if (this->IsWidgetLowered(WID_GO_8BPP_BUTTON)) break;
|
||||
free(_ini_blitter);
|
||||
_ini_blitter = stredup("8bpp-optimized");
|
||||
_ini_blitter = "8bpp-optimized";
|
||||
_exit_game = true;
|
||||
_restart_game = true;
|
||||
#ifdef __ANDROID__
|
||||
@@ -511,8 +510,7 @@ struct GameOptionsWindow : Window {
|
||||
|
||||
case WID_GO_16BPP_BUTTON:
|
||||
if (this->IsWidgetLowered(WID_GO_16BPP_BUTTON)) break;
|
||||
free(_ini_blitter);
|
||||
_ini_blitter = stredup("16bpp-simple");
|
||||
_ini_blitter = "16bpp-simple";
|
||||
_exit_game = true;
|
||||
_restart_game = true;
|
||||
#ifdef __ANDROID__
|
||||
@@ -522,8 +520,7 @@ struct GameOptionsWindow : Window {
|
||||
|
||||
case WID_GO_32BPP_BUTTON:
|
||||
if (this->IsWidgetLowered(WID_GO_32BPP_BUTTON)) break;
|
||||
free(_ini_blitter);
|
||||
_ini_blitter = stredup("32bpp-anim");
|
||||
_ini_blitter = "32bpp-anim";
|
||||
_exit_game = true;
|
||||
_restart_game = true;
|
||||
#ifdef __ANDROID__
|
||||
@@ -667,9 +664,9 @@ struct GameOptionsWindow : Window {
|
||||
#ifdef WIN32
|
||||
this->SetWidgetLoweredState(WID_GO_FULLSCREEN_BUTTON, _fullscreen);
|
||||
#else
|
||||
this->SetWidgetLoweredState(WID_GO_8BPP_BUTTON, _ini_blitter != NULL && strcmp(_ini_blitter, "8bpp-optimized") == 0);
|
||||
this->SetWidgetLoweredState(WID_GO_16BPP_BUTTON, _ini_blitter == NULL || strcmp(_ini_blitter, "16bpp-simple") == 0);
|
||||
this->SetWidgetLoweredState(WID_GO_32BPP_BUTTON, _ini_blitter != NULL && strcmp(_ini_blitter, "32bpp-anim") == 0);
|
||||
this->SetWidgetLoweredState(WID_GO_8BPP_BUTTON, _ini_blitter == "8bpp-optimized");
|
||||
this->SetWidgetLoweredState(WID_GO_16BPP_BUTTON, _ini_blitter == "16bpp-simple");
|
||||
this->SetWidgetLoweredState(WID_GO_32BPP_BUTTON, _ini_blitter == "32bpp-anim" || _ini_blitter == "");
|
||||
#endif
|
||||
|
||||
bool missing_files = BaseGraphics::GetUsedSet()->GetNumMissing() == 0;
|
||||
|
||||
@@ -266,7 +266,7 @@ struct SignListWindow : Window, SignList {
|
||||
Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON);
|
||||
this->text_offset = WD_FRAMETEXT_LEFT + spr_dim.width + 2; // 2 pixels space between icon and the sign text.
|
||||
resize->height = std::max<uint>(FONT_HEIGHT_NORMAL, spr_dim.height);
|
||||
resize->height = GetMinSizing(NWST_STEP), resize->height);
|
||||
resize->height = std::max(GetMinSizing(NWST_STEP), resize->height);
|
||||
Dimension d = {(uint)(this->text_offset + WD_FRAMETEXT_RIGHT), WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM};
|
||||
*size = maxdim(*size, d);
|
||||
break;
|
||||
|
||||
@@ -1077,7 +1077,7 @@ void SmallMapWindow::SetupWidgetData()
|
||||
|
||||
SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) :
|
||||
Window(desc),
|
||||
row_height(max(GetMinSizing(NWST_STEP, FONT_HEIGHT_SMALL) * 2 / 3, uint(FONT_HEIGHT_SMALL))), // Default spacing makes legend too tall - shrink it by 1/3
|
||||
row_height(std::max(GetMinSizing(NWST_STEP, FONT_HEIGHT_SMALL) * 2 / 3, uint(FONT_HEIGHT_SMALL))), // Default spacing makes legend too tall - shrink it by 1/3
|
||||
refresh(GUITimer(FORCE_REFRESH_PERIOD))
|
||||
{
|
||||
_smallmap_industry_highlight = INVALID_INDUSTRYTYPE;
|
||||
@@ -1178,7 +1178,7 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
|
||||
num_columns++;
|
||||
}
|
||||
height++;
|
||||
min_width = max(GetStringBoundingBox(str).width, min_width);
|
||||
min_width = std::max(GetStringBoundingBox(str).width, min_width);
|
||||
}
|
||||
this->min_number_of_fixed_rows = std::max(this->min_number_of_fixed_rows, height);
|
||||
this->min_number_of_columns = std::max(this->min_number_of_columns, num_columns);
|
||||
|
||||
@@ -286,7 +286,7 @@ struct TerraformToolbarWindow : Window {
|
||||
this->RaiseButtons();
|
||||
}
|
||||
|
||||
virtual void SelectLastTool()
|
||||
void SelectLastTool() override
|
||||
{
|
||||
// User misplaced something - activate last selected tool again
|
||||
if (this->last_user_action == WIDGET_LIST_END)
|
||||
|
||||
@@ -1520,7 +1520,7 @@ public:
|
||||
uint spacer_space = std::max(0, (int)given_width - (int)(button_count * this->smallest_x)); // Remaining spacing for 'spacer' widgets
|
||||
uint button_space = given_width - spacer_space; // Remaining spacing for the buttons
|
||||
if (type == NWID_VERTICAL) {
|
||||
spacer_space = max(0, (int)given_height - (int)(button_count * this->smallest_y));
|
||||
spacer_space = std::max(0, (int)given_height - (int)(button_count * this->smallest_y));
|
||||
button_space = given_height - spacer_space;
|
||||
}
|
||||
uint spacer_i = 0;
|
||||
@@ -2250,7 +2250,7 @@ class NWidgetMainToolbarContainer : public NWidgetToolbarContainer {
|
||||
};
|
||||
|
||||
/* If at least BIGGEST_ARRANGEMENT fit, just spread all the buttons nicely */
|
||||
uint full_buttons = max(CeilDiv(width, this->smallest_x), SMALLEST_ARRANGEMENT);
|
||||
uint full_buttons = std::max(CeilDiv(width, this->smallest_x), SMALLEST_ARRANGEMENT);
|
||||
if (full_buttons > BIGGEST_ARRANGEMENT) {
|
||||
button_count = arrangable_count = _settings_client.gui.build_confirmation ? lengthof(arrange_all) : lengthof(arrange_all_shift);
|
||||
spacer_count = this->spacers;
|
||||
@@ -2998,7 +2998,7 @@ static NWidgetBase *MakeVerticalLeftToolbar(int *biggest_index)
|
||||
tb->Add(new NWidgetLeaf(WWT_TEXTBTN, COLOUR_GREY, WID_TN_SHIFT, STR_TABLET_SHIFT, STR_TABLET_SHIFT_TOOLTIP));
|
||||
tb->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TN_DELETE, STR_TABLET_CLOSE, STR_TABLET_CLOSE_TOOLTIP));
|
||||
|
||||
*biggest_index = max<int>(*biggest_index, WID_TN_DELETE);
|
||||
*biggest_index = std::max<int>(*biggest_index, WID_TN_DELETE);
|
||||
return tb;
|
||||
}
|
||||
|
||||
@@ -3025,7 +3025,7 @@ static NWidgetBase *MakeVerticalRightToolbar(int *biggest_index)
|
||||
tb->Add(new NWidgetLeaf(WWT_TEXTBTN, COLOUR_GREY, WID_TN_SHIFT, STR_TABLET_SHIFT, STR_TABLET_SHIFT_TOOLTIP));
|
||||
tb->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TN_DELETE, STR_TABLET_CLOSE, STR_TABLET_CLOSE_TOOLTIP));
|
||||
|
||||
*biggest_index = max<int>(*biggest_index, WID_TN_DELETE);
|
||||
*biggest_index = std::max<int>(*biggest_index, WID_TN_DELETE);
|
||||
return tb;
|
||||
}
|
||||
|
||||
@@ -3403,7 +3403,7 @@ void AllocateToolbar()
|
||||
w->left = 0;
|
||||
w = new MainToolbarWindow(&_toolb_vertical_right_desc, &_last_clicked_toolbar_idx, 1);
|
||||
w->left = _screen.width - w->width;
|
||||
SetDirtyBlocks(0, w->top, _screen.width, w->top + w->height);
|
||||
AddDirtyBlock(0, w->top, _screen.width, w->top + w->height);
|
||||
} else {
|
||||
new MainToolbarWindow(&_toolb_normal_desc);
|
||||
}
|
||||
|
||||
@@ -614,7 +614,6 @@ static const NWidgetPart _nested_town_editor_view_widgets[] = {
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TV_INFO), SetMinimalSize(260, 32), SetResize(1, 0), SetFill(1, 0), EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_TV_CHANGE_NAME), SetMinimalSize(76, 14), SetDataTip(STR_BUTTON_RENAME, STR_TOWN_VIEW_RENAME_TOOLTIP),
|
||||
NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_TV_CENTER_VIEW), SetMinimalSize(12, 14), SetFill(1, 1), SetResize(1, 0), SetDataTip(SPR_GOTO_LOCATION, STR_TOWN_VIEW_CENTER_TOOLTIP),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_TV_EXPAND), SetMinimalSize(80, 12), SetFill(1, 1), SetResize(1, 0), SetDataTip(STR_TOWN_VIEW_EXPAND_BUTTON, STR_TOWN_VIEW_EXPAND_TOOLTIP),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_TV_DELETE), SetMinimalSize(80, 12), SetFill(1, 1), SetResize(1, 0), SetDataTip(STR_TOWN_VIEW_DELETE_BUTTON, STR_TOWN_VIEW_DELETE_TOOLTIP),
|
||||
@@ -1234,12 +1233,12 @@ public:
|
||||
MoveAllWindowsOffScreen();
|
||||
}
|
||||
|
||||
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
|
||||
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
|
||||
{
|
||||
VpSelectTilesWithMethod(pt.x, pt.y, select_method);
|
||||
}
|
||||
|
||||
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
|
||||
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
|
||||
{
|
||||
assert(start_tile == end_tile);
|
||||
this->ExecuteFoundTownCommand(end_tile, false, STR_ERROR_CAN_T_FOUND_TOWN_HERE, CcFoundTown);
|
||||
|
||||
@@ -754,7 +754,7 @@ struct RefitWindow : public Window {
|
||||
break;
|
||||
|
||||
case WID_VR_VEHICLE_PANEL_DISPLAY:
|
||||
size->height = max((int)GetMinSizing(NWST_STEP), ScaleGUITrad(GetVehicleHeight(Vehicle::Get(this->window_number)->type)));
|
||||
size->height = std::max<uint>(GetMinSizing(NWST_STEP), ScaleGUITrad(GetVehicleHeight(Vehicle::Get(this->window_number)->type)));
|
||||
break;
|
||||
|
||||
case WID_VR_INFO:
|
||||
|
||||
@@ -2360,7 +2360,7 @@ bool HandleViewportClicked(const Viewport *vp, int x, int y)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HandleViewportMouseUp(const ViewPort *vp, int x, int y)
|
||||
bool HandleViewportMouseUp(const Viewport *vp, int x, int y)
|
||||
{
|
||||
if (_move_pressed) return false;
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in
|
||||
w->mouse_capture_widget = sb->index;
|
||||
_cursorpos_drag_start.x = x;
|
||||
_cursorpos_drag_start.y = y;
|
||||
_scrollbar_size = max(1, (int) sb->current_y * sb->GetCount() / sb->GetCapacity());
|
||||
_scrollbar_size = std::max(1, (int) sb->current_y * sb->GetCount() / sb->GetCapacity());
|
||||
_scrollbar_start_pos = sb->GetPosition() * _scrollbar_size / sb->GetCount();
|
||||
w->SetDirty();
|
||||
return;
|
||||
@@ -3259,5 +3259,5 @@ uint GetMinSizing(NWidSizingType type, uint min_1)
|
||||
}
|
||||
min_sizing = RescaleFrom854x480(min_sizing);
|
||||
|
||||
return max(min_sizing, min_1);
|
||||
return std::max(min_sizing, min_1);
|
||||
}
|
||||
|
||||
@@ -3063,7 +3063,7 @@ static void HandleContinuousScroll()
|
||||
if (_scrolling_viewport && _right_button_down) {
|
||||
Window *w = FindWindowFromPt(_right_button_down_pos.x, _right_button_down_pos.y);
|
||||
if (w == NULL || w->flags & WF_DISABLE_VP_SCROLL) return;
|
||||
ViewPort *vp = IsPtInWindowViewport(w, _right_button_down_pos.x, _right_button_down_pos.y);
|
||||
Viewport *vp = IsPtInWindowViewport(w, _right_button_down_pos.x, _right_button_down_pos.y);
|
||||
if (vp == NULL) return;
|
||||
|
||||
w->viewport->dest_scrollpos_x += ScaleByZoom(scrollspeed * (_right_button_down_pos.x - _cursor.pos.x), vp->zoom);
|
||||
@@ -3922,7 +3922,7 @@ void RelocateAllWindows(int neww, int newh)
|
||||
break;
|
||||
|
||||
case WC_STATUS_BAR:
|
||||
ResizeWindow(w, std::min<uint>(neww, std::min(_toolbar_width, _screen.width - SETTING_BUTTON_HEIGHT * 2)) - w->width, 0, false);
|
||||
ResizeWindow(w, std::min<uint>(neww, std::min<int>(_toolbar_width, _screen.width - SETTING_BUTTON_HEIGHT * 2)) - w->width, 0, false);
|
||||
|
||||
top = newh - w->height;
|
||||
left = PositionStatusbar(w);
|
||||
|
||||
Reference in New Issue
Block a user