mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Fix: comparison result is always the same warnings
This commit is contained in:
parent
b4f0450974
commit
6dfd2cad69
@ -25,7 +25,7 @@ class CommandCost {
|
|||||||
ExpensesType expense_type; ///< the type of expence as shown on the finances view
|
ExpensesType expense_type; ///< the type of expence as shown on the finances view
|
||||||
Money cost; ///< The cost of this action
|
Money cost; ///< The cost of this action
|
||||||
StringID message; ///< Warning message for when success is unset
|
StringID message; ///< Warning message for when success is unset
|
||||||
bool success; ///< Whether the comment went fine up to this moment
|
bool success; ///< Whether the command went fine up to this moment
|
||||||
const GRFFile *textref_stack_grffile; ///< NewGRF providing the #TextRefStack content.
|
const GRFFile *textref_stack_grffile; ///< NewGRF providing the #TextRefStack content.
|
||||||
uint textref_stack_size; ///< Number of uint32 values to put on the #TextRefStack for the error message.
|
uint textref_stack_size; ///< Number of uint32 values to put on the #TextRefStack for the error message.
|
||||||
|
|
||||||
|
@ -286,7 +286,11 @@ DEF_CONSOLE_CMD(ConZoomToLevel)
|
|||||||
case 2: {
|
case 2: {
|
||||||
uint32 level;
|
uint32 level;
|
||||||
if (GetArgumentInteger(&level, argv[1])) {
|
if (GetArgumentInteger(&level, argv[1])) {
|
||||||
if (level < ZOOM_LVL_MIN) {
|
/* In case ZOOM_LVL_MIN is more than 0, the next if statement needs to be amended.
|
||||||
|
* A simple check for less than ZOOM_LVL_MIN does not work here because we are
|
||||||
|
* reading an unsigned integer from the console, so just check for a '-' char. */
|
||||||
|
static_assert(ZOOM_LVL_MIN == 0);
|
||||||
|
if (argv[1][0] == '-') {
|
||||||
IConsolePrint(CC_ERROR, "Zoom-in levels below {} are not supported.", ZOOM_LVL_MIN);
|
IConsolePrint(CC_ERROR, "Zoom-in levels below {} are not supported.", ZOOM_LVL_MIN);
|
||||||
} else if (level < _settings_client.gui.zoom_min) {
|
} else if (level < _settings_client.gui.zoom_min) {
|
||||||
IConsolePrint(CC_ERROR, "Current client settings do not allow zooming in below level {}.", _settings_client.gui.zoom_min);
|
IConsolePrint(CC_ERROR, "Current client settings do not allow zooming in below level {}.", _settings_client.gui.zoom_min);
|
||||||
@ -2012,8 +2016,6 @@ DEF_CONSOLE_CMD(ConFont)
|
|||||||
bool aa = setting->aa;
|
bool aa = setting->aa;
|
||||||
|
|
||||||
byte arg_index = 2;
|
byte arg_index = 2;
|
||||||
|
|
||||||
if (argc > arg_index) {
|
|
||||||
/* We may encounter "aa" or "noaa" but it must be the last argument. */
|
/* We may encounter "aa" or "noaa" but it must be the last argument. */
|
||||||
if (strcasecmp(argv[arg_index], "aa") == 0 || strcasecmp(argv[arg_index], "noaa") == 0) {
|
if (strcasecmp(argv[arg_index], "aa") == 0 || strcasecmp(argv[arg_index], "noaa") == 0) {
|
||||||
aa = strncasecmp(argv[arg_index++], "no", 2) != 0;
|
aa = strncasecmp(argv[arg_index++], "no", 2) != 0;
|
||||||
@ -2025,7 +2027,6 @@ DEF_CONSOLE_CMD(ConFont)
|
|||||||
font = argv[arg_index++];
|
font = argv[arg_index++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (argc > arg_index) {
|
if (argc > arg_index) {
|
||||||
/* For <size> we want a number. */
|
/* For <size> we want a number. */
|
||||||
|
@ -281,14 +281,14 @@ void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 4: {
|
case 4: {
|
||||||
GRFConfig **dst = &info->grfconfig;
|
/* Ensure that the maximum number of NewGRFs and the field in the network
|
||||||
uint i;
|
* protocol are matched to eachother. If that is not the case anymore a
|
||||||
|
* check must be added to ensure the received data is still valid. */
|
||||||
|
static_assert(std::numeric_limits<uint8>::max() == NETWORK_MAX_GRF_COUNT);
|
||||||
uint num_grfs = p->Recv_uint8();
|
uint num_grfs = p->Recv_uint8();
|
||||||
|
|
||||||
/* Broken/bad data. It cannot have that many NewGRFs. */
|
GRFConfig **dst = &info->grfconfig;
|
||||||
if (num_grfs > NETWORK_MAX_GRF_COUNT) return;
|
for (uint i = 0; i < num_grfs; i++) {
|
||||||
|
|
||||||
for (i = 0; i < num_grfs; i++) {
|
|
||||||
NamedGRFIdentifier grf;
|
NamedGRFIdentifier grf;
|
||||||
switch (newgrf_serialisation) {
|
switch (newgrf_serialisation) {
|
||||||
case NST_GRFID_MD5:
|
case NST_GRFID_MD5:
|
||||||
|
Loading…
Reference in New Issue
Block a user