@@ -47,7 +47,7 @@ int main( int argc, char ** argv )
47
47
}
48
48
49
49
const char * paletteFileName = argv[1 ];
50
- const char * outputImage = argv[2 ];
50
+ const char * outputFileName = argv[2 ];
51
51
52
52
{
53
53
StreamFile paletteStream;
@@ -65,25 +65,28 @@ int main( int argc, char ** argv )
65
65
fheroes2::setGamePalette ( palette );
66
66
}
67
67
68
- fheroes2::Image output ( 256 , 256 );
69
- output .reset ();
68
+ fheroes2::Image image ( 256 , 256 );
69
+ image .reset ();
70
70
// We do not need to care about the transform layer.
71
- output ._disableTransformLayer ();
71
+ image ._disableTransformLayer ();
72
72
73
73
// These color indexes are from PAL::GetCyclingPalette() method.
74
74
const std::set<uint8_t > cyclingColors{ 214 , 215 , 216 , 217 , 218 , 219 , 220 , 221 , 231 , 232 , 233 , 234 , 235 , 238 , 239 , 240 , 241 };
75
75
76
76
for ( uint8_t y = 0 ; y < 16 ; ++y ) {
77
77
for ( uint8_t x = 0 ; x < 16 ; ++x ) {
78
- fheroes2::Fill ( output , x * 16 , y * 16 , 16 , 16 , x + y * 16 );
78
+ fheroes2::Fill ( image , x * 16 , y * 16 , 16 , 16 , x + y * 16 );
79
79
80
80
if ( cyclingColors.count ( x + y * 16 ) > 0 ) {
81
- fheroes2::Fill ( output , x * 16 , y * 16 , 4 , 4 , 0 );
81
+ fheroes2::Fill ( image , x * 16 , y * 16 , 4 , 4 , 0 );
82
82
}
83
83
}
84
84
}
85
85
86
- fheroes2::Save ( output, outputImage );
86
+ if ( !fheroes2::Save ( image, outputFileName ) ) {
87
+ std::cerr << " Error writing to file " << outputFileName << std::endl;
88
+ return EXIT_FAILURE;
89
+ }
87
90
88
91
return EXIT_SUCCESS;
89
92
}
0 commit comments