Changed: Generate an exception if file is not a supported bitmap format

--HG--
branch : develop
This commit is contained in:
kervala 2016-09-24 14:19:35 +02:00
parent af1f02c53f
commit ec5deea3f0

View file

@ -263,10 +263,12 @@ int main(int argc, char **argv)
pBtmp = new NLMISC::CBitmap; pBtmp = new NLMISC::CBitmap;
NLMISC::CIFile inFile; NLMISC::CIFile inFile;
if (!inFile.open(AllMapNames[i])) throw NLMISC::Exception("Unable to open " + AllMapNames[i]); if (!inFile.open(AllMapNames[i])) throw NLMISC::Exception(toString("Unable to open %s", AllMapNames[i].c_str()));
uint8 colors = pBtmp->load(inFile); uint8 colors = pBtmp->load(inFile);
if (!colors) throw NLMISC::Exception(toString("%s is not a bitmap", AllMapNames[i].c_str()));
if (pBtmp->getPixelFormat() != CBitmap::RGBA) if (pBtmp->getPixelFormat() != CBitmap::RGBA)
{ {
outString(toString("Converting %s to RGBA (32 bits), originally using %u bits...", AllMapNames[i].c_str(), (uint)colors)); outString(toString("Converting %s to RGBA (32 bits), originally using %u bits...", AllMapNames[i].c_str(), (uint)colors));