From c10dac929dee935ee2aced1163f80f1d1ba00695 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 18 Oct 2010 15:08:59 +0000 Subject: [PATCH] - New animation system: -- New files: hch/CAnimation.h/cpp -- Class CAnimation capable to load file partially and/or keep data in compressed state -- Buttons now use CAnimation instead of CDefHandler - build system regenerated to include new files - fixed several gcc warnings - updated README.linux --- README.linux | 14 +- aclocal.m4 | 4 +- client/AdventureMapButton.cpp | 97 ++--- client/AdventureMapButton.h | 6 +- client/CBattleInterface.cpp | 5 +- client/CCastleInterface.cpp | 5 +- client/CConfigHandler.cpp | 14 +- client/CMessage.cpp | 7 +- client/CPreGame.cpp | 15 +- client/GUIClasses.cpp | 9 +- client/Makefile.am | 3 +- client/Makefile.in | 21 +- client/SDL_Extensions.cpp | 6 +- configure | 478 +++++++++++------------ configure.ac | 2 +- hch/CAnimation.cpp | 689 ++++++++++++++++++++++++++++++++++ hch/CAnimation.h | 177 +++++++++ hch/CLodHandler.cpp | 41 +- hch/CLodHandler.h | 1 + lib/Connection.h | 12 +- 20 files changed, 1254 insertions(+), 352 deletions(-) create mode 100644 hch/CAnimation.cpp create mode 100644 hch/CAnimation.h diff --git a/README.linux b/README.linux index 1a6bb37d0..9ec931824 100644 --- a/README.linux +++ b/README.linux @@ -13,16 +13,20 @@ And then regenerate the build system with To compile, at least the following packages (and their development counterparts) are needed to build: * libstdc++ devel - * boost c++ libraries v1.36+ (1.35 will not work) (www.boost.org) * SDL and SDL-devel * SDL_mixer and SDL_mixer-devel * SDL_image and SDL_image-devel * SDL_ttf and SDL_ttf-devel * zlib and zlib-devel * the ffmpeg libraries (libavformat and libswscale). Their name could be libavformat-devel and libswscale-devel, or ffmpeg-libs-devel or similar names. + * boost c++ libraries v1.36+ (1.35 will not work) (www.boost.org): + - filesystem + - iostreams + - system + - thread -On Ubuntu 9.04, run: - sudo apt-get install g++ libsdl1.2debian-all libsdl-image1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev zlib1g-dev libavformat-dev libswscale-dev libboost1.37-dev +On Ubuntu 9.04 or later, run: + sudo apt-get install g++ libsdl1.2debian-all libsdl-image1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev zlib1g-dev libavformat-dev libswscale-dev libboost-dev libboost-filesystem-dev libboost-iostreams-dev libboost-system-dev libboost-thread-dev Create a directory /YOUR_INSTALL_PATH/vcmi (such as /usr/local/share/games/vcmi) that will contain the game data files. The /vcmi at the end is necessary. @@ -47,7 +51,7 @@ That will generate vcmiclient, vcmiserver as well as 3 .so libraries. II. Installing Heroes of Might and Magic 3 VCMI needs an installed version of Heroes III as well as WoG on top of -it. The version of Heroes needed is (I think!) either Shadow of Death +it. The version of Heroes needed is either Shadow of Death or Complete. Wog can be downloaded from: http://www.maps4heroes.com/heroes3/files/allinone_358f.zip @@ -61,7 +65,7 @@ Install Heroes 3 and Wog. Then move all the installed files into Once both programs are installed, you can install VCMI. Download the windows VCMI release (at time of writing: -http://vcmi.antypika.aplus.pl/forum/dload.php?action=download&id=14) +http://forum.vcmi.eu/dload.php?action=download&id=18) and extract it in a private directory. Populate /YOUR_INSTALL_PATH/vcmi: mv sprites /YOUR_INSTALL_PATH/vcmi/Sprites diff --git a/aclocal.m4 b/aclocal.m4 index df48a3503..ab6878818 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, -[m4_warning([this file was generated for autoconf 2.65. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, +[m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) diff --git a/client/AdventureMapButton.cpp b/client/AdventureMapButton.cpp index 0d231e60d..87c4fca2e 100644 --- a/client/AdventureMapButton.cpp +++ b/client/AdventureMapButton.cpp @@ -1,7 +1,7 @@ #include "AdventureMapButton.h" +#include "../hch/CAnimation.h" #include "CAdvmapInterface.h" #include "SDL_Extensions.h" -#include "../hch/CDefHandler.h" #include "CGameInfo.h" #include "../hch/CLodHandler.h" #include "../hch/CGeneralTextHandler.h" @@ -14,7 +14,7 @@ #include "CMessage.h" /* - * AdevntureMapButton.cpp, part of VCMI engine + * AdventureMapButton.cpp, part of VCMI engine * * Authors: listed in file AUTHORS in main folder * @@ -41,19 +41,19 @@ CButtonBase::~CButtonBase() delete text; if(notFreeButton) return; - for(int i =0; isize()-1)); img = std::max(0, img); if (abs) { - blitAt(imgs[curimg][img],pos.x,pos.y,to); + blitAt(imgs[curimg]->image(img),pos.x,pos.y,to); if(text) {//using "state" instead of "state == 1" screwed up hoverable buttons with text CSDL_Ext::printAt(text->text, text->x + pos.x + (state == 1), text->y + pos.y + (state == 1), text->font, text->color, to); @@ -61,7 +61,7 @@ void CButtonBase::show(SDL_Surface * to) } else { - blitAt(imgs[curimg][img],pos.x+ourObj->pos.x,pos.y+ourObj->pos.y,to); + blitAt(imgs[curimg]->image(img),pos.x+ourObj->pos.x,pos.y+ourObj->pos.y,to); } } @@ -221,28 +221,15 @@ void AdventureMapButton::init(const CFunctionList &Callback, const std:: setDef(defName, playerColoredButton); if (add && add->size()) - { - imgs.resize(imgs.size()+add->size()); for (size_t i=0; isize();i++) - { - CDefHandler *temp = CDefHandler::giveDef((*add)[i]); - temp->notFreeImgs = true; - for (size_t j=0;jourImages.size();j++) - { - imgs[i+1].push_back(temp->ourImages[j].bitmap); - if(playerColoredButton) - { - graphics->blueToPlayersAdv(imgs[1+i][j],LOCPLINT->playerID); - } - } - delete temp; - } - //delete add; - } + setDef((*add)[i], playerColoredButton); + if (playerColoredButton) + setPlayerColor(LOCPLINT->playerID); + pos.x += x; pos.y += y; - pos.w = imgs[curimg][0]->w; - pos.h = imgs[curimg][0]->h -1; + pos.w = imgs[curimg]->image(0)->w; + pos.h = imgs[curimg]->image(0)->h -1; } void AdventureMapButton::block( ui8 on ) @@ -257,30 +244,22 @@ void AdventureMapButton::setDef(const std::string & defName, bool playerColoredB { if (reset) { - for (size_t i=0;inotFreeImgs = true; - for (size_t i=0;iourImages.size();i++) - { - imgs.resize(1); - imgs[0].push_back(temp->ourImages[i].bitmap); - if(playerColoredButton) - { - graphics->blueToPlayersAdv(imgs[curimg][i],LOCPLINT->playerID); - } - } - delete temp; + imgs.push_back(new CAnimation(defName)); + imgs.back()->load(); } void AdventureMapButton::setPlayerColor(int player) { - for(int i =0; iblueToPlayersAdv(imgs[i][j],player); + for(size_t i =0; isize();j++) + { + graphics->blueToPlayersAdv(imgs[i]->image(j),player); + } } void CHighlightableButton::select(bool on) @@ -364,7 +343,7 @@ void CHighlightableButtonsGroup::addButton(const std::map &tool } CHighlightableButtonsGroup::CHighlightableButtonsGroup(const CFunctionList2 &OnChange, bool musicLikeButtons) -: musicLike(musicLikeButtons), onChange(OnChange) +: onChange(OnChange), musicLike(musicLikeButtons) {} CHighlightableButtonsGroup::~CHighlightableButtonsGroup() @@ -559,7 +538,7 @@ void CSlider::clickLeft(tribool down, bool previousState) CSlider::~CSlider() { - delete imgs; + } CSlider::CSlider(int x, int y, int totalw, boost::function Moved, int Capacity, int Amount, int Value, bool Horizontal, int style) @@ -609,19 +588,23 @@ CSlider::CSlider(int x, int y, int totalw, boost::function Moved, int if(style == 0) { - if (horizontal) - imgs = CDefHandler::giveDefEss("IGPCRDIV.DEF"); - else - imgs = CDefHandler::giveDefEss("OVBUTN2.DEF"); - left->imgs.resize(1); right->imgs.resize(1); slider->imgs.resize(1); - left->imgs[0].push_back(imgs->ourImages[0].bitmap); left->imgs[0].push_back(imgs->ourImages[1].bitmap); - right->imgs[0].push_back(imgs->ourImages[2].bitmap); right->imgs[0].push_back(imgs->ourImages[3].bitmap); - slider->imgs[0].push_back(imgs->ourImages[4].bitmap); - left->notFreeButton = right->notFreeButton = slider->notFreeButton = true; + CAnimation * pics = new CAnimation(horizontal?"IGPCRDIV.DEF":"OVBUTN2.DEF"); + pics->load(); + + left->imgs.push_back(new CAnimation()); + right->imgs.push_back(new CAnimation()); + slider->imgs.push_back(new CAnimation()); + + left->imgs.back()->add(pics->image(0), true); + left->imgs.back()->add(pics->image(1), true); + right->imgs.back()->add(pics->image(2), true); + right->imgs.back()->add(pics->image(3), true); + slider->imgs.back()->add(pics->image(4), true); + + delete pics; } else { - imgs = NULL; left->setDef(horizontal ? "SCNRBLF.DEF" : "SCNRBUP.DEF", false); right->setDef(horizontal ? "SCNRBRT.DEF" : "SCNRBDN.DEF", false); slider->setDef("SCNRBSL.DEF", false); diff --git a/client/AdventureMapButton.h b/client/AdventureMapButton.h index 5f9316ab6..c4f3c94f6 100644 --- a/client/AdventureMapButton.h +++ b/client/AdventureMapButton.h @@ -17,7 +17,7 @@ extern SDL_Color tytulowy, tlo, zwykly ; -class CDefEssential; +class CAnimation; namespace config{struct ButtonInfo;} @@ -41,7 +41,7 @@ public: bool notFreeButton; //TODO: comment me CIntObject * ourObj; // "owner" int state; //TODO: comment me - std::vector< std::vector > imgs; //images for this button + std::vector< CAnimation * > imgs; //images for this button int curimg; //curently displayed image from imgs virtual void show(SDL_Surface * to); virtual void showAll(SDL_Surface * to); @@ -129,8 +129,6 @@ public: bool wheelScrolling; bool keyScrolling; - CDefEssential *imgs ; - boost::function moved; void redrawSlider(); diff --git a/client/CBattleInterface.cpp b/client/CBattleInterface.cpp index 1a37238b6..b1ce4e5f3 100644 --- a/client/CBattleInterface.cpp +++ b/client/CBattleInterface.cpp @@ -4,6 +4,7 @@ #include "SDL_Extensions.h" #include "CAdvmapInterface.h" #include "AdventureMapButton.h" +#include "../hch/CAnimation.h" #include "../hch/CObjectHandler.h" #include "../hch/CHeroHandler.h" #include "../hch/CDefHandler.h" @@ -3914,9 +3915,9 @@ CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInt animSpeeds->onChange = boost::bind(&CBattleInterface::setAnimSpeed, owner, _1); setToDefault = new AdventureMapButton (CGI->generaltexth->zelp[392].first, CGI->generaltexth->zelp[392].second, boost::bind(&CBattleOptionsWindow::bDefaultf,this), 405, 443, "codefaul.def"); - std::swap(setToDefault->imgs[0][0], setToDefault->imgs[0][1]); + setToDefault->imgs[0]->fixButtonPos(); exit = new AdventureMapButton (CGI->generaltexth->zelp[393].first, CGI->generaltexth->zelp[393].second, boost::bind(&CBattleOptionsWindow::bExitf,this), 516, 443, "soretrn.def",SDLK_RETURN); - std::swap(exit->imgs[0][0], exit->imgs[0][1]); + exit->imgs[0]->fixButtonPos(); //printing texts to background CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[392], 242, 32, FONT_BIG, tytulowy, background); //window title diff --git a/client/CCastleInterface.cpp b/client/CCastleInterface.cpp index 2e0aaaf6a..eb219453d 100644 --- a/client/CCastleInterface.cpp +++ b/client/CCastleInterface.cpp @@ -1138,9 +1138,8 @@ void CCastleInterface::CCreaInfo::clickRight(tribool down, bool previousState) if(down) { CCastleInterface * ci=LOCPLINT->castleInt; - const CGTownInstance * town = ci->town; std::set bld = ci->town->builtBuildings; - int summ=0, cnt=0; + int summ=0; std::string descr=CGI->generaltexth->allTexts[589];//Growth of creature is number boost::algorithm::replace_first(descr,"%s",CGI->creh->creatures[crid]->nameSing); boost::algorithm::replace_first(descr,"%d", boost::lexical_cast(ci->town->creatureGrowth(level))); @@ -1174,7 +1173,7 @@ void CCastleInterface::CCreaInfo::clickRight(tribool down, bool previousState) summ+=AddToString(CGI->buildh->buildings[ci->town->subID][24]->Name()+" %+d",descr, CGI->creh->creatures[crid]->hordeGrowth); - cnt = 0; + int cnt = 0; std::vector< const CGDwelling * > myDwellings = LOCPLINT->cb->getMyDwellings(); for (std::vector::const_iterator it = myDwellings.begin(); it != myDwellings.end(); ++it) diff --git a/client/CConfigHandler.cpp b/client/CConfigHandler.cpp index d63946dda..9a135a380 100644 --- a/client/CConfigHandler.cpp +++ b/client/CConfigHandler.cpp @@ -2,14 +2,18 @@ #include "CConfigHandler.h" #include #include -#if BOOST_VERSION >= 103800 -#include -#else -#include -#endif +#include #include using namespace config; + +#if BOOST_VERSION >= 103800 +#include +using namespace boost::spirit::classic; +#else +#include using namespace boost::spirit; +#endif + using namespace phoenix; /* diff --git a/client/CMessage.cpp b/client/CMessage.cpp index 3dc71f0e6..63631c2ca 100644 --- a/client/CMessage.cpp +++ b/client/CMessage.cpp @@ -2,6 +2,7 @@ #include "CMessage.h" #include "SDL_ttf.h" #include "../hch/CDefHandler.h" +#include "../hch/CAnimation.h" #include "CGameInfo.h" #include "SDL_Extensions.h" #include "../hch/CLodHandler.h" @@ -427,7 +428,7 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player) // Compute total width of buttons bw = 20*(ret->buttons.size()-1); // space between all buttons for(size_t i=0; ibuttons.size(); i++) //and add buttons width - bw+=ret->buttons[i]->imgs[0][0]->w; + bw+=ret->buttons[i]->imgs[0]->image(0)->w; winSize.second += 20 + //before button ok->ourImages[0].bitmap->h; //button } @@ -464,13 +465,13 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player) { // Position the buttons at the bottom of the window bw = (ret->bitmap->w/2) - (bw/2); - curh = ret->bitmap->h - SIDE_MARGIN - ret->buttons[0]->imgs[0][0]->h; + curh = ret->bitmap->h - SIDE_MARGIN - ret->buttons[0]->imgs[0]->image(0)->h; for(size_t i=0; ibuttons.size(); i++) { ret->buttons[i]->pos.x = bw + ret->pos.x; ret->buttons[i]->pos.y = curh + ret->pos.y; - bw += ret->buttons[i]->imgs[0][0]->w + 20; + bw += ret->buttons[i]->imgs[0]->image(0)->w + 20; } } for(size_t i=0; icomponents.size(); i++) diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index 6245aea8d..4473f7f93 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -9,6 +9,7 @@ #include "SDL_Extensions.h" #include "CGameInfo.h" #include "CCursorHandler.h" +#include "../hch/CAnimation.h" #include "../hch/CDefHandler.h" #include "../hch/CDefObjInfoHandler.h" #include "../hch/CGeneralTextHandler.h" @@ -798,7 +799,7 @@ void SelectionTab::parseCampaigns( std::vector & files ) } SelectionTab::SelectionTab(CMenuScreen::EState Type, const boost::function &OnSelect, bool MultiPlayer) - :onSelect(OnSelect), bg(NULL) + :bg(NULL), onSelect(OnSelect) { OBJ_CONSTRUCTION; selectionPos = 0; @@ -1239,7 +1240,7 @@ CChatBox::CChatBox(const Rect &rect) } InfoCard::InfoCard( CMenuScreen::EState Type, bool network ) -: difficulty(NULL), sizes(NULL), sFlags(NULL), bg(NULL), chatOn(false), chat(NULL) +: bg(NULL), chatOn(false), chat(NULL), difficulty(NULL), sizes(NULL), sFlags(NULL) { OBJ_CONSTRUCTION; pos.x += 393; @@ -2333,8 +2334,8 @@ void CHotSeatPlayers::enterSelectionScreen() } CBonusSelection::CBonusSelection( CCampaignState * _ourCampaign ) -: ourCampaign(_ourCampaign), highlightedRegion(NULL), ourHeader(NULL), bonuses(NULL), - diffLb(NULL), diffRb(NULL) +: highlightedRegion(NULL), ourCampaign(_ourCampaign), ourHeader(NULL), + diffLb(NULL), diffRb(NULL), bonuses(NULL) { OBJ_CONSTRUCTION_CAPTURING_ALL; static const std::string bgNames [] = {"E1_BG.BMP", "G2_BG.BMP", "E2_BG.BMP", "G1_BG.BMP", "G3_BG.BMP", "N1_BG.BMP", @@ -2765,9 +2766,9 @@ void CBonusSelection::updateBonusSelection() blitAt(twcp->ourImages[1].bitmap, 0, 0, selected); //moving surfaces into button - bonuses->buttons.back()->imgs[0].clear(); - bonuses->buttons.back()->imgs[0].push_back(notSelected); - bonuses->buttons.back()->imgs[0].push_back(selected); + bonuses->buttons.back()->imgs[0]->unload(); + bonuses->buttons.back()->imgs[0]->add(notSelected); + bonuses->buttons.back()->imgs[0]->add(selected); //cleaning delete de; diff --git a/client/GUIClasses.cpp b/client/GUIClasses.cpp index 882bbb54c..2b89037c9 100644 --- a/client/GUIClasses.cpp +++ b/client/GUIClasses.cpp @@ -15,6 +15,7 @@ #include "CConfigHandler.h" #include "CCreatureAnimation.h" #include "Graphics.h" +#include "../hch/CAnimation.h" #include "../hch/CArtHandler.h" #include "../hch/CBuildingHandler.h" #include "../hch/CGeneralTextHandler.h" @@ -3868,19 +3869,19 @@ CSystemOptionsWindow::CSystemOptionsWindow(const SDL_Rect &pos, CPlayerInterface // std::swap(save->imgs[0][0], load->imgs[0][1]); save = new AdventureMapButton (CGI->generaltexth->zelp[322].first, CGI->generaltexth->zelp[322].second, boost::bind(&CSystemOptionsWindow::bsavef, this), pos.x+357, pos.y+298, "SOSAVE.DEF", SDLK_s); - std::swap(save->imgs[0][0], save->imgs[0][1]); + save->imgs[0]->fixButtonPos(); // restart = new AdventureMapButton (CGI->generaltexth->zelp[323].first, CGI->generaltexth->zelp[323].second, boost::bind(&CSystemOptionsWindow::bmainmenuf, this), pos.x+346, pos.y+357, "SORSTRT", SDLK_r); // std::swap(save->imgs[0][0], restart->imgs[0][1]); mainMenu = new AdventureMapButton (CGI->generaltexth->zelp[320].first, CGI->generaltexth->zelp[320].second, boost::bind(&CSystemOptionsWindow::bmainmenuf, this), pos.x+357, pos.y+357, "SOMAIN.DEF", SDLK_m); - std::swap(mainMenu->imgs[0][0], mainMenu->imgs[0][1]); + mainMenu->imgs[0]->fixButtonPos(); quitGame = new AdventureMapButton (CGI->generaltexth->zelp[324].first, CGI->generaltexth->zelp[324].second, boost::bind(&CSystemOptionsWindow::bquitf, this), pos.x+246, pos.y+415, "soquit.def", SDLK_q); - std::swap(quitGame->imgs[0][0], quitGame->imgs[0][1]); + quitGame->imgs[0]->fixButtonPos(); backToMap = new AdventureMapButton (CGI->generaltexth->zelp[325].first, CGI->generaltexth->zelp[325].second, boost::bind(&CSystemOptionsWindow::breturnf, this), pos.x+357, pos.y+415, "soretrn.def", SDLK_RETURN); - std::swap(backToMap->imgs[0][0], backToMap->imgs[0][1]); + backToMap->imgs[0]->fixButtonPos(); backToMap->assignedKeys.insert(SDLK_ESCAPE); heroMoveSpeed = new CHighlightableButtonsGroup(0); diff --git a/client/Makefile.am b/client/Makefile.am index 43b6d3bc6..6f1f196db 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -13,7 +13,8 @@ vcmiclient_SOURCES = \ ../CThreadHelper.h \ ../StartInfo.h \ ../global.h \ - ../hch/CAmbarCendamo.h \ + ../hch/CAnimation.h \ + ../hch/CAnimation.cpp \ ../hch/CBuildingHandler.h \ ../hch/CDefHandler.cpp \ ../hch/CDefHandler.h \ diff --git a/client/Makefile.in b/client/Makefile.in index ef5caeb41..74350504a 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -59,6 +59,7 @@ PROGRAMS = $(bin_PROGRAMS) am_vcmiclient_OBJECTS = vcmiclient-CCallback.$(OBJEXT) \ vcmiclient-CGameInterface.$(OBJEXT) \ vcmiclient-CThreadHelper.$(OBJEXT) \ + vcmiclient-CAnimation.$(OBJEXT) \ vcmiclient-CDefHandler.$(OBJEXT) \ vcmiclient-CMusicHandler.$(OBJEXT) \ vcmiclient-CSndHandler.$(OBJEXT) \ @@ -280,7 +281,8 @@ vcmiclient_SOURCES = \ ../CThreadHelper.h \ ../StartInfo.h \ ../global.h \ - ../hch/CAmbarCendamo.h \ + ../hch/CAnimation.h \ + ../hch/CAnimation.cpp \ ../hch/CBuildingHandler.h \ ../hch/CDefHandler.cpp \ ../hch/CDefHandler.h \ @@ -437,6 +439,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-AdventureMapButton.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CAdvmapInterface.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CAnimation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBattleInterface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBitmapHandler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CCallback.Po@am__quote@ @@ -539,6 +542,22 @@ vcmiclient-CThreadHelper.obj: ../CThreadHelper.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CThreadHelper.obj `if test -f '../CThreadHelper.cpp'; then $(CYGPATH_W) '../CThreadHelper.cpp'; else $(CYGPATH_W) '$(srcdir)/../CThreadHelper.cpp'; fi` +vcmiclient-CAnimation.o: ../hch/CAnimation.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CAnimation.Tpo -c -o vcmiclient-CAnimation.o `test -f '../hch/CAnimation.cpp' || echo '$(srcdir)/'`../hch/CAnimation.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CAnimation.Tpo $(DEPDIR)/vcmiclient-CAnimation.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../hch/CAnimation.cpp' object='vcmiclient-CAnimation.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CAnimation.o `test -f '../hch/CAnimation.cpp' || echo '$(srcdir)/'`../hch/CAnimation.cpp + +vcmiclient-CAnimation.obj: ../hch/CAnimation.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CAnimation.Tpo -c -o vcmiclient-CAnimation.obj `if test -f '../hch/CAnimation.cpp'; then $(CYGPATH_W) '../hch/CAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/../hch/CAnimation.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CAnimation.Tpo $(DEPDIR)/vcmiclient-CAnimation.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../hch/CAnimation.cpp' object='vcmiclient-CAnimation.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CAnimation.obj `if test -f '../hch/CAnimation.cpp'; then $(CYGPATH_W) '../hch/CAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/../hch/CAnimation.cpp'; fi` + vcmiclient-CDefHandler.o: ../hch/CDefHandler.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CDefHandler.o -MD -MP -MF $(DEPDIR)/vcmiclient-CDefHandler.Tpo -c -o vcmiclient-CDefHandler.o `test -f '../hch/CDefHandler.cpp' || echo '$(srcdir)/'`../hch/CDefHandler.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CDefHandler.Tpo $(DEPDIR)/vcmiclient-CDefHandler.Po diff --git a/client/SDL_Extensions.cpp b/client/SDL_Extensions.cpp index 5f91a42c3..7c4c81c84 100644 --- a/client/SDL_Extensions.cpp +++ b/client/SDL_Extensions.cpp @@ -61,9 +61,9 @@ STRONG_INLINE void ColorPutter::PutColorAlphaSwitch(Uint8 *&p template STRONG_INLINE void ColorPutter::PutColor(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A) { - PutColor(ptr, (((Uint32)ptr[2]-(Uint32)R)*(Uint32)A) >> 8 + (Uint32)R, - (((Uint32)ptr[1]-(Uint32)G)*(Uint32)A) >> 8 + (Uint32)G, - (((Uint32)ptr[0]-(Uint32)B)*(Uint32)A) >> 8 + (Uint32)B); + PutColor(ptr, (((Uint32)ptr[2]-(Uint32)R)*(Uint32)A) >> (8 + (Uint32)R), + (((Uint32)ptr[1]-(Uint32)G)*(Uint32)A) >> (8 + (Uint32)G), + (((Uint32)ptr[0]-(Uint32)B)*(Uint32)A) >> (8 + (Uint32)B)); } diff --git a/configure b/configure index 7e5dd4594..32ecff66b 100755 --- a/configure +++ b/configure @@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for vcmi 0.82b. +# Generated by GNU Autoconf 2.67 for vcmi 0.82b. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -316,7 +316,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -356,19 +356,19 @@ else fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -679,7 +679,7 @@ test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -962,8 +962,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -1008,7 +1009,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1034,7 +1035,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1238,7 +1239,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1254,7 +1255,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1284,8 +1285,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1293,7 +1294,7 @@ Try \`$0 --help' for more information." # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1311,13 +1312,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1340,7 +1341,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1354,8 +1355,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1370,9 +1371,9 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1411,11 +1412,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1455,7 +1456,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1642,9 +1643,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF vcmi configure 0.82b -generated by GNU Autoconf 2.65 +generated by GNU Autoconf 2.67 -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1786,7 +1787,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1829,7 +1830,7 @@ $as_echo "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { + test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : @@ -1895,7 +1896,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1975,7 +1976,7 @@ $as_echo "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { + test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : @@ -2087,10 +2088,10 @@ fi ac_fn_cxx_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -2126,7 +2127,7 @@ if ac_fn_cxx_try_cpp "$LINENO"; then : else ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } @@ -2153,7 +2154,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -2174,7 +2175,7 @@ ac_fn_cxx_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2237,7 +2238,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by vcmi $as_me 0.82b, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2347,11 +2348,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -2385,11 +2384,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -2402,11 +2399,9 @@ _ASBOX echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -2420,11 +2415,9 @@ _ASBOX fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -2479,7 +2472,12 @@ _ACEOF ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2494,7 +2492,11 @@ do { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } fi done @@ -2570,7 +2572,7 @@ if $ac_cache_corrupted; then $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2587,16 +2589,22 @@ am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2712,11 +2720,11 @@ am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; esac # Do `set' in a subshell so we don't clobber the current shell's @@ -2738,7 +2746,7 @@ if ( # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - as_fn_error "ls -t appears to fail. Make sure there is not a broken + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi @@ -2748,7 +2756,7 @@ then # Ok. : else - as_fn_error "newly created file is older than distributed files! + as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -2986,7 +2994,7 @@ done $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -2994,7 +3002,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -3028,7 +3036,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then - as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi @@ -3316,9 +3324,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C++ compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "C++ compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3360,8 +3367,8 @@ done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3418,9 +3425,9 @@ $as_echo "$ac_try_echo"; } >&5 else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C++ compiled programs. +as_fn_error $? "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi @@ -3471,8 +3478,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3879,7 +3886,7 @@ ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } @@ -3890,16 +3897,16 @@ else test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -3924,7 +3931,7 @@ else ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -3932,7 +3939,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -4248,8 +4255,8 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -4672,7 +4679,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then - as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5 + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED @@ -4748,7 +4755,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP @@ -4814,7 +4821,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -4881,7 +4888,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then - as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP @@ -4997,7 +5004,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then : @@ -5199,13 +5206,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5202: $ac_compile\"" >&5) + (eval echo "\"\$as_me:5209: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:5205: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:5212: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:5208: output\"" >&5) + (eval echo "\"\$as_me:5215: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -6411,7 +6418,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6414 "configure"' > conftest.$ac_ext + echo '#line 6421 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7200,7 +7207,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -7216,11 +7223,11 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -7259,7 +7266,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -7275,18 +7282,18 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -7415,8 +7422,7 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -7866,7 +7872,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -7882,11 +7888,11 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -7925,7 +7931,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -7941,11 +7947,11 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else @@ -8408,11 +8414,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8411: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8417: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8415: \$? = $ac_status" >&5 + echo "$as_me:8421: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8747,11 +8753,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8750: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8756: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8754: \$? = $ac_status" >&5 + echo "$as_me:8760: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8852,11 +8858,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8855: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8861: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8859: \$? = $ac_status" >&5 + echo "$as_me:8865: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8907,11 +8913,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8910: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8916: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8914: \$? = $ac_status" >&5 + echo "$as_me:8920: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11287,7 +11293,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11290 "configure" +#line 11296 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11383,7 +11389,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11386 "configure" +#line 11392 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11798,7 +11804,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then : @@ -13339,11 +13345,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13342: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13348: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13346: \$? = $ac_status" >&5 + echo "$as_me:13352: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13438,11 +13444,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13441: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13447: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13445: \$? = $ac_status" >&5 + echo "$as_me:13451: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13490,11 +13496,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13493: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13499: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13497: \$? = $ac_status" >&5 + echo "$as_me:13503: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14488,7 +14494,7 @@ if test "x$GXX" = "xyes" -a "x$enable_debug" = "xyes" ; then fi if test "x$GXX" = "xyes" ; then - CXXFLAGS="$CXXFLAGS -Wall -Wno-switch-enum -Wno-sign-compare -Wcast-align -Wpointer-arith" + CXXFLAGS="$CXXFLAGS -Wall -Wno-switch -Wno-sign-compare -Wcast-align -Wpointer-arith" fi CXXFLAGS="$CXXFLAGS -DDATA_DIR=\\\"\$(pkgdatadir)\\\" -DBIN_DIR=\\\"\$(bindir)\\\" -DLIB_DIR=\\\"\$(pkglibdir)\\\"" @@ -14523,7 +14529,7 @@ if test "${with_boost_libdir+set}" = set; then : then ac_boost_lib_path="$withval" else - as_fn_error "--with-boost-libdir expected directory name" "$LINENO" 5 + as_fn_error $? "--with-boost-libdir expected directory name" "$LINENO" 5 fi else @@ -14714,7 +14720,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test "$succeeded" != "yes" ; then if test "$_version" = "0" ; then - as_fn_error "We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation." "$LINENO" 5 + as_fn_error $? "We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation." "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: Your boost libraries seems to old (version $_version)." >&5 $as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;} @@ -14820,7 +14826,7 @@ $as_echo "#define HAVE_BOOST_SYSTEM /**/" >>confdefs.h as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -14855,8 +14861,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break else link_system="no" @@ -14869,7 +14874,7 @@ fi as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -14904,8 +14909,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break else link_system="no" @@ -14919,7 +14923,7 @@ fi as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -14954,8 +14958,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break else link_system="no" @@ -14965,7 +14968,7 @@ fi fi if test "x$link_system" = "xno"; then - as_fn_error "Could not link against $ax_lib !" "$LINENO" 5 + as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5 fi fi @@ -15055,7 +15058,7 @@ $as_echo "#define HAVE_BOOST_FILESYSTEM /**/" >>confdefs.h as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15090,8 +15093,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_FILESYSTEM_LIB="-l$ax_lib"; link_filesystem="yes"; break else link_filesystem="no" @@ -15104,7 +15106,7 @@ fi as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15139,8 +15141,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_FILESYSTEM_LIB="-l$ax_lib"; link_filesystem="yes"; break else link_filesystem="no" @@ -15153,7 +15154,7 @@ fi as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15188,8 +15189,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_FILESYSTEM_LIB="-l$ax_lib"; link_filesystem="yes"; break else link_filesystem="no" @@ -15199,7 +15199,7 @@ fi fi if test "x$link_filesystem" != "xyes"; then - as_fn_error "Could not link against $ax_lib !" "$LINENO" 5 + as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5 fi fi @@ -15317,7 +15317,7 @@ $as_echo "#define HAVE_BOOST_THREAD /**/" >>confdefs.h as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15352,8 +15352,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_THREAD_LIB="-l$ax_lib"; link_thread="yes"; break else link_thread="no" @@ -15366,7 +15365,7 @@ fi as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15401,8 +15400,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_THREAD_LIB="-l$ax_lib"; link_thread="yes"; break else link_thread="no" @@ -15416,7 +15414,7 @@ fi as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15451,8 +15449,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_THREAD_LIB="-l$ax_lib"; link_thread="yes"; break else link_thread="no" @@ -15462,7 +15459,7 @@ fi fi if test "x$link_thread" = "xno"; then - as_fn_error "Could not link against $ax_lib !" "$LINENO" 5 + as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5 else case "x$build_os" in *bsd* ) @@ -15564,7 +15561,7 @@ $as_echo "#define HAVE_BOOST_IOSTREAMS /**/" >>confdefs.h as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15599,8 +15596,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_IOSTREAMS_LIB="-l$ax_lib"; link_iostreams="yes"; break else link_iostreams="no" @@ -15613,7 +15609,7 @@ fi as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15648,8 +15644,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_IOSTREAMS_LIB="-l$ax_lib"; link_iostreams="yes"; break else link_iostreams="no" @@ -15663,7 +15658,7 @@ fi as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5 $as_echo_n "checking for main in -l$ax_lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15692,8 +15687,7 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_IOSTREAMS_LIB="-l$ax_lib"; link_iostreams="yes"; break else link_iostreams="no" @@ -15703,7 +15697,7 @@ fi fi if test "x$link_iostreams" != "xyes"; then - as_fn_error "Could not link against $ax_lib !" "$LINENO" 5 + as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5 fi fi @@ -15753,7 +15747,7 @@ fi if test "$HAVE_SDL_CONFIG" = no; then -as_fn_error "sdl-config doesn't exist. Try to check the PATH enviroment." "$LINENO" 5 +as_fn_error $? "sdl-config doesn't exist. Try to check the PATH enviroment." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL_Init in -lSDL" >&5 @@ -15800,7 +15794,7 @@ _ACEOF LIBS="-lSDL $LIBS" else - as_fn_error "SDL library not found. Please install it." "$LINENO" 5 + as_fn_error $? "SDL library not found. Please install it." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lSDL_mixer" >&5 @@ -15841,7 +15835,7 @@ _ACEOF LIBS="-lSDL_mixer $LIBS" else - as_fn_error "SDL_mixer library not found. Please install it." "$LINENO" 5 + as_fn_error $? "SDL_mixer library not found. Please install it." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IMG_Load in -lSDL_image" >&5 @@ -15888,7 +15882,7 @@ _ACEOF LIBS="-lSDL_image $LIBS" else - as_fn_error "SDL_image library not found. Please install it." "$LINENO" 5 + as_fn_error $? "SDL_image library not found. Please install it." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lSDL_ttf" >&5 @@ -15929,7 +15923,7 @@ _ACEOF LIBS="-lSDL_ttf $LIBS" else - as_fn_error "SDL_ttf library not found. Please install it." "$LINENO" 5 + as_fn_error $? "SDL_ttf library not found. Please install it." "$LINENO" 5 fi @@ -15977,7 +15971,7 @@ _ACEOF LIBS="-lavformat $LIBS" else - as_fn_error "FFMpeg avformat library not found. Please install it." "$LINENO" 5 + as_fn_error $? "FFMpeg avformat library not found. Please install it." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lswscale" >&5 @@ -16018,7 +16012,7 @@ _ACEOF LIBS="-lswscale $LIBS" else - as_fn_error "FFMpeg swscale library not found. Please install it." "$LINENO" 5 + as_fn_error $? "FFMpeg swscale library not found. Please install it." "$LINENO" 5 fi @@ -16144,8 +16138,7 @@ for ac_header in fcntl.h stdlib.h string.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -16159,14 +16152,13 @@ for ac_header in boost/filesystem.hpp boost/algorithm/string.hpp boost/algorithm do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else - as_fn_error "Required boost headers not found. Please install it." "$LINENO" 5 + as_fn_error $? "Required boost headers not found. Please install it." "$LINENO" 5 fi done @@ -16177,8 +16169,7 @@ for ac_func in atexit memset pow select sqrt do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -16313,6 +16304,7 @@ DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -16336,19 +16328,19 @@ else fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error "conditional \"AMDEP\" was never defined. + as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error "conditional \"am__fastdepCXX\" was never defined. + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error "conditional \"am__fastdepCC\" was never defined. + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error "conditional \"am__fastdepCXX\" was never defined. + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi @@ -16498,19 +16490,19 @@ export LANGUAGE (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -16706,7 +16698,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -16760,7 +16752,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by vcmi $as_me 0.82b, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -16817,10 +16809,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ vcmi config.status 0.82b -configured by $0, generated by GNU Autoconf 2.65, +configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -16838,11 +16830,16 @@ ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -16864,6 +16861,7 @@ do $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; @@ -16874,7 +16872,7 @@ do ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -17289,7 +17287,7 @@ do "AI/GeniusAI/Makefile") CONFIG_FILES="$CONFIG_FILES AI/GeniusAI/Makefile" ;; "AI/EmptyAI/Makefile") CONFIG_FILES="$CONFIG_FILES AI/EmptyAI/Makefile" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -17326,7 +17324,7 @@ $debug || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -17343,7 +17341,7 @@ if test "x$ac_cr" = x; then fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi @@ -17357,18 +17355,18 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -17457,20 +17455,28 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -17488,7 +17494,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -17516,7 +17522,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -17543,7 +17549,7 @@ $as_echo "$as_me: creating $ac_file" >&6;} case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -17680,22 +17686,22 @@ s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} +which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -18613,7 +18619,7 @@ _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -18634,7 +18640,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 diff --git a/configure.ac b/configure.ac index ee260a77c..2d064c7e9 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ if test "x$GXX" = "xyes" -a "x$enable_debug" = "xyes" ; then fi if test "x$GXX" = "xyes" ; then - CXXFLAGS="$CXXFLAGS -Wall -Wno-switch-enum -Wno-sign-compare -Wcast-align -Wpointer-arith" + CXXFLAGS="$CXXFLAGS -Wall -Wno-switch -Wno-sign-compare -Wcast-align -Wpointer-arith" fi CXXFLAGS="$CXXFLAGS -DDATA_DIR=\\\"\$(pkgdatadir)\\\" -DBIN_DIR=\\\"\$(bindir)\\\" -DLIB_DIR=\\\"\$(pkglibdir)\\\"" diff --git a/hch/CAnimation.cpp b/hch/CAnimation.cpp new file mode 100644 index 000000000..7b807bfc6 --- /dev/null +++ b/hch/CAnimation.cpp @@ -0,0 +1,689 @@ +#include +#include +#include + +#include "SDL.h" +#include "SDL_image.h" + +#include "../client/CBitmapHandler.h" +#include "CAnimation.h" +#include "CLodHandler.h" + +/* + * CAnimation.cpp, part of VCMI engine + * + * Authors: listed in file AUTHORS in main folder + * + * License: GNU General Public License v2.0 or later + * Full text of license available in license.txt file, in main folder + * + */ + + +extern DLL_EXPORT CLodHandler *spriteh; + +/************************************************************************* + * DefFile, class used for def loading * + *************************************************************************/ + +bool CDefFile::haveFrame(size_t frame, size_t group) const +{ + if (offset.size() > group) + if (offset[group].size() > frame) + return true; + + return false; +} + +SDL_Surface * CDefFile::loadFrame(size_t frame, size_t group) const +{ + if (haveFrame(frame, group)) + return loadFrame(( unsigned char * )data+offset[group][frame], colors); + return NULL; +} + +SDL_Surface * CDefFile::loadFrame (const unsigned char * FDef, const BMPPalette * palette) +{ + SDL_Surface * ret=NULL; + + unsigned int BaseOffset, + SpriteWidth, SpriteHeight, //format of sprite + TotalRowLength, // length of read segment + add, FullHeight,FullWidth, + RowAdd, + prSize, + defType2; + int LeftMargin, RightMargin, TopMargin, BottomMargin; + + + unsigned char SegmentType; + + BaseOffset = 0; + SSpriteDef sd = * reinterpret_cast(FDef + BaseOffset); + + prSize = SDL_SwapLE32(sd.prSize); + defType2 = SDL_SwapLE32(sd.defType2); + FullWidth = SDL_SwapLE32(sd.FullWidth); + FullHeight = SDL_SwapLE32(sd.FullHeight); + SpriteWidth = SDL_SwapLE32(sd.SpriteWidth); + SpriteHeight = SDL_SwapLE32(sd.SpriteHeight); + LeftMargin = SDL_SwapLE32(sd.LeftMargin); + TopMargin = SDL_SwapLE32(sd.TopMargin); + RightMargin = FullWidth - SpriteWidth - LeftMargin; + BottomMargin = FullHeight - SpriteHeight - TopMargin; + + //if(LeftMargin + RightMargin < 0) + // SpriteWidth += LeftMargin + RightMargin; //ugly construction... TODO: check how to do it nicer + if (LeftMargin<0) + SpriteWidth+=LeftMargin; + if (RightMargin<0) + SpriteWidth+=RightMargin; + + // Note: this looks bogus because we allocate only FullWidth, not FullWidth+add + add = 4 - FullWidth%4; + if (add==4) + add=0; + + ret = SDL_CreateRGBSurface(SDL_SWSURFACE, FullWidth, FullHeight, 8, 0, 0, 0, 0); + //int tempee2 = readNormalNr(0,4,((unsigned char *)tempee.c_str())); + + BaseOffset += sizeof(SSpriteDef); + int BaseOffsetor = BaseOffset; + + for (int i=0; i<256; ++i) + { + SDL_Color pr; + pr.r = palette[i].R; + pr.g = palette[i].G; + pr.b = palette[i].B; + pr.unused = palette[i].F; + (*(ret->format->palette->colors+i))=pr; + } + + int ftcp=0; + + // If there's a margin anywhere, just blank out the whole surface. + if (TopMargin > 0 || BottomMargin > 0 || LeftMargin > 0 || RightMargin > 0) + { + memset( reinterpret_cast(ret->pixels), 0, FullHeight*FullWidth); + } + + // Skip top margin + if (TopMargin > 0) + ftcp += TopMargin*(FullWidth+add); + + switch (defType2) + { + case 0: + { + for (unsigned int i=0; i0) + ftcp += LeftMargin; + + memcpy(reinterpret_cast(ret->pixels)+ftcp, &FDef[BaseOffset], SpriteWidth); + ftcp += SpriteWidth; + BaseOffset += SpriteWidth; + + if (RightMargin>0) + ftcp += RightMargin; + } + } + break; + + case 1: + { + const unsigned int * RWEntriesLoc = reinterpret_cast(FDef+BaseOffset); + BaseOffset += sizeof(int) * SpriteHeight; + for (unsigned int i=0; i0) + ftcp += LeftMargin; + + TotalRowLength=0; + do + { + unsigned int SegmentLength; + + SegmentType=FDef[BaseOffset++]; + SegmentLength=FDef[BaseOffset++] + 1; + + if (SegmentType==0xFF) + { + memcpy(reinterpret_cast(ret->pixels)+ftcp, FDef + BaseOffset, SegmentLength); + BaseOffset+=SegmentLength; + } + else + { + memset(reinterpret_cast(ret->pixels)+ftcp, SegmentType, SegmentLength); + } + ftcp += SegmentLength; + TotalRowLength += SegmentLength; + } + while (TotalRowLength0) + ftcp += RightMargin; + + if (add>0) + ftcp += add+RowAdd; + } + } + break; + + case 2: + { + BaseOffset = BaseOffsetor + SDL_SwapLE16(read_unaligned_u16(FDef + BaseOffsetor)); + + for (unsigned int i=0; i0) + ftcp += LeftMargin; + + TotalRowLength=0; + + do + { + SegmentType=FDef[BaseOffset++]; + unsigned char code = SegmentType / 32; + unsigned char value = (SegmentType & 31) + 1; + if (code==7) + { + memcpy(reinterpret_cast(ret->pixels)+ftcp, &FDef[BaseOffset], value); + ftcp += value; + BaseOffset += value; + } + else + { + memset(reinterpret_cast(ret->pixels)+ftcp, code, value); + ftcp += value; + } + TotalRowLength+=value; + } + while (TotalRowLength0) + ftcp += RightMargin; + + RowAdd=SpriteWidth-TotalRowLength; + + if (add>0) + ftcp += add+RowAdd; + } + } + break; + + case 3: + { + for (unsigned int i=0; i0) + ftcp += LeftMargin; + + TotalRowLength=0; + + do + { + SegmentType=FDef[BaseOffset++]; + unsigned char code = SegmentType / 32; + unsigned char value = (SegmentType & 31) + 1; + + int len = std::min(value, SpriteWidth - TotalRowLength) - std::max(0, -LeftMargin); + amax(len, 0); + + if (code==7) + { + memcpy((ui8*)ret->pixels + ftcp, FDef + BaseOffset, len); + ftcp += len; + BaseOffset += len; + } + else + { + memset((ui8*)ret->pixels + ftcp, code, len); + ftcp += len; + } + TotalRowLength+=( LeftMargin>=0 ? value : value+LeftMargin ); + } + while (TotalRowLength0) + ftcp += RightMargin; + + RowAdd=SpriteWidth-TotalRowLength; + + if (add>0) + ftcp += add+RowAdd; + } + } + break; + + default: + throw std::string("Unknown sprite format."); + break; + } + + SDL_Color ttcol = ret->format->palette->colors[0]; + Uint32 keycol = SDL_MapRGBA(ret->format, ttcol.r, ttcol.b, ttcol.g, ttcol.unused); + SDL_SetColorKey(ret, SDL_SRCCOLORKEY, keycol); + return ret; +}; + +BMPPalette * CDefFile::getPalette() +{ + BMPPalette * ret = new BMPPalette[256]; + memcpy(ret, colors, sizeof(BMPPalette)*256); + return ret; +} + +CDefFile::CDefFile(std::string Name):data(NULL),colors(NULL) +{ + data = spriteh->giveFile(Name, &datasize); + if (!data) + { + tlog0<<"Error: file "<< Name <<" not found\n"; + return; + } + + colors = new BMPPalette[256]; + int it = 0; + + //int type = readNormalNr(data, it); it+=4; + //int width = readNormalNr(data, it); it+=4;//not used + //int height = readNormalNr(data, it); it+=4; + it+=12; + unsigned int totalBlocks = readNormalNr(data, it); + it+=4; + + for (unsigned int i=0; i<256; i++) + { + colors[i].R = data[it++]; + colors[i].G = data[it++]; + colors[i].B = data[it++]; + colors[i].F = 0; + } + + offset.resize(totalBlocks); + offList.insert(datasize); + + for (unsigned int i=0; i group) + { + if (offset[group].size() > frame) + { + size_t offs = offset[group][frame]; + + std::set::iterator it = offList.find(offs); + + if (it == offList.end() || ++it == offList.end()) + tlog0<<"Error: offset not found!\n"; + + size_t size = *it - offs; + + unsigned char * ret = new unsigned char[size]; + memcpy(ret, data+offs, size); + return ret; + } + } + return NULL; +} + +CDefFile::~CDefFile() +{ + delete[] data; + delete[] colors; +} + +bool CDefFile::loaded() const +{ + return data != NULL; +} + +/************************************************************************* + * CAnimation for animations handling, can load part of file if needed * + *************************************************************************/ + +CAnimation::AnimEntry::AnimEntry(): + surf(NULL), + source(0), + refCount(0), + data(NULL), + dataSize(0) +{ + +} + +bool CAnimation::loadFrame(CDefFile * file, size_t frame, size_t group) +{ + if (groupSize(group) <= frame) + return false; + AnimEntry &e = entries[group][frame]; + + if (e.surf || e.data) + { + e.refCount++; + return true; + } + + if (e.source & 6)//load frame with SDL_Image + { + int size; + unsigned char * pic = NULL; + + std::ostringstream str; + if ( e.source & 2 ) + str << name << '#' << (group+1) << '#' << (frame+1); // file#12#34.* + else + str << name << '#' << (frame+1);//file#34.* + + pic = spriteh->giveFile(str.str(), &size); + if (pic) + { + if (compressed) + { + e.data = pic; + e.dataSize = size; + } + else + { + e.surf = IMG_Load_RW( SDL_RWFromMem((void*)pic, size), 1); + delete pic; + } + } + } + else if (file && e.source & 1)//try to get image from def + { + if (compressed) + e.data = file->getFrame(frame, group); + else + e.surf = file->loadFrame(frame, group); + } + + if (!(e.surf || e.data)) + return false;//failed to load + + e.refCount++; + return true; +} + +bool CAnimation::unloadFrame(size_t frame, size_t group) +{ + if (groupSize(group) > frame && entries[group][frame].refCount) + { + AnimEntry &e = entries[group][frame]; + if (--e.refCount)//not last ref + return true; + + SDL_FreeSurface(e.surf); + delete e.data; + + e.surf = NULL; + e.data = NULL; + return true; + } + return false; +} + +void CAnimation::decompress(AnimEntry &entry) +{ + if (entry.source & 6)//load frame with SDL_Image + entry.surf = IMG_Load_RW( SDL_RWFromMem((void*)entry.data, entry.dataSize), 1); + + else if (entry.source & 1) + entry.surf = CDefFile::loadFrame(entry.data, defPalette); +} + +void CAnimation::init(CDefFile * file) +{ + if (compressed) + defPalette = file->getPalette(); + + for (size_t group = 0; ; group++) + { + std::vector toAdd; + + for (size_t frame = 0; ; frame++) + { + unsigned char res=0; + + { + std::ostringstream str; + str << name << '#' << (group+1) << '#' << (frame+1); // format: file#12#34.* + if (spriteh->haveFile(str.str())) + res |= 2; + } + + if (group == 0) + { + std::ostringstream str; + str << name << '#' << (frame+1);// format: file#34.* + if ( spriteh->haveFile(str.str())) + res |=4; + } + + if (file)//we have def too. try to get image from def + { + if (file->haveFrame(frame, group)) + res |=1; + } + + if (res) + { + toAdd.push_back(AnimEntry()); + toAdd.back().source = res; + } + else + break; + } + if (!toAdd.empty()) + { + entries.push_back(toAdd); + break; + } + } +} + +CDefFile * CAnimation::getFile() const +{ + CDefFile * file = new CDefFile(name); + if (!file->loaded()) + { + delete file; + return NULL; + } + return file; +} + +void CAnimation::printError(size_t frame, size_t group, std::string type) const +{ + tlog0 << type <<" error: Request for frame not present in CAnimation!\n" + <<"\tFile name: "<refcount++; + + entries[group].push_back(AnimEntry()); + entries[group].back().refCount = 1; + entries[group].back().surf = surf; +} + +void CAnimation::purgeCompressed() +{ + for (size_t group; group < entries.size(); group++) + for (size_t frame; frame < entries[group].size(); frame++) + if (entries[group][frame].surf) + SDL_FreeSurface(entries[group][frame].surf); +} + +SDL_Surface * CAnimation::image(size_t frame) +{ + size_t group=0; + for (; group entries[group].size(); group++) + frame -= entries[group].size(); + + return image(frame, group); +} + +SDL_Surface * CAnimation::image(size_t frame, size_t group) +{ + if ( groupSize(group) > frame ) + { + AnimEntry &e = entries[group][frame]; + if (!e.surf && e.data) + decompress(e); + return e.surf; + } + + printError(frame, group, "GetImage"); + return NULL; +} + +void CAnimation::load() +{ + CDefFile * file = getFile(); + + for (size_t group = 0; group > frames) +{ + CDefFile * file = getFile(); + for (size_t i=0; i > frames) +{ + for (size_t i=0; i 1 ) + std::swap(entries[0][1].surf, entries[0][0].surf); +} + +size_t CAnimation::groupSize(size_t group) const +{ + if (entries.size() > group) + return entries[group].size(); + + return 0; +} + +size_t CAnimation::size() const +{ + size_t ret=0; + for (size_t i=0; i +#include +#include +#include "../global.h" + +/* + * CAnimation.h, part of VCMI engine + * + * Authors: listed in file AUTHORS in main folder + * + * License: GNU General Public License v2.0 or later + * Full text of license available in license.txt file, in main folder + * + */ + +struct SDL_Surface; +struct BMPPalette; + +//class for def loading, methods are based on CDefHandler +//after loading will store general info (palette and frame offsets) and pointer to file itself +class CDefFile +{ +private: + + struct SSpriteDef + { + ui32 prSize; + ui32 defType2; + ui32 FullWidth; + ui32 FullHeight; + ui32 SpriteWidth; + ui32 SpriteHeight; + ui32 LeftMargin; + ui32 TopMargin; + }; + + unsigned char * data; + int datasize; + BMPPalette * colors; + + //offset[group][frame] - offset of frame data in file + std::vector< std::vector > offset; + + //sorted list of offsets used to determine size + std::set offList; + + +public: + CDefFile(std::string Name); + ~CDefFile(); + + //true if file was opened correctly + bool loaded() const; + + //get copy of palette to unpack compressed animation + BMPPalette * getPalette(); + + //true if frame is present in it + bool haveFrame(size_t frame, size_t group) const; + + //get copy of binary data + unsigned char * getFrame(size_t frame, size_t group) const; + + //load frame as SDL_Surface + SDL_Surface * loadFrame(size_t frame, size_t group) const ; + + //static version of previous one for calling from compressed anim + static SDL_Surface * loadFrame(const unsigned char * FDef, const BMPPalette * palette); +}; + +// Class for handling animation. +class CAnimation +{ +private: + + //internal structure to hold all data of specific frame + struct AnimEntry + { + //surface for this entry + SDL_Surface * surf; + + //bitfield, location of image data: 1 - def, 2 - file#9.*, 4 - file#9#2.* + unsigned char source; + + //reference count, changed by loadFrame \ unloadFrame + size_t refCount; + + //data for CompressedAnim + unsigned char * data; + + //size of compressed data, unused for def files + size_t dataSize; + + AnimEntry(); + }; + + //animation file name + std::string name; + + //if true all frames will be stored in compressed state + const bool compressed; + + //palette from def file, used only for compressed anim + BMPPalette * defPalette; + + //entries[group][position], store all info regarding frames + std::vector< std::vector > entries; + + //loader, will be called by load(), require opened def file for loading from it. Returns true if image is loaded + bool loadFrame(CDefFile * file, size_t frame, size_t group); + + //unloadFrame, returns true if image has been unloaded ( either deleted or decreased refCount) + bool unloadFrame(size_t frame, size_t group); + + //decompress entry data + void decompress(AnimEntry &entry); + + //initialize animation from file + void init(CDefFile * file); + + //try to open def file + CDefFile * getFile() const; + + //to get rid of copy-pasting error message :] + void printError(size_t frame, size_t group, std::string type) const; + +public: + + CAnimation(std::string Name, bool Compressed = false); + CAnimation(); + ~CAnimation(); + + //add custom surface to the end of specific group. If shared==true surface needs to be deleted + //somewhere outside of CAnim as well (SDL_Surface::refcount will be increased) + void add(SDL_Surface * surf, bool shared=false, size_t group=0); + + //removes all surfaces which have compressed data + void purgeCompressed(); + + //get pointer to surface, this function ignores groups (like ourImages in DefHandler) + SDL_Surface * image (size_t frame); + + //get pointer to surface, from specific group + SDL_Surface * image(size_t frame, size_t group); + + //all available frames + void load (); + void unload(); + + //all frames from group + void loadGroup (size_t group); + void unloadGroup(size_t group); + + //single image + void load (size_t frame, size_t group=0); + void unload(size_t frame, size_t group=0); + + //list of frames (first = group ID, second = frame ID) + void load (std::vector > frames); + void unload(std::vector > frames); + + //helper to fix frame order on some buttons + void fixButtonPos(); + + //size of specific group, 0 if not present + size_t groupSize(size_t group) const; + + //total count of frames in whole anim + size_t size() const; + + +}; + +#endif // __CANIMATIONHANDLER_H__ diff --git a/hch/CLodHandler.cpp b/hch/CLodHandler.cpp index bd27a2744..ba33ea571 100644 --- a/hch/CLodHandler.cpp +++ b/hch/CLodHandler.cpp @@ -119,6 +119,17 @@ unsigned char * CLodHandler::giveFile(std::string defName, int * length) return NULL; } +bool CLodHandler::haveFile(std::string name) +{ + std::transform(name.begin(), name.end(), name.begin(), (int(*)(int))toupper); + int dotPos = name.find_last_of('.'); + if ( dotPos != -1 ) + name.erase(dotPos); + + Entry * ourEntry = entries.znajdz(Entry(name)); + return ourEntry != NULL; +} + DLL_EXPORT int CLodHandler::infs2(unsigned char * in, int size, int realSize, unsigned char *& out, int wBits) { int ret; @@ -232,12 +243,15 @@ void CLodHandler::init(std::string lodFile, std::string dirName) std::transform(entry.nameStr.begin(), entry.nameStr.end(), entry.nameStr.begin(), toupper); - int dotPos = entry.nameStr.find_last_of('.'); - std::string ext = entry.nameStr.substr(dotPos); - if (ext == ".MSK" || ext == ".MSG") - entry.nameStr[dotPos] = '#';//this files have same name as def - rename to defName#msk - else - entry.nameStr.erase(dotPos);//filename.ext becomes filename + size_t dotPos = entry.nameStr.find_last_of('.'); + if ( dotPos < entry.nameStr.size() ) + { + std::string ext = entry.nameStr.substr(dotPos); + if (ext == ".MSK" || ext == ".MSG") + entry.nameStr[dotPos] = '#';//this files have same name as def - rename to defName#msk + else + entry.nameStr.erase(dotPos);//filename.ext becomes filename + } entry.offset= SDL_SwapLE32(lodEntries[i].offset); entry.realSize = SDL_SwapLE32(lodEntries[i].uncompressedSize); @@ -259,12 +273,15 @@ void CLodHandler::init(std::string lodFile, std::string dirName) std::string realname = name; std::transform(name.begin(), name.end(), name.begin(), (int(*)(int))toupper); - int dotPos = name.find_last_of('.'); - std::string ext = name.substr(dotPos); - if (ext == ".MSK" || ext == ".MSG") - name[dotPos] = '#';//this files have same name as def - rename to defName#msk - else - name.erase(dotPos);//filename.ext becomes filename + size_t dotPos = name.find_last_of('.'); + if ( dotPos < name.size() ) + { + std::string ext = name.substr(dotPos); + if (ext == ".MSK" || ext == ".MSG") + name[dotPos] = '#';//this files have same name as def - rename to defName#msk + else + name.erase(dotPos);//filename.ext becomes filename + } Entry * e = entries.znajdz(name); if(e) //file present in .lod - overwrite its entry diff --git a/hch/CLodHandler.h b/hch/CLodHandler.h index 28c0dba27..fce3bed4f 100644 --- a/hch/CLodHandler.h +++ b/hch/CLodHandler.h @@ -77,6 +77,7 @@ public: ~CLodHandler(); int infs2(unsigned char * in, int size, int realSize, unsigned char*& out, int wBits=15); //zlib fast handler unsigned char * giveFile(std::string defName, int * length=NULL); //returns pointer to the decompressed data - it must be deleted when no longer needed! + bool haveFile(std::string name);//check if file is present in lod std::string getTextFile(std::string name); //extracts one file void extractFile(std::string FName, std::string name); //extracts a specific file void init(std::string lodFile, std::string dirName); diff --git a/lib/Connection.h b/lib/Connection.h index fa2d183e8..d2189d24b 100644 --- a/lib/Connection.h +++ b/lib/Connection.h @@ -283,10 +283,10 @@ public: } template - T* getVectorItemFromId(const VectorisedObjectInfo &oInfo, si32 id) const + T* getVectorItemFromId(const VectorisedObjectInfo &oInfo, ui32 id) const { - if(id < 0) - return NULL; + /* if(id < 0) + return NULL;*/ assert(oInfo.vector); assert(oInfo.vector->size() > id); @@ -673,14 +673,14 @@ public: typedef typename VectorisedTypeFor::type VType; //eg: CGHeroInstance -> CGobjectInstance if(const VectorisedObjectInfo *info = getVectorisedTypeInfo()) { - si32 id; + ui32 id; *this >> id; data = static_cast(getVectorItemFromId(*info, id)); return; } } - ui32 pid = -1; //pointer id (or maybe rather pointee id) + ui32 pid = 0xffffffff; //pointer id (or maybe rather pointee id) if(smartPointerSerialization) { *this >> pid; //get the id @@ -721,7 +721,7 @@ public: template void ptrAllocated(const T *ptr, ui32 pid) { - if(smartPointerSerialization && pid != -1) + if(smartPointerSerialization && pid != 0xffffffff) loadedPointers[pid] = (void*)ptr; //add loaded pointer to our lookup map; cast is to avoid errors with const T* pt }