Robert Müller
39749a3ff8
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
^
```
2022-11-29 23:32:26 +01:00
Robert Müller
be74dc9471
Return actual bool from bool function
...
According to cppcheck's `returnNonBoolInBooleanFunction` error.
2022-11-29 23:32:26 +01:00
Rafael Fontenelle
cd14660307
Fix misspellings
2022-10-25 13:51:56 -03:00
Robert Müller
73fe4e6ed4
Use str_copy
instead of snprintf
to copy strings
2022-10-20 20:56:58 +02:00
Robert Müller
6b043bf3b2
Replace atoi
usages with strtol
(str_toint
wrapper)
...
As `atoi` does not provide any way to detect errors and can cause undefined behavior on errors, i.e. when the result cannot be represented as an `int`.
References:
- https://wiki.sei.cmu.edu/confluence/display/c/ERR07-C.+Prefer+functions+that+support+error+checking+over+equivalent+functions+that+don%27t
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/atoi.html
2022-10-20 20:30:11 +02:00
Dennis Felsing
31cf68c65d
Fix mismatched bound warning in map_replace_area and map_create_pixelart
...
src/tools/map_replace_area.cpp:644:38: warning: argument 'aLine' of type 'const float[2]' with mismatched bound [-Warray-parameter]
bool GetLineIntersection(const float aLine[2], const float Point)
^
src/tools/map_replace_area.cpp:55:37: note: previously declared as 'const float[]' here
bool GetLineIntersection(const float[], float);
^
2022-09-15 23:23:04 +02:00
heinrich5991
887b24d8f5
Remove all references to memset
...
`memset` only worked with `CServer::CClient::STATE_EMPTY` by chance
because it is defined as 0.
2022-09-02 14:32:39 +02:00
Dennis Felsing
2ccca3a50a
Fix memset compilation
...
/home/deen/isos/ddnet/ddnet-source/src/tools/map_create_pixelart.cpp: In function ‘int InsertPixelArtQuads(CQuad*, int&, const CImageInfo&, const int*, const int*, const bool*)’:
/home/deen/isos/ddnet/ddnet-source/src/tools/map_create_pixelart.cpp:110:9: error: ‘memset’ was not declared in this scope
110 | memset(aVisitedPixels, 0, sizeof(bool) * Img.m_Height * Img.m_Width);
| ^~~~~~
/home/deen/isos/ddnet/ddnet-source/src/tools/map_create_pixelart.cpp:8:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
7 | #include <game/mapitems.h>
+++ |+#include <cstring>
8 |
2022-08-25 14:07:49 +02:00
“sctt”
ff2c513ddc
removed debug
2022-08-23 19:42:29 +02:00
“sctt”
f066cca33a
CICD fixes 2 for map_create_pixelart
2022-08-23 19:40:13 +02:00
“sctt”
4013c0f68a
CICD fixes for map_create_pixelart
2022-08-23 19:14:42 +02:00
“sctt”
0f14d76a69
Added map_create_pixelart tool
2022-08-23 18:12:15 +02:00