From 39749a3ff8440990f988b3a4984a4a08cf84718b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 30 Oct 2022 13:37:11 +0100 Subject: [PATCH] Fix optional arguments of `map_create_pixelart` tool According to cppcheck's `knownConditionTrueFalse` error: ``` src\tools\map_create_pixelart.cpp:58:24: style: Condition 'argc>=10' is always true [knownConditionTrueFalse] aArtOptions[0] = argc >= 10 ? str_toint(argv[10]) : true; //optimize ^ src\tools\map_create_pixelart.cpp:34:10: note: Assuming that condition 'argc<11' is not redundant if(argc < 11 || argc > 12) ^ src\tools\map_create_pixelart.cpp:58:24: note: Condition 'argc>=10' is always true aArtOptions[0] = argc >= 10 ? str_toint(argv[10]) : true; //optimize ^ src\tools\map_create_pixelart.cpp:59:24: style: Condition 'argc>=11' is always true [knownConditionTrueFalse] aArtOptions[1] = argc >= 11 ? str_toint(argv[11]) : false; //centralize ^ src\tools\map_create_pixelart.cpp:34:10: note: Assuming condition 'argc<11' is false if(argc < 11 || argc > 12) ^ src\tools\map_create_pixelart.cpp:59:24: note: Condition 'argc>=11' is always true aArtOptions[1] = argc >= 11 ? str_toint(argv[11]) : false; //centralize ^ ``` --- src/tools/map_create_pixelart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/map_create_pixelart.cpp b/src/tools/map_create_pixelart.cpp index 858078078..2e8ce10c1 100644 --- a/src/tools/map_create_pixelart.cpp +++ b/src/tools/map_create_pixelart.cpp @@ -31,7 +31,7 @@ int main(int argc, const char **argv) CCmdlineFix CmdlineFix(&argc, &argv); log_set_global_logger_default(); - if(argc < 11 || argc > 12) + if(argc < 9 || argc > 12) { dbg_msg("map_create_pixelart", "Invalid arguments"); dbg_msg("map_create_pixelart", "Usage: %s [optimize=0|1] [centralize=0|1]", argv[0]);