mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 20:18:19 +00:00
Merge #4828
4828: Fixed bad DataReader loop on map_replace_image r=def- a=sctt Happy to see that map_replace_image has actually been useful to you as it was used as a base to code map_convert_07. As stated here https://github.com/ddnet/ddnet7/issues/20, map_replace_image seems to somehow break the map, that is due to a bad check inside the last datareader loop (it is just checking NumItems instead NumData). Seems like it was just a coincidence that the tool was correctly working on the map i was testing, but i was able to confirm the problem by trying different maps. now it is fixed. Co-authored-by: sctt <scottistefano91@gmail.com>
This commit is contained in:
commit
3268986d91
|
@ -32,7 +32,7 @@ int LoadPNG(CImageInfo *pImg, const char *pFilename)
|
|||
IOHANDLE File = io_open(pFilename, IOFLAG_READ);
|
||||
if(!File)
|
||||
{
|
||||
dbg_msg("dilate", "failed to open file. filename='%s'", pFilename);
|
||||
dbg_msg("map_replace_image", "failed to open file. filename='%s'", pFilename);
|
||||
return 0;
|
||||
}
|
||||
int Error = png_open_read(&Png, 0, File);
|
||||
|
@ -54,7 +54,7 @@ int LoadPNG(CImageInfo *pImg, const char *pFilename)
|
|||
Error = png_get_data(&Png, pBuffer);
|
||||
if(Error != PNG_NO_ERROR)
|
||||
{
|
||||
dbg_msg("map_convert_07", "failed to read image. filename='%s', pnglite: %s", pFilename, png_error_string(Error));
|
||||
dbg_msg("map_replace_image", "failed to read image. filename='%s', pnglite: %s", pFilename, png_error_string(Error));
|
||||
free(pBuffer);
|
||||
io_close(File);
|
||||
return 0;
|
||||
|
@ -181,7 +181,7 @@ int main(int argc, const char **argv)
|
|||
}
|
||||
|
||||
// add all data
|
||||
for(int Index = 0; Index < g_DataReader.NumItems(); Index++)
|
||||
for(int Index = 0; Index < g_DataReader.NumData(); Index++)
|
||||
{
|
||||
if(Index == g_NewDataID)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue