Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -206,7 +206,7 @@ struct GameOptionsWindow : Window {
|
||||
switch (widget) {
|
||||
case WID_GO_CURRENCY_DROPDOWN: { // Setup currencies dropdown
|
||||
*selected_index = this->opt->locale.currency;
|
||||
uint64 disabled = _game_mode == GM_MENU ? 0LL : ~GetMaskOfAllowedCurrencies();
|
||||
uint64_t disabled = _game_mode == GM_MENU ? 0LL : ~GetMaskOfAllowedCurrencies();
|
||||
|
||||
/* Add non-custom currencies; sorted naturally */
|
||||
for (const CurrencySpec ¤cy : _currency_specs) {
|
||||
@@ -1033,7 +1033,7 @@ struct SettingEntry : BaseSettingEntry {
|
||||
return this->setting->str_help;
|
||||
}
|
||||
|
||||
void SetValueDParams(uint first_param, int32 value) const;
|
||||
void SetValueDParams(uint first_param, int32_t value) const;
|
||||
|
||||
protected:
|
||||
virtual void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const;
|
||||
@@ -1268,8 +1268,8 @@ bool SettingEntry::IsVisibleByRestrictionMode(RestrictionMode mode) const
|
||||
|
||||
/* Read the current value. */
|
||||
const void *object = ResolveObject(&GetGameSettings(), sd);
|
||||
int64 current_value = sd->Read(object);
|
||||
int64 filter_value;
|
||||
int64_t current_value = sd->Read(object);
|
||||
int64_t filter_value;
|
||||
|
||||
if (mode == RM_CHANGED_AGAINST_DEFAULT) {
|
||||
/* This entry shall only be visible, if the value deviates from its default value. */
|
||||
@@ -1346,7 +1346,7 @@ static const void *ResolveObject(const GameSettings *settings_ptr, const IntSett
|
||||
* @param first_param First DParam to use
|
||||
* @param value Setting value to set params for.
|
||||
*/
|
||||
void SettingEntry::SetValueDParams(uint first_param, int32 value) const
|
||||
void SettingEntry::SetValueDParams(uint first_param, int32_t value) const
|
||||
{
|
||||
if (this->setting->IsBoolSetting()) {
|
||||
SetDParam(first_param++, value != 0 ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
|
||||
@@ -1386,7 +1386,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, int left, int right,
|
||||
bool editable = sd->IsEditable();
|
||||
|
||||
SetDParam(0, STR_CONFIG_SETTING_VALUE);
|
||||
int32 value = sd->Read(ResolveObject(settings_ptr, sd));
|
||||
int32_t value = sd->Read(ResolveObject(settings_ptr, sd));
|
||||
if (sd->IsBoolSetting()) {
|
||||
/* Draw checkbox for boolean-value either on/off */
|
||||
DrawBoolButton(buttons_left, button_y, value != 0, editable);
|
||||
@@ -1396,7 +1396,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, int left, int right,
|
||||
} else {
|
||||
/* Draw [<][>] boxes for settings of an integer-type */
|
||||
DrawArrowButtons(buttons_left, button_y, COLOUR_YELLOW, state,
|
||||
editable && value != (sd->flags & SF_GUI_0_IS_SPECIAL ? 0 : sd->min), editable && (uint32)value != sd->max);
|
||||
editable && value != (sd->flags & SF_GUI_0_IS_SPECIAL ? 0 : sd->min), editable && (uint32_t)value != sd->max);
|
||||
}
|
||||
this->SetValueDParams(1, value);
|
||||
DrawString(text_left, text_right, y + (SETTING_HEIGHT - FONT_HEIGHT_NORMAL) / 2, sd->str, highlight ? TC_WHITE : TC_LIGHT_BLUE);
|
||||
@@ -2360,7 +2360,7 @@ struct GameSettingsWindow : Window {
|
||||
return;
|
||||
}
|
||||
|
||||
int32 value = sd->Read(ResolveObject(settings_ptr, sd));
|
||||
int32_t value = sd->Read(ResolveObject(settings_ptr, sd));
|
||||
|
||||
/* clicked on the icon on the left side. Either scroller, bool on/off or dropdown */
|
||||
if (x < SETTING_BUTTON_WIDTH && (sd->flags & SF_GUI_DROPDOWN)) {
|
||||
@@ -2401,7 +2401,7 @@ struct GameSettingsWindow : Window {
|
||||
this->SetDirty();
|
||||
} else if (x < SETTING_BUTTON_WIDTH) {
|
||||
this->SetDisplayedHelpText(pe);
|
||||
int32 oldvalue = value;
|
||||
int32_t oldvalue = value;
|
||||
|
||||
if (sd->IsBoolSetting()) {
|
||||
value ^= 1;
|
||||
@@ -2410,7 +2410,7 @@ struct GameSettingsWindow : Window {
|
||||
* 50-steps you should be able to get from min to max,
|
||||
* unless specified otherwise in the 'interval' variable
|
||||
* of the current setting. */
|
||||
uint32 step = (sd->interval == 0) ? ((sd->max - sd->min) / 50) : sd->interval;
|
||||
uint32_t step = (sd->interval == 0) ? ((sd->max - sd->min) / 50) : sd->interval;
|
||||
if (step == 0) step = 1;
|
||||
|
||||
/* don't allow too fast scrolling */
|
||||
@@ -2423,10 +2423,10 @@ struct GameSettingsWindow : Window {
|
||||
if (x >= SETTING_BUTTON_WIDTH / 2) {
|
||||
value += step;
|
||||
if (sd->min < 0) {
|
||||
assert((int32)sd->max >= 0);
|
||||
if (value > (int32)sd->max) value = (int32)sd->max;
|
||||
assert((int32_t)sd->max >= 0);
|
||||
if (value > (int32_t)sd->max) value = (int32_t)sd->max;
|
||||
} else {
|
||||
if ((uint32)value > sd->max) value = (int32)sd->max;
|
||||
if ((uint32_t)value > sd->max) value = (int32_t)sd->max;
|
||||
}
|
||||
if (value < sd->min) value = sd->min; // skip between "disabled" and minimum
|
||||
} else {
|
||||
@@ -2453,7 +2453,7 @@ struct GameSettingsWindow : Window {
|
||||
} else {
|
||||
/* Only open editbox if clicked for the second time, and only for types where it is sensible for. */
|
||||
if (this->last_clicked == pe && !sd->IsBoolSetting() && !(sd->flags & SF_GUI_DROPDOWN)) {
|
||||
int64 value64 = value;
|
||||
int64_t value64 = value;
|
||||
/* Show the correct currency-translated value */
|
||||
if (sd->flags & SF_GUI_CURRENCY) value64 *= _currency->rate;
|
||||
|
||||
@@ -2486,7 +2486,7 @@ struct GameSettingsWindow : Window {
|
||||
assert(this->valuewindow_entry != nullptr);
|
||||
const IntSettingDesc *sd = this->valuewindow_entry->setting;
|
||||
|
||||
int32 value;
|
||||
int32_t value;
|
||||
if (!StrEmpty(str)) {
|
||||
long long llvalue = atoll(str);
|
||||
|
||||
|
Reference in New Issue
Block a user