From 9f3717bda0fa492d6432f1803ab41d3e5738b853 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 2 Aug 2014 10:58:50 +0200 Subject: [PATCH] Fixed: build_interface currently only works with 32 bits bitmaps --- code/nel/tools/3d/build_interface/main.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/code/nel/tools/3d/build_interface/main.cpp b/code/nel/tools/3d/build_interface/main.cpp index da652b0cc..343673b34 100644 --- a/code/nel/tools/3d/build_interface/main.cpp +++ b/code/nel/tools/3d/build_interface/main.cpp @@ -258,16 +258,24 @@ int main(int nNbArg, char **ppArgs) AllMaps.resize( mapSize ); for(sint i = 0; i < mapSize; ++i ) { + NLMISC::CBitmap *pBtmp = NULL; + try { - NLMISC::CBitmap *pBtmp = new NLMISC::CBitmap; + pBtmp = new NLMISC::CBitmap; NLMISC::CIFile inFile; - inFile.open( AllMapNames[i] ); - pBtmp->load(inFile); + if (!inFile.open( AllMapNames[i] )) throw NLMISC::Exception("Unable to open " + AllMapNames[i]); + + uint8 colors = pBtmp->load(inFile); + + if (colors != 32) throw NLMISC::Exception(AllMapNames[i] + " is using " + toString(colors) + " bits colors, only 32 bit supported!"); + AllMaps[i] = pBtmp; } catch (const NLMISC::Exception &e) { + if (pBtmp) delete pBtmp; + outString (string("ERROR :") + e.what()); return -1; }