(svn r16297) -Codechange: silence more ICC warnings

This commit is contained in:
rubidium 2009-05-13 17:39:00 +00:00
parent d23f616e9f
commit 5f81ba886c
8 changed files with 65 additions and 40 deletions

View File

@ -76,11 +76,18 @@ struct ExpensesList {
const ExpensesType *et; ///< Expenses items. const ExpensesType *et; ///< Expenses items.
const int length; ///< Number of items in list. 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. */ 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[] = { static const ExpensesList _expenses_list_types[] = {
{ _expenses_list_1, lengthof(_expenses_list_1), lengthof(_expenses_list_1) * 10 }, ExpensesList(_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_2, lengthof(_expenses_list_2), lengthof(_expenses_list_2) * 10 + 3 * 12),
}; };
/** Widgets of the company finances windows. */ /** Widgets of the company finances windows. */

View File

@ -46,7 +46,7 @@ void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2)
static void PlaceDocks_Dock(TileIndex tile) 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 */ /* 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, "" }; CommandContainer cmdcont = { tile, _ctrl_pressed, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" };

View File

@ -1058,18 +1058,26 @@ void DoPaletteAnimations()
byte i = (_palette_animation_counter >> 1) & 0x7F; byte i = (_palette_animation_counter >> 1) & 0x7F;
byte v; byte v;
(v = 255, i < 0x3f) || if (i < 0x3f) {
(v = 128, i < 0x4A || i >= 0x75) || v = 255;
(v = 20); } else if (i < 0x4A || i >= 0x75) {
v = 128;
} else {
v = 20;
}
palette_pos->r = v; palette_pos->r = v;
palette_pos->g = 0; palette_pos->g = 0;
palette_pos->b = 0; palette_pos->b = 0;
palette_pos++; palette_pos++;
i ^= 0x40; i ^= 0x40;
(v = 255, i < 0x3f) || if (i < 0x3f) {
(v = 128, i < 0x4A || i >= 0x75) || v = 255;
(v = 20); } else if (i < 0x4A || i >= 0x75) {
v = 128;
} else {
v = 20;
}
palette_pos->r = v; palette_pos->r = v;
palette_pos->g = 0; palette_pos->g = 0;
palette_pos->b = 0; palette_pos->b = 0;

View File

@ -133,22 +133,22 @@ assert_compile(lengthof(_news_subtype_data) == NS_END);
* Per-NewsType data * Per-NewsType data
*/ */
NewsTypeData _news_type_data[] = { NewsTypeData _news_type_data[] = {
/* name, age, sound, display, description */ /* name, age, sound, description */
{ "arrival_player", 60, SND_1D_APPLAUSE, ND_FULL, STR_NEWS_MESSAGE_TYPE_ARRIVAL_OF_FIRST_VEHICLE_OWN }, ///< NT_ARRIVAL_COMPANY NewsTypeData("arrival_player", 60, SND_1D_APPLAUSE, 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 NewsTypeData("arrival_other", 60, SND_1D_APPLAUSE, 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 NewsTypeData("accident", 90, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_ACCIDENTS_DISASTERS ), ///< NT_ACCIDENT
{ "company_info", 60, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_COMPANY_INFORMATION }, ///< NT_COMPANY_INFO NewsTypeData("company_info", 60, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_COMPANY_INFORMATION ), ///< NT_COMPANY_INFO
{ "open", 90, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_INDUSTRY_OPEN }, ///< NT_INDUSTRY_OPEN NewsTypeData("open", 90, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_INDUSTRY_OPEN ), ///< NT_INDUSTRY_OPEN
{ "close", 90, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CLOSE }, ///< NT_INDUSTRY_CLOSE NewsTypeData("close", 90, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CLOSE ), ///< NT_INDUSTRY_CLOSE
{ "economy", 30, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_ECONOMY_CHANGES }, ///< NT_ECONOMY NewsTypeData("economy", 30, SND_BEGIN, 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 NewsTypeData("production_player", 30, SND_BEGIN, 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 NewsTypeData("production_other", 30, SND_BEGIN, 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 NewsTypeData("production_nobody", 30, SND_BEGIN, 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 NewsTypeData("advice", 150, SND_BEGIN, 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 NewsTypeData("new_vehicles", 30, SND_1E_OOOOH, 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 NewsTypeData("acceptance", 90, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_CHANGES_OF_CARGO_ACCEPTANCE ), ///< NT_ACCEPTANCE
{ "subsidies", 180, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_SUBSIDIES }, ///< NT_SUBSIDIES NewsTypeData("subsidies", 180, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_SUBSIDIES ), ///< NT_SUBSIDIES
{ "general", 60, SND_BEGIN, ND_FULL, STR_NEWS_MESSAGE_TYPE_GENERAL_INFORMATION }, ///< NT_GENERAL NewsTypeData("general", 60, SND_BEGIN, STR_NEWS_MESSAGE_TYPE_GENERAL_INFORMATION ), ///< NT_GENERAL
}; };
assert_compile(lengthof(_news_type_data) == NT_END); assert_compile(lengthof(_news_type_data) == NT_END);

