summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/company_gui.cpp11
-rw-r--r--src/dock_gui.cpp2
-rw-r--r--src/gfx.cpp20
-rw-r--r--src/news_gui.cpp32
-rw-r--r--src/news_type.h19
-rw-r--r--src/settings_gui.cpp6
-rw-r--r--src/settings_internal.h3
-rw-r--r--src/station_cmd.cpp12
8 files changed, 65 insertions, 40 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 7b153196d..3f977333c 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -76,11 +76,18 @@ struct ExpensesList {
const ExpensesType *et; ///< Expenses items.
const int length; ///< Number of items in list.
const int height; ///< Height of list, 10 pixels per item, plus an additional 12 pixels per subtotal. */
+
+ ExpensesList(ExpensesType *et, int length, int height) :
+ et(et),
+ length(length),
+ height(height)
+ {
+ }
};
static const ExpensesList _expenses_list_types[] = {
- { _expenses_list_1, lengthof(_expenses_list_1), lengthof(_expenses_list_1) * 10 },
- { _expenses_list_2, lengthof(_expenses_list_2), lengthof(_expenses_list_2) * 10 + 3 * 12 },
+ ExpensesList(_expenses_list_1, lengthof(_expenses_list_1), lengthof(_expenses_list_1) * 10),
+ ExpensesList(_expenses_list_2, lengthof(_expenses_list_2), lengthof(_expenses_list_2) * 10 + 3 * 12),
};
/** Widgets of the company finances windows. */
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 3ec093c70..9f23793a3 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -46,7 +46,7 @@ void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2)
static void PlaceDocks_Dock(TileIndex tile)
{
- uint32 p2 = INVALID_STATION << 16; // no station to join
+ uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join
/* tile is always the land tile, so need to evaluate _thd.pos */
CommandContainer cmdcont = { tile, _ctrl_pressed, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" };
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 9f762301c..775cd94a5 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -1058,18 +1058,26 @@ void DoPaletteAnimations()
byte i = (_palette_animation_counter >> 1) & 0x7F;
byte v;
- (v = 255, i < 0x3f) ||
- (v = 128, i < 0x4A || i >= 0x75) ||
- (v = 20);
+ if (i < 0x3f) {
+ v = 255;
+ } else if (i < 0x4A || i >= 0x75) {
+ v = 128;
+ } else {
+ v = 20;
+ }
palette_pos->r = v;
palette_pos->g = 0;
palette_pos->b = 0;
palette_pos++;
i ^= 0x40;
- (v = 255, i < 0x3f) ||
- (v = 128, i < 0x4A || i >= 0x75) ||
- (v = 20);
+ if (i < 0x3f) {
+ v = 255;
+ } else if (i < 0x4A || i >= 0x75) {
+ v = 128;
+ } else {
+ v = 20;
+ }
palette_pos->r = v;
palette_pos->g = 0;
palette_pos->b = 0;
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index b2b12fc7e..3863af991 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -133,22 +133,22 @@ assert_compile(lengthof(_news_subtype_data) == NS_END);
* Per-NewsType data
*/
NewsTypeData _news_type_data[] = {
- /* name, age, sound, display, description */
- { "arrival_player", 60, SND_1D_APPLAUSE, ND_FULL, STR_NEWS_MESSAGE_TYPE_ARRIVAL_OF_FIRST_VEHICLE_OWN }, ///< NT_ARRIVAL_COMPANY
- { "arrival_other", 60, SND_1D_APPLAUSE, ND_FULL, STR_NEWS_MESSAGE_TYPE_ARRIVAL_OF_FIRST_VEHICLE_OTHER }, ///< NT_ARRIVAL_OTHER
- { "accident", 90, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_ACCIDENTS_DISASTERS }, ///< NT_ACCIDENT
- { "company_info", 60, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_COMPANY_INFORMATION }, ///< NT_COMPANY_INFO
- { "open", 90, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_INDUSTRY_OPEN }, ///< NT_INDUSTRY_OPEN
- { "close", 90, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CLOSE }, ///< NT_INDUSTRY_CLOSE
- { "economy", 30, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_ECONOMY_CHANGES }, ///< NT_ECONOMY
- { "production_player", 30, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CHANGES_SERVED_BY_COMPANY }, ///< NT_INDUSTRY_COMPANY
- { "production_other", 30, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CHANGES_SERVED_BY_OTHER }, ///< NT_INDUSTRY_OTHER
- { "production_nobody", 30, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CHANGES_UNSERVED }, ///< NT_INDUSTRY_NOBODY
- { "advice", 150, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_ADVICE_INFORMATION_ON_COMPANY }, ///< NT_ADVICE
- { "new_vehicles", 30, SND_1E_OOOOH, ND_FULL, STR_NEWS_MESSAGE_TYPE_NEW_VEHICLES }, ///< NT_NEW_VEHICLES
- { "acceptance", 90, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_CHANGES_OF_CARGO_ACCEPTANCE }, ///< NT_ACCEPTANCE
- { "subsidies", 180, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_SUBSIDIES }, ///< NT_SUBSIDIES
- { "general", 60, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_GENERAL_INFORMATION }, ///< NT_GENERAL
+ /* name, age, sound, description */
+ NewsTypeData("arrival_player", 60, SND_1D_APPLAUSE, STR_NEWS_MESSAGE_TYPE_ARRIVAL_OF_FIRST_VEHICLE_OWN ), ///< NT_ARRIVAL_COMPANY
+ NewsTypeData("arrival_other", 60, SND_1D_APPLAUSE, STR_NEWS_MESSAGE_TYPE_ARRIVAL_OF_FIRST_VEHICLE_OTHER ), ///< NT_ARRIVAL_OTHER
+ NewsTypeData("accident", 90, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_ACCIDENTS_DISASTERS ), ///< NT_ACCIDENT
+ NewsTypeData("company_info", 60, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_COMPANY_INFORMATION ), ///< NT_COMPANY_INFO
+ NewsTypeData("open", 90, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_INDUSTRY_OPEN ), ///< NT_INDUSTRY_OPEN
+ NewsTypeData("close", 90, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CLOSE ), ///< NT_INDUSTRY_CLOSE
+ NewsTypeData("economy", 30, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_ECONOMY_CHANGES ), ///< NT_ECONOMY
+ NewsTypeData("production_player", 30, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CHANGES_SERVED_BY_COMPANY ), ///< NT_INDUSTRY_COMPANY
+ NewsTypeData("production_other", 30, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CHANGES_SERVED_BY_OTHER ), ///< NT_INDUSTRY_OTHER
+ NewsTypeData("production_nobody", 30, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CHANGES_UNSERVED ), ///< NT_INDUSTRY_NOBODY
+ NewsTypeData("advice", 150, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_ADVICE_INFORMATION_ON_COMPANY ), ///< NT_ADVICE
+ NewsTypeData("new_vehicles", 30, SND_1E_OOOOH, STR_NEWS_MESSAGE_TYPE_NEW_VEHICLES ), ///< NT_NEW_VEHICLES
+ NewsTypeData("acceptance", 90, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_CHANGES_OF_CARGO_ACCEPTANCE ), ///< NT_ACCEPTANCE
+ NewsTypeData("subsidies", 180, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_SUBSIDIES ), ///< NT_SUBSIDIES
+ NewsTypeData("general", 60, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_GENERAL_INFORMATION ), ///< NT_GENERAL
};
assert_compile(lengthof(_news_type_data) == NT_END);
diff --git a/src/news_type.h b/src/news_type.h
index 2b76ecd5d..3372e1308 100644
--- a/src/news_type.h
+++ b/src/news_type.h
@@ -94,11 +94,20 @@ enum NewsDisplay {
* Per-NewsType data
*/
struct NewsTypeData {
- const char * const name; ///< Name
- const byte age; ///< Maximum age of news items (in days)
- const SoundFx sound; ///< Sound
- NewsDisplay display; ///< Display mode (off, summary, full)
- StringID description; ///< Description of the news type in news settings window
+ const char * const name; ///< Name
+ const byte age; ///< Maximum age of news items (in days)
+ const SoundFx sound; ///< Sound
+ NewsDisplay display; ///< Display mode (off, summary, full)
+ const StringID description; ///< Description of the news type in news settings window
+
+ NewsTypeData(const char *name, byte age, SoundFx sound, StringID description) :
+ name(name),
+ age(age),
+ sound(sound),
+ display(ND_FULL),
+ description(description)
+ {
+ }
};
struct NewsItem {
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 0a7da6f1d..70dfb70bb 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -563,7 +563,7 @@ public:
DrawArrowButtons(5, y, COLOUR_YELLOW,
(this->clicked_button == i) ? 1 + !!this->clicked_increase : 0,
editable && sdb->min != value,
- editable && sdb->max != value);
+ editable && sdb->max != (uint32)value);
value += sdb->str;
SetDParam(0, value);
@@ -992,7 +992,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd
value = (int32)ReadValue(var, sd->save.conv);
/* Draw [<][>] boxes for settings of an integer-type */
- DrawArrowButtons(x, y, COLOUR_YELLOW, state, editable && value != (sdb->flags & SGF_0ISDISABLED ? 0 : sdb->min), editable && value != sdb->max);
+ DrawArrowButtons(x, y, COLOUR_YELLOW, state, editable && value != (sdb->flags & SGF_0ISDISABLED ? 0 : sdb->min), editable && (uint32)value != sdb->max);
disabled = (value == 0) && (sdb->flags & SGF_0ISDISABLED);
if (disabled) {
@@ -1440,7 +1440,7 @@ struct GameSettingsWindow : Window {
/* Increase or decrease the value and clamp it to extremes */
if (x >= 10) {
value += step;
- if (value > sdb->max) value = sdb->max;
+ if ((uint32)value > sdb->max) value = (int32)sdb->max;
if (value < sdb->min) value = sdb->min; // skip between "disabled" and minimum
} else {
value -= step;
diff --git a/src/settings_internal.h b/src/settings_internal.h
index 192073799..9aaece98f 100644
--- a/src/settings_internal.h
+++ b/src/settings_internal.h
@@ -56,7 +56,8 @@ struct SettingDescBase {
const void *def; ///< default value given when none is present
SettingDescType cmd; ///< various flags for the variable
SettingGuiFlag flags; ///< handles how a setting would show up in the GUI (text/currency, etc.)
- int32 min, max; ///< minimum and maximum values
+ int32 min; ///< minimum values
+ uint32 max; ///< maximum values
int32 interval; ///< the interval to use between settings in the 'settings' window. If interval is '0' the interval is dynamically determined
const char *many; ///< ONE/MANY_OF_MANY: string of possible values for this type
StringID str; ///< (translated) string with descriptive text; gui and console
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 23ac09e7b..85e12fa25 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -247,12 +247,12 @@ static bool FindNearIndustryName(TileIndex tile, void *user_data)
static StringID GenerateStationName(Station *st, TileIndex tile, int flag)
{
static const uint32 _gen_station_name_bits[] = {
- 0, // 0
- 1 << M(STR_SV_STNAME_AIRPORT), // 1
- 1 << M(STR_SV_STNAME_OILFIELD), // 2
- 1 << M(STR_SV_STNAME_DOCKS), // 3
- 0x1FF << M(STR_SV_STNAME_BUOY_1), // 4
- 1 << M(STR_SV_STNAME_HELIPORT), // 5
+ 0, // 0
+ 1U << M(STR_SV_STNAME_AIRPORT), // 1
+ 1U << M(STR_SV_STNAME_OILFIELD), // 2
+ 1U << M(STR_SV_STNAME_DOCKS), // 3
+ 0x1FFU << M(STR_SV_STNAME_BUOY_1), // 4
+ 1U << M(STR_SV_STNAME_HELIPORT), // 5
};
const Town *t = st->town;