View File

@ -94,11 +94,20 @@ enum NewsDisplay {
* Per-NewsType data * Per-NewsType data
*/ */
struct NewsTypeData { struct NewsTypeData {
const char * const name; ///< Name const char * const name; ///< Name
const byte age; ///< Maximum age of news items (in days) const byte age; ///< Maximum age of news items (in days)
const SoundFx sound; ///< Sound const SoundFx sound; ///< Sound
NewsDisplay display; ///< Display mode (off, summary, full) NewsDisplay display; ///< Display mode (off, summary, full)
StringID description; ///< Description of the news type in news settings window 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 { struct NewsItem {

View File

@ -563,7 +563,7 @@ public:
DrawArrowButtons(5, y, COLOUR_YELLOW, DrawArrowButtons(5, y, COLOUR_YELLOW,
(this->clicked_button == i) ? 1 + !!this->clicked_increase : 0, (this->clicked_button == i) ? 1 + !!this->clicked_increase : 0,
editable && sdb->min != value, editable && sdb->min != value,
editable && sdb->max != value); editable && sdb->max != (uint32)value);
value += sdb->str; value += sdb->str;
SetDParam(0, value); SetDParam(0, value);
@ -992,7 +992,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd
value = (int32)ReadValue(var, sd->save.conv); value = (int32)ReadValue(var, sd->save.conv);
/* Draw [<][>] boxes for settings of an integer-type */ /* 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); disabled = (value == 0) && (sdb->flags & SGF_0ISDISABLED);
if (disabled) { if (disabled) {
@ -1440,7 +1440,7 @@ struct GameSettingsWindow : Window {
/* Increase or decrease the value and clamp it to extremes */ /* Increase or decrease the value and clamp it to extremes */
if (x >= 10) { if (x >= 10) {
value += step; 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 if (value < sdb->min) value = sdb->min; // skip between "disabled" and minimum
} else { } else {
value -= step; value -= step;

View File

@ -56,7 +56,8 @@ struct SettingDescBase {
const void *def; ///< default value given when none is present const void *def; ///< default value given when none is present
SettingDescType cmd; ///< various flags for the variable SettingDescType cmd; ///< various flags for the variable
SettingGuiFlag flags; ///< handles how a setting would show up in the GUI (text/currency, etc.) 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 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 const char *many; ///< ONE/MANY_OF_MANY: string of possible values for this type
StringID str; ///< (translated) string with descriptive text; gui and console StringID str; ///< (translated) string with descriptive text; gui and console

View File

@ -247,12 +247,12 @@ static bool FindNearIndustryName(TileIndex tile, void *user_data)
static StringID GenerateStationName(Station *st, TileIndex tile, int flag) static StringID GenerateStationName(Station *st, TileIndex tile, int flag)
{ {
static const uint32 _gen_station_name_bits[] = { static const uint32 _gen_station_name_bits[] = {
0, // 0 0, // 0
1 << M(STR_SV_STNAME_AIRPORT), // 1 1U << M(STR_SV_STNAME_AIRPORT), // 1
1 << M(STR_SV_STNAME_OILFIELD), // 2 1U << M(STR_SV_STNAME_OILFIELD), // 2
1 << M(STR_SV_STNAME_DOCKS), // 3 1U << M(STR_SV_STNAME_DOCKS), // 3
0x1FF << M(STR_SV_STNAME_BUOY_1), // 4 0x1FFU << M(STR_SV_STNAME_BUOY_1), // 4
1 << M(STR_SV_STNAME_HELIPORT), // 5 1U << M(STR_SV_STNAME_HELIPORT), // 5
}; };
const Town *t = st->town; const Town *t = st->town;