diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index 3b1b5444b..44bc416b9 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -657,7 +657,7 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti }); select->addTextOverlay(CGI->generaltexth->allTexts[500], FONT_SMALL, overlayColor); - CButton *opts = new CButton(Point(411, 510), "GSPBUTT.DEF", CGI->generaltexth->zelp[46], boost::bind(&CSelectionScreen::toggleTab, this, opt), SDLK_a); + CButton *opts = new CButton(Point(411, 510), "GSPBUTT.DEF", CGI->generaltexth->zelp[46], std::bind(&CSelectionScreen::toggleTab, this, opt), SDLK_a); opts->addTextOverlay(CGI->generaltexth->allTexts[501], FONT_SMALL, overlayColor); CButton * randomBtn = new CButton(Point(411, 105), "GSPBUTT.DEF", CGI->generaltexth->zelp[47], 0, SDLK_r); @@ -668,11 +668,11 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti changeSelection(randMapTab->getMapInfo()); }); - start = new CButton(Point(411, 535), "SCNRBEG.DEF", CGI->generaltexth->zelp[103], boost::bind(&CSelectionScreen::startScenario, this), SDLK_b); + start = new CButton(Point(411, 535), "SCNRBEG.DEF", CGI->generaltexth->zelp[103], std::bind(&CSelectionScreen::startScenario, this), SDLK_b); if(network) { - CButton *hideChat = new CButton(Point(619, 83), "GSPBUT2.DEF", CGI->generaltexth->zelp[48], boost::bind(&InfoCard::toggleChat, card), SDLK_h); + CButton *hideChat = new CButton(Point(619, 83), "GSPBUT2.DEF", CGI->generaltexth->zelp[48], std::bind(&InfoCard::toggleChat, card), SDLK_h); hideChat->addTextOverlay(CGI->generaltexth->allTexts[531], FONT_SMALL); if(multiPlayer == CMenuScreen::MULTI_NETWORK_GUEST) @@ -687,21 +687,21 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti break; case CMenuScreen::loadGame: sel->recActions = 255; - start = new CButton(Point(411, 535), "SCNRLOD.DEF", CGI->generaltexth->zelp[103], boost::bind(&CSelectionScreen::startScenario, this), SDLK_l); + start = new CButton(Point(411, 535), "SCNRLOD.DEF", CGI->generaltexth->zelp[103], std::bind(&CSelectionScreen::startScenario, this), SDLK_l); break; case CMenuScreen::saveGame: sel->recActions = 255; - start = new CButton(Point(411, 535), "SCNRSAV.DEF", CGI->generaltexth->zelp[103], boost::bind(&CSelectionScreen::startScenario, this), SDLK_s); + start = new CButton(Point(411, 535), "SCNRSAV.DEF", CGI->generaltexth->zelp[103], std::bind(&CSelectionScreen::startScenario, this), SDLK_s); break; case CMenuScreen::campaignList: sel->recActions = 255; - start = new CButton(Point(411, 535), "SCNRLOD.DEF", CButton::tooltip(), boost::bind(&CSelectionScreen::startCampaign, this), SDLK_b); + start = new CButton(Point(411, 535), "SCNRLOD.DEF", CButton::tooltip(), std::bind(&CSelectionScreen::startCampaign, this), SDLK_b); break; } start->assignedKeys.insert(SDLK_RETURN); - back = new CButton(Point(581, 535), "SCNRBACK.DEF", CGI->generaltexth->zelp[105], boost::bind(&CGuiHandler::popIntTotally, &GH, this), SDLK_ESCAPE); + back = new CButton(Point(581, 535), "SCNRBACK.DEF", CGI->generaltexth->zelp[105], std::bind(&CGuiHandler::popIntTotally, &GH, this), SDLK_ESCAPE); if(network) { @@ -1264,7 +1264,7 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const std::functiongeneraltexth->zelp[54+i], boost::bind(&SelectionTab::filter, this, sizes[i], true)); + new CButton(Point(158 + 47*i, 46), names[i], CGI->generaltexth->zelp[54+i], std::bind(&SelectionTab::filter, this, sizes[i], true)); } //sort buttons buttons @@ -1278,18 +1278,18 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const std::functiongeneraltexth->zelp[107+i], boost::bind(&SelectionTab::sortBy, this, criteria)); + new CButton(Point(xpos[i], 86), names[i], CGI->generaltexth->zelp[107+i], std::bind(&SelectionTab::sortBy, this, criteria)); } } } else { //sort by buttons - new CButton(Point(23, 86), "CamCusM.DEF", CButton::tooltip(), boost::bind(&SelectionTab::sortBy, this, _numOfMaps)); //by num of maps - new CButton(Point(55, 86), "CamCusL.DEF", CButton::tooltip(), boost::bind(&SelectionTab::sortBy, this, _name)); //by name + new CButton(Point(23, 86), "CamCusM.DEF", CButton::tooltip(), std::bind(&SelectionTab::sortBy, this, _numOfMaps)); //by num of maps + new CButton(Point(55, 86), "CamCusL.DEF", CButton::tooltip(), std::bind(&SelectionTab::sortBy, this, _name)); //by name } - slider = new CSlider(Point(372, 86), tabType != CMenuScreen::saveGame ? 480 : 430, boost::bind(&SelectionTab::sliderMove, this, _1), positions, curItems.size(), 0, false, CSlider::BLUE); + slider = new CSlider(Point(372, 86), tabType != CMenuScreen::saveGame ? 480 : 430, std::bind(&SelectionTab::sliderMove, this, _1), positions, curItems.size(), 0, false, CSlider::BLUE); slider->addUsedEvents(WHEEL); format = CDefHandler::giveDef("SCSELC.DEF"); @@ -2247,7 +2247,7 @@ OptionsTab::OptionsTab(): pos = bg->pos; if(SEL->screenType == CMenuScreen::newGame) - turnDuration = new CSlider(Point(55, 551), 194, boost::bind(&OptionsTab::setTurnLength, this, _1), 1, 11, 11, true, CSlider::BLUE); + turnDuration = new CSlider(Point(55, 551), 194, std::bind(&OptionsTab::setTurnLength, this, _1), 1, 11, 11, true, CSlider::BLUE); } OptionsTab::~OptionsTab() @@ -2551,12 +2551,12 @@ OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry( OptionsTab *owner, PlayerSet bg = new CPicture(BitmapHandler::loadBitmap(bgs[s.color.getNum()]), 0, 0, true); if(SEL->screenType == CMenuScreen::newGame) { - btns[0] = new CButton(Point(107, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[132], boost::bind(&OptionsTab::nextCastle, owner, s.color, -1)); - btns[1] = new CButton(Point(168, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[133], boost::bind(&OptionsTab::nextCastle, owner, s.color, +1)); - btns[2] = new CButton(Point(183, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[148], boost::bind(&OptionsTab::nextHero, owner, s.color, -1)); - btns[3] = new CButton(Point(244, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[149], boost::bind(&OptionsTab::nextHero, owner, s.color, +1)); - btns[4] = new CButton(Point(259, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[164], boost::bind(&OptionsTab::nextBonus, owner, s.color, -1)); - btns[5] = new CButton(Point(320, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[165], boost::bind(&OptionsTab::nextBonus, owner, s.color, +1)); + btns[0] = new CButton(Point(107, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[132], std::bind(&OptionsTab::nextCastle, owner, s.color, -1)); + btns[1] = new CButton(Point(168, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[133], std::bind(&OptionsTab::nextCastle, owner, s.color, +1)); + btns[2] = new CButton(Point(183, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[148], std::bind(&OptionsTab::nextHero, owner, s.color, -1)); + btns[3] = new CButton(Point(244, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[149], std::bind(&OptionsTab::nextHero, owner, s.color, +1)); + btns[4] = new CButton(Point(259, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[164], std::bind(&OptionsTab::nextBonus, owner, s.color, -1)); + btns[5] = new CButton(Point(320, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[165], std::bind(&OptionsTab::nextBonus, owner, s.color, +1)); } else for(auto & elem : btns) @@ -2578,7 +2578,7 @@ OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry( OptionsTab *owner, PlayerSet && SEL->current->mapHeader->players[s.color.getNum()].canHumanPlay && SEL->multiPlayer != CMenuScreen::MULTI_NETWORK_GUEST) { - flag = new CButton(Point(-43, 2), flags[s.color.getNum()], CGI->generaltexth->zelp[180], boost::bind(&OptionsTab::flagPressed, owner, s.color)); + flag = new CButton(Point(-43, 2), flags[s.color.getNum()], CGI->generaltexth->zelp[180], std::bind(&OptionsTab::flagPressed, owner, s.color)); flag->hoverable = true; } else @@ -2985,7 +2985,7 @@ CScenarioInfo::CScenarioInfo(const CMapHeader *mapHeader, const StartInfo *start card->changeSelection(current); card->difficulty->setSelected(startInfo->difficulty); - back = new CButton(Point(584, 535), "SCNRBACK.DEF", CGI->generaltexth->zelp[105], boost::bind(&CGuiHandler::popIntTotally, &GH, this), SDLK_ESCAPE); + back = new CButton(Point(584, 535), "SCNRBACK.DEF", CGI->generaltexth->zelp[105], std::bind(&CGuiHandler::popIntTotally, &GH, this), SDLK_ESCAPE); } CScenarioInfo::~CScenarioInfo() @@ -3064,9 +3064,9 @@ CMultiMode::CMultiMode() txt = new CTextInput(Rect(19, 436, 334, 16), *bg); txt->setText(settings["general"]["playerName"].String()); //Player - btns[0] = new CButton(Point(373, 78), "MUBHOT.DEF", CGI->generaltexth->zelp[266], boost::bind(&CMultiMode::openHotseat, this)); - btns[1] = new CButton(Point(373, 78 + 57*1), "MUBHOST.DEF", CButton::tooltip("Host TCP/IP game", ""), boost::bind(&CMultiMode::hostTCP, this)); - btns[2] = new CButton(Point(373, 78 + 57*2), "MUBJOIN.DEF", CButton::tooltip("Join TCP/IP game", ""), boost::bind(&CMultiMode::joinTCP, this)); + btns[0] = new CButton(Point(373, 78), "MUBHOT.DEF", CGI->generaltexth->zelp[266], std::bind(&CMultiMode::openHotseat, this)); + btns[1] = new CButton(Point(373, 78 + 57*1), "MUBHOST.DEF", CButton::tooltip("Host TCP/IP game", ""), std::bind(&CMultiMode::hostTCP, this)); + btns[2] = new CButton(Point(373, 78 + 57*2), "MUBJOIN.DEF", CButton::tooltip("Join TCP/IP game", ""), std::bind(&CMultiMode::joinTCP, this)); btns[6] = new CButton(Point(373, 424), "MUBCANC.DEF", CGI->generaltexth->zelp[288], [&] { GH.popIntTotally(this);}, SDLK_ESCAPE); } @@ -3107,8 +3107,8 @@ CHotSeatPlayers::CHotSeatPlayers(const std::string &firstPlayer) txt[i]->cb += std::bind(&CHotSeatPlayers::onChange, this, _1); } - ok = new CButton(Point(95, 338), "MUBCHCK.DEF", CGI->generaltexth->zelp[560], boost::bind(&CHotSeatPlayers::enterSelectionScreen, this), SDLK_RETURN); - cancel = new CButton(Point(205, 338), "MUBCANC.DEF", CGI->generaltexth->zelp[561], boost::bind(&CGuiHandler::popIntTotally, boost::ref(GH), this), SDLK_ESCAPE); + ok = new CButton(Point(95, 338), "MUBCHCK.DEF", CGI->generaltexth->zelp[560], std::bind(&CHotSeatPlayers::enterSelectionScreen, this), SDLK_RETURN); + cancel = new CButton(Point(205, 338), "MUBCANC.DEF", CGI->generaltexth->zelp[561], std::bind(&CGuiHandler::popIntTotally, std::ref(GH), this), SDLK_ESCAPE); bar = new CGStatusBar(new CPicture(Rect(7, 381, 348, 18), 0));//226, 472 txt[0]->setText(firstPlayer, true); @@ -3171,9 +3171,9 @@ void CBonusSelection::init() blitAt(panel, 456, 6, background); - startB = new CButton(Point(475, 536), "CBBEGIB.DEF", CButton::tooltip(), boost::bind(&CBonusSelection::startMap, this), SDLK_RETURN); - restartB = new CButton(Point(475, 536), "CBRESTB.DEF", CButton::tooltip(), boost::bind(&CBonusSelection::restartMap, this), SDLK_RETURN); - backB = new CButton(Point(624, 536), "CBCANCB.DEF", CButton::tooltip(), boost::bind(&CBonusSelection::goBack, this), SDLK_ESCAPE); + startB = new CButton(Point(475, 536), "CBBEGIB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::startMap, this), SDLK_RETURN); + restartB = new CButton(Point(475, 536), "CBRESTB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::restartMap, this), SDLK_RETURN); + backB = new CButton(Point(624, 536), "CBCANCB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::goBack, this), SDLK_ESCAPE); //campaign name if (ourCampaign->camp->header.name.length()) @@ -3246,8 +3246,8 @@ void CBonusSelection::init() //difficulty selection buttons if (ourCampaign->camp->header.difficultyChoosenByPlayer) { - diffLb = new CButton(Point(694, 508), "SCNRBLF.DEF", CButton::tooltip(), boost::bind(&CBonusSelection::decreaseDifficulty, this)); - diffRb = new CButton(Point(738, 508), "SCNRBRT.DEF", CButton::tooltip(), boost::bind(&CBonusSelection::increaseDifficulty, this)); + diffLb = new CButton(Point(694, 508), "SCNRBLF.DEF", CButton::tooltip(), std::bind(&CBonusSelection::decreaseDifficulty, this)); + diffRb = new CButton(Point(738, 508), "SCNRBRT.DEF", CButton::tooltip(), std::bind(&CBonusSelection::increaseDifficulty, this)); } //load miniflags @@ -4097,7 +4097,7 @@ CButton* CCampaignScreen::createExitButton(const JsonNode& button) if (!button["help"].isNull() && button["help"].Float() > 0) help = CGI->generaltexth->zelp[button["help"].Float()]; - std::function close = boost::bind(&CGuiHandler::popIntTotally, &GH, this); + std::function close = std::bind(&CGuiHandler::popIntTotally, &GH, this); return new CButton(Point(button["x"].Float(), button["y"].Float()), button["name"].String(), help, close, button["hotkey"].Float()); } @@ -4239,8 +4239,8 @@ CSimpleJoinScreen::CSimpleJoinScreen() port->cb += std::bind(&CSimpleJoinScreen::onChange, this, _1); port->filters.add(std::bind(&CTextInput::numberFilter, _1, _2, 0, 65535)); - ok = new CButton(Point( 26, 142), "MUBCHCK.DEF", CGI->generaltexth->zelp[560], boost::bind(&CSimpleJoinScreen::enterSelectionScreen, this), SDLK_RETURN); - cancel = new CButton(Point(142, 142), "MUBCANC.DEF", CGI->generaltexth->zelp[561], boost::bind(&CGuiHandler::popIntTotally, boost::ref(GH), this), SDLK_ESCAPE); + ok = new CButton(Point( 26, 142), "MUBCHCK.DEF", CGI->generaltexth->zelp[560], std::bind(&CSimpleJoinScreen::enterSelectionScreen, this), SDLK_RETURN); + cancel = new CButton(Point(142, 142), "MUBCANC.DEF", CGI->generaltexth->zelp[561], std::bind(&CGuiHandler::popIntTotally, std::ref(GH), this), SDLK_ESCAPE); bar = new CGStatusBar(new CPicture(Rect(7, 186, 218, 18), 0)); port->setText(boost::lexical_cast(settings["server"]["port"].Float()), true); diff --git a/client/battle/CBattleInterface.cpp b/client/battle/CBattleInterface.cpp index 47f0e2823..c582cbec4 100644 --- a/client/battle/CBattleInterface.cpp +++ b/client/battle/CBattleInterface.cpp @@ -222,16 +222,16 @@ CBattleInterface::CBattleInterface(const CCreatureSet * army1, const CCreatureSe // blitAt(menu, pos.x, 556 + pos.y); //preparing buttons and console - bOptions = new CButton (Point( 3, 561), "icm003.def", CGI->generaltexth->zelp[381], boost::bind(&CBattleInterface::bOptionsf,this), SDLK_o); - bSurrender = new CButton (Point( 54, 561), "icm001.def", CGI->generaltexth->zelp[379], boost::bind(&CBattleInterface::bSurrenderf,this), SDLK_s); - bFlee = new CButton (Point(105, 561), "icm002.def", CGI->generaltexth->zelp[380], boost::bind(&CBattleInterface::bFleef,this), SDLK_r); - bAutofight = new CButton (Point(157, 561), "icm004.def", CGI->generaltexth->zelp[382], boost::bind(&CBattleInterface::bAutofightf,this), SDLK_a); - bSpell = new CButton (Point(645, 561), "icm005.def", CGI->generaltexth->zelp[385], boost::bind(&CBattleInterface::bSpellf,this), SDLK_c); - bWait = new CButton (Point(696, 561), "icm006.def", CGI->generaltexth->zelp[386], boost::bind(&CBattleInterface::bWaitf,this), SDLK_w); - bDefence = new CButton (Point(747, 561), "icm007.def", CGI->generaltexth->zelp[387], boost::bind(&CBattleInterface::bDefencef,this), SDLK_d); + bOptions = new CButton (Point( 3, 561), "icm003.def", CGI->generaltexth->zelp[381], std::bind(&CBattleInterface::bOptionsf,this), SDLK_o); + bSurrender = new CButton (Point( 54, 561), "icm001.def", CGI->generaltexth->zelp[379], std::bind(&CBattleInterface::bSurrenderf,this), SDLK_s); + bFlee = new CButton (Point(105, 561), "icm002.def", CGI->generaltexth->zelp[380], std::bind(&CBattleInterface::bFleef,this), SDLK_r); + bAutofight = new CButton (Point(157, 561), "icm004.def", CGI->generaltexth->zelp[382], std::bind(&CBattleInterface::bAutofightf,this), SDLK_a); + bSpell = new CButton (Point(645, 561), "icm005.def", CGI->generaltexth->zelp[385], std::bind(&CBattleInterface::bSpellf,this), SDLK_c); + bWait = new CButton (Point(696, 561), "icm006.def", CGI->generaltexth->zelp[386], std::bind(&CBattleInterface::bWaitf,this), SDLK_w); + bDefence = new CButton (Point(747, 561), "icm007.def", CGI->generaltexth->zelp[387], std::bind(&CBattleInterface::bDefencef,this), SDLK_d); bDefence->assignedKeys.insert(SDLK_SPACE); - bConsoleUp = new CButton (Point(624, 561), "ComSlide.def", std::make_pair("", ""), boost::bind(&CBattleInterface::bConsoleUpf,this), SDLK_UP); - bConsoleDown = new CButton (Point(624, 580), "ComSlide.def", std::make_pair("", ""), boost::bind(&CBattleInterface::bConsoleDownf,this), SDLK_DOWN); + bConsoleUp = new CButton (Point(624, 561), "ComSlide.def", std::make_pair("", ""), std::bind(&CBattleInterface::bConsoleUpf,this), SDLK_UP); + bConsoleDown = new CButton (Point(624, 580), "ComSlide.def", std::make_pair("", ""), std::bind(&CBattleInterface::bConsoleDownf,this), SDLK_DOWN); bConsoleDown->setImageOrder(2, 3, 4, 5); console = new CBattleConsole(); console->pos.x += 211; diff --git a/client/gui/CAnimation.cpp b/client/gui/CAnimation.cpp index 221160295..0ff4ca00b 100644 --- a/client/gui/CAnimation.cpp +++ b/client/gui/CAnimation.cpp @@ -1222,322 +1222,3 @@ void CAnimation::getAnimInfo() logGlobal->errorStream()<<", "<images.begin()->second.size()<<" image loaded in group "<< anim->images.begin()->first; } } -<<<<<<< HEAD:client/CAnimation.cpp - -CAnimImage::CAnimImage(std::string name, size_t Frame, size_t Group, int x, int y, ui8 Flags): - frame(Frame), - group(Group), - player(-1), - flags(Flags) -{ - pos.x += x; - pos.y += y; - anim = new CAnimation(name); - init(); -} - -CAnimImage::CAnimImage(CAnimation *Anim, size_t Frame, size_t Group, int x, int y, ui8 Flags): - anim(Anim), - frame(Frame), - group(Group), - player(-1), - flags(Flags) -{ - pos.x += x; - pos.y += y; - init(); -} - -size_t CAnimImage::size() -{ - return anim->size(group); -} - -void CAnimImage::init() -{ - anim->load(frame, group); - if (flags & CShowableAnim::BASE) - anim->load(0,group); - - IImage *img = anim->getImage(frame, group); - if (img) - { - pos.w = img->width(); - pos.h = img->height(); - } -} - -CAnimImage::~CAnimImage() -{ - anim->unload(frame, group); - if (flags & CShowableAnim::BASE) - anim->unload(0,group); - delete anim; -} - -void CAnimImage::showAll(SDL_Surface * to) -{ - IImage *img; - - if ( flags & CShowableAnim::BASE && frame != 0) - if ((img = anim->getImage(0, group))) - img->draw(to, pos.x, pos.y); - - if ((img = anim->getImage(frame, group))) - img->draw(to, pos.x, pos.y); -} - -void CAnimImage::setFrame(size_t Frame, size_t Group) -{ - if (frame == Frame && group==Group) - return; - if (anim->size(Group) > Frame) - { - anim->load(Frame, Group); - anim->unload(frame, group); - frame = Frame; - group = Group; - IImage *img = anim->getImage(frame, group); - if (img) - { - if (flags & CShowableAnim::PLAYER_COLORED) - img->playerColored(player); - pos.w = img->width(); - pos.h = img->height(); - } - } - else - logGlobal->errorStream() << "Error: accessing unavailable frame " << Group << ":" << Frame << " in CAnimation!"; -} - -void CAnimImage::playerColored(PlayerColor currPlayer) -{ - player = currPlayer; - flags |= CShowableAnim::PLAYER_COLORED; - anim->getImage(frame, group)->playerColored(player); - if (flags & CShowableAnim::BASE) - anim->getImage(0, group)->playerColored(player); -} - -CShowableAnim::CShowableAnim(int x, int y, std::string name, ui8 Flags, ui32 Delay, size_t Group): - anim(name, Flags & USE_RLE), - group(Group), - frame(0), - first(0), - frameDelay(Delay), - value(0), - flags(Flags), - xOffset(0), - yOffset(0), - alpha(255) -{ - anim.loadGroup(group); - last = anim.size(group); - - pos.w = anim.getImage(0, group)->width(); - pos.h = anim.getImage(0, group)->height(); - pos.x+= x; - pos.y+= y; -} - -CShowableAnim::~CShowableAnim() -{ - anim.unloadGroup(group); -} - -void CShowableAnim::setAlpha(ui32 alphaValue) -{ - alpha = std::min(alphaValue, 255); -} - -bool CShowableAnim::set(size_t Group, size_t from, size_t to) -{ - size_t max = anim.size(Group); - - if (to < max) - max = to; - - if (max < from || max == 0) - return false; - - anim.load(Group); - anim.unload(group); - group = Group; - frame = first = from; - last = max; - value = 0; - return true; -} - -bool CShowableAnim::set(size_t Group) -{ - if (anim.size(Group)== 0) - return false; - if (group != Group) - { - anim.loadGroup(Group); - anim.unloadGroup(group); - first = 0; - group = Group; - last = anim.size(Group); - } - frame = value = 0; - return true; -} - -void CShowableAnim::reset() -{ - value = 0; - frame = first; - - if (callback) - callback(); -} - -void CShowableAnim::clipRect(int posX, int posY, int width, int height) -{ - xOffset = posX; - yOffset = posY; - pos.w = width; - pos.h = height; -} - -void CShowableAnim::show(SDL_Surface * to) -{ - if ( flags & BASE )// && frame != first) // FIXME: results in graphical glytch in Fortress, upgraded hydra's dwelling - blitImage(first, group, to); - blitImage(frame, group, to); - - if ((flags & PLAY_ONCE) && frame + 1 == last) - return; - - if ( ++value == frameDelay ) - { - value = 0; - if ( ++frame >= last) - reset(); - } -} - -void CShowableAnim::showAll(SDL_Surface * to) -{ - if ( flags & BASE )// && frame != first) - blitImage(first, group, to); - blitImage(frame, group, to); -} - -void CShowableAnim::blitImage(size_t frame, size_t group, SDL_Surface *to) -{ - assert(to); - Rect src( xOffset, yOffset, pos.w, pos.h); - IImage * img = anim.getImage(frame, group); - if (img) - img->draw(to, pos.x-xOffset, pos.y-yOffset, &src, alpha); -} - -void CShowableAnim::rotate(bool on, bool vertical) -{ - ui8 flag = vertical? VERTICAL_FLIP:HORIZONTAL_FLIP; - if (on) - flags |= flag; - else - flags &= ~flag; -} - -CCreatureAnim::CCreatureAnim(int x, int y, std::string name, Rect picPos, ui8 flags, EAnimType type): - CShowableAnim(x,y,name,flags,4,type) -{ - xOffset = picPos.x; - yOffset = picPos.y; - if (picPos.w) - pos.w = picPos.w; - if (picPos.h) - pos.h = picPos.h; -}; - -void CCreatureAnim::loopPreview(bool warMachine) -{ - std::vector available; - - static const EAnimType creaPreviewList[] = {HOLDING, HITTED, DEFENCE, ATTACK_FRONT, CAST_FRONT}; - static const EAnimType machPreviewList[] = {HOLDING, MOVING, SHOOT_UP, SHOOT_FRONT, SHOOT_DOWN}; - auto & previewList = warMachine ? machPreviewList : creaPreviewList; - - for (auto & elem : previewList) - if (anim.size(elem)) - available.push_back(elem); - - size_t rnd = CRandomGenerator::getDefault().nextInt(available.size() * 2 - 1); - - if (rnd >= available.size()) - { - EAnimType type; - if ( anim.size(MOVING) == 0 )//no moving animation present - type = HOLDING; - else - type = MOVING; - - //display this anim for ~1 second (time is random, but it looks good) - for (size_t i=0; i< 12/anim.size(type) + 1; i++) - addLast(type); - } - else - addLast(available[rnd]); -} - -void CCreatureAnim::addLast(EAnimType newType) -{ - if (type != MOVING && newType == MOVING)//starting moving - play init sequence - { - queue.push( MOVE_START ); - } - else if (type == MOVING && newType != MOVING )//previous anim was moving - finish it - { - queue.push( MOVE_END ); - } - if (newType == TURN_L || newType == TURN_R) - queue.push(newType); - - queue.push(newType); -} - -void CCreatureAnim::reset() -{ - //if we are in the middle of rotation - set flag - if (type == TURN_L && !queue.empty() && queue.front() == TURN_L) - rotate(true); - if (type == TURN_R && !queue.empty() && queue.front() == TURN_R) - rotate(false); - - while (!queue.empty()) - { - EAnimType at = queue.front(); - queue.pop(); - if (set(at)) - return; - } - if (callback) - callback(); - while (!queue.empty()) - { - EAnimType at = queue.front(); - queue.pop(); - if (set(at)) - return; - } - set(HOLDING); -} - -void CCreatureAnim::startPreview(bool warMachine) -{ - callback = std::bind(&CCreatureAnim::loopPreview, this, warMachine); -} - -void CCreatureAnim::clearAndSet(EAnimType type) -{ - while (!queue.empty()) - queue.pop(); - set(type); -} -======= ->>>>>>> refactoring/guiClasses:client/gui/CAnimation.cpp diff --git a/client/gui/CIntObject.h b/client/gui/CIntObject.h index b0c1013f4..307e2ec7d 100644 --- a/client/gui/CIntObject.h +++ b/client/gui/CIntObject.h @@ -10,7 +10,7 @@ #pragma once -//#include +#include #include "Geometries.h" #include "../Graphics.h" diff --git a/client/widgets/AdventureMapClasses.cpp b/client/widgets/AdventureMapClasses.cpp index 28ab5677d..053eedd54 100644 --- a/client/widgets/AdventureMapClasses.cpp +++ b/client/widgets/AdventureMapClasses.cpp @@ -110,19 +110,11 @@ CList::CList(int Size, Point position, std::string btnUp, std::string btnDown, s list = new CListBox(create, destroy, Point(1,scrollUp->pos.h), Point(0, 32), size, listAmount); //assign callback only after list was created -<<<<<<< HEAD:client/AdventureMapClasses.cpp - scrollUp->callback = std::bind(&CListBox::moveToPrev, list); - scrollDown = new CAdventureMapButton(CGI->generaltexth->zelp[helpDown], std::bind(&CListBox::moveToNext, list), 0, scrollUp->pos.h + 32*size, btnDown); + scrollUp->addCallback(std::bind(&CListBox::moveToPrev, list)); + scrollDown = new CButton(Point(0, scrollUp->pos.h + 32*size), btnDown, CGI->generaltexth->zelp[helpDown], std::bind(&CListBox::moveToNext, list)); - scrollDown->callback += std::bind(&CList::update, this); - scrollUp->callback += std::bind(&CList::update, this); -======= - scrollUp->addCallback(boost::bind(&CListBox::moveToPrev, list)); - scrollDown = new CButton(Point(0, scrollUp->pos.h + 32*size), btnDown, CGI->generaltexth->zelp[helpDown], boost::bind(&CListBox::moveToNext, list)); - - scrollDown->addCallback(boost::bind(&CList::update, this)); - scrollUp->addCallback(boost::bind(&CList::update, this)); ->>>>>>> refactoring/guiClasses:client/widgets/AdventureMapClasses.cpp + scrollDown->addCallback(std::bind(&CList::update, this)); + scrollUp->addCallback(std::bind(&CList::update, this)); update(); } diff --git a/client/widgets/Buttons.cpp b/client/widgets/Buttons.cpp index 7ce7ceb99..3e5248761 100644 --- a/client/widgets/Buttons.cpp +++ b/client/widgets/Buttons.cpp @@ -657,9 +657,9 @@ CSlider::CSlider(Point position, int totalw, std::function Moved, int else right->moveBy(Point(0, totalw - right->pos.h)); - left->addCallback(boost::bind(&CSlider::moveLeft,this)); - right->addCallback(boost::bind(&CSlider::moveRight,this)); - slider->addCallback(boost::bind(&CSlider::sliderClicked,this)); + left->addCallback(std::bind(&CSlider::moveLeft,this)); + right->addCallback(std::bind(&CSlider::moveRight,this)); + slider->addCallback(std::bind(&CSlider::sliderClicked,this)); if(horizontal) { diff --git a/client/widgets/CArtifactHolder.cpp b/client/widgets/CArtifactHolder.cpp index cca81355c..1af60d50f 100644 --- a/client/widgets/CArtifactHolder.cpp +++ b/client/widgets/CArtifactHolder.cpp @@ -231,7 +231,7 @@ void CArtPlace::clickRight(tribool down, bool previousState) ourArt->artType->id, combination->id, true, - boost::bind(&CCallback::assembleArtifacts, LOCPLINT->cb.get(), ourOwner->curHero, slotID, true, combination->id), + std::bind(&CCallback::assembleArtifacts, LOCPLINT->cb.get(), ourOwner->curHero, slotID, true, combination->id), 0); if(assemblyPossibilities.size() > 2) @@ -249,7 +249,7 @@ void CArtPlace::clickRight(tribool down, bool previousState) ourArt->artType->id, 0, false, - boost::bind(&CCallback::assembleArtifacts, LOCPLINT->cb.get(), ourOwner->curHero, slotID, false, ArtifactID()), + std::bind(&CCallback::assembleArtifacts, LOCPLINT->cb.get(), ourOwner->curHero, slotID, false, ArtifactID()), 0); return; } @@ -685,8 +685,8 @@ CArtifactsOfHero::CArtifactsOfHero(std::vector ArtWorn, std::vector eraseSlotData(backpack[s], ArtifactPosition(GameConstants::BACKPACK_START + s)); } - leftArtRoll->addCallback(boost::bind(&CArtifactsOfHero::scrollBackpack,this,-1)); - rightArtRoll->addCallback(boost::bind(&CArtifactsOfHero::scrollBackpack,this,+1)); + leftArtRoll->addCallback(std::bind(&CArtifactsOfHero::scrollBackpack,this,-1)); + rightArtRoll->addCallback(std::bind(&CArtifactsOfHero::scrollBackpack,this,+1)); } CArtifactsOfHero::CArtifactsOfHero(const Point& position, bool createCommonPart /*= false*/) diff --git a/client/widgets/CComponent.cpp b/client/widgets/CComponent.cpp index 9a64de2c6..24febce0f 100644 --- a/client/widgets/CComponent.cpp +++ b/client/widgets/CComponent.cpp @@ -446,7 +446,7 @@ CComponentBox::CComponentBox(std::vector _components, Re int key = SDLK_1; for(auto & comp : _components) { - comp->onSelect = boost::bind(&CComponentBox::selectionChanged, this, comp); + comp->onSelect = std::bind(&CComponentBox::selectionChanged, this, comp); comp->assignedKeys.insert(key++); } selectionChanged(_components.front()); diff --git a/client/widgets/CGarrisonInt.cpp b/client/widgets/CGarrisonInt.cpp index e4ddb97a8..51ef8af9a 100644 --- a/client/widgets/CGarrisonInt.cpp +++ b/client/widgets/CGarrisonInt.cpp @@ -201,7 +201,7 @@ void CGarrisonSlot::clickLeft(tribool down, bool previousState) int countLeft = owner->getSelection()->myStack ? owner->getSelection()->myStack->count : 0; int countRight = myStack ? myStack->count : 0; - GH.pushInt(new CSplitWindow(owner->getSelection()->creature, boost::bind(&CGarrisonInt::splitStacks, owner, _1, _2), + GH.pushInt(new CSplitWindow(owner->getSelection()->creature, std::bind(&CGarrisonInt::splitStacks, owner, _1, _2), minLeft, minRight, countLeft, countRight)); refr = true; } diff --git a/client/widgets/Images.cpp b/client/widgets/Images.cpp index 8902b361f..7ba42a1f4 100644 --- a/client/widgets/Images.cpp +++ b/client/widgets/Images.cpp @@ -522,7 +522,7 @@ void CCreatureAnim::reset() void CCreatureAnim::startPreview(bool warMachine) { - callback = boost::bind(&CCreatureAnim::loopPreview, this, warMachine); + callback = std::bind(&CCreatureAnim::loopPreview, this, warMachine); } void CCreatureAnim::clearAndSet(EAnimType type) diff --git a/client/widgets/ObjectLists.cpp b/client/widgets/ObjectLists.cpp index 545f47d21..5c65f0006 100644 --- a/client/widgets/ObjectLists.cpp +++ b/client/widgets/ObjectLists.cpp @@ -96,7 +96,7 @@ CListBox::CListBox(CreateFunc create, DestroyFunc destroy, Point Pos, Point Item if (Slider & 1) { OBJ_CONSTRUCTION_CAPTURING_ALL; - slider = new CSlider(SliderPos.topLeft(), SliderPos.w, boost::bind(&CListBox::moveToPos, this, _1), + slider = new CSlider(SliderPos.topLeft(), SliderPos.w, std::bind(&CListBox::moveToPos, this, _1), VisibleSize, TotalSize, InitialPos, Slider & 2, Slider & 4 ? CSlider::BLUE : CSlider::BROWN); } reset(); diff --git a/client/widgets/TextControls.cpp b/client/widgets/TextControls.cpp index 51df1e5b2..e229e23e4 100644 --- a/client/widgets/TextControls.cpp +++ b/client/widgets/TextControls.cpp @@ -295,7 +295,7 @@ void CTextBox::setText(const std::string &text) label->setText(text); OBJ_CONSTRUCTION_CAPTURING_ALL; - slider = new CSlider(Point(pos.w - 32, 0), pos.h, boost::bind(&CTextBox::sliderMoved, this, _1), + slider = new CSlider(Point(pos.w - 32, 0), pos.h, std::bind(&CTextBox::sliderMoved, this, _1), label->pos.h, label->textSize.y, 0, false, CSlider::EStyle(sliderStyle)); slider->setScrollStep(graphics->fonts[label->font]->getLineHeight()); } diff --git a/client/widgets/TextControls.h b/client/widgets/TextControls.h index 7707352f6..0039a0688 100644 --- a/client/widgets/TextControls.h +++ b/client/widgets/TextControls.h @@ -184,6 +184,6 @@ public: //Filter that will block all characters not allowed in filenames static void filenameFilter(std::string &text, const std::string & oldText); //Filter that will allow only input of numbers in range min-max (min-max are allowed) - //min-max should be set via something like boost::bind + //min-max should be set via something like std::bind static void numberFilter(std::string &text, const std::string & oldText, int minValue, int maxValue); }; diff --git a/client/windows/CAdvmapInterface.cpp b/client/windows/CAdvmapInterface.cpp index a8e00e0dc..46b32a183 100644 --- a/client/windows/CAdvmapInterface.cpp +++ b/client/windows/CAdvmapInterface.cpp @@ -370,39 +370,6 @@ void CResDataBar::showAll(SDL_Surface * to) CAdvMapInt::CAdvMapInt(): minimap(Rect(ADVOPT.minimapX, ADVOPT.minimapY, ADVOPT.minimapW, ADVOPT.minimapH)), statusbar(ADVOPT.statusbarX,ADVOPT.statusbarY,ADVOPT.statusbarG), -<<<<<<< HEAD:client/CAdvmapInterface.cpp -kingOverview(CGI->generaltexth->zelp[293].first,CGI->generaltexth->zelp[293].second, - std::bind(&CAdvMapInt::fshowOverview,this),&ADVOPT.kingOverview, SDLK_k), - -underground(CGI->generaltexth->zelp[294].first,CGI->generaltexth->zelp[294].second, - std::bind(&CAdvMapInt::fswitchLevel,this),&ADVOPT.underground, SDLK_u), - -questlog(CGI->generaltexth->zelp[295].first,CGI->generaltexth->zelp[295].second, - std::bind(&CAdvMapInt::fshowQuestlog,this),&ADVOPT.questlog, SDLK_q), - -sleepWake(CGI->generaltexth->zelp[296].first,CGI->generaltexth->zelp[296].second, - std::bind(&CAdvMapInt::fsleepWake,this), &ADVOPT.sleepWake, SDLK_w), - -moveHero(CGI->generaltexth->zelp[297].first,CGI->generaltexth->zelp[297].second, - std::bind(&CAdvMapInt::fmoveHero,this), &ADVOPT.moveHero, SDLK_m), - -spellbook(CGI->generaltexth->zelp[298].first,CGI->generaltexth->zelp[298].second, - std::bind(&CAdvMapInt::fshowSpellbok,this), &ADVOPT.spellbook, SDLK_c), - -advOptions(CGI->generaltexth->zelp[299].first,CGI->generaltexth->zelp[299].second, - std::bind(&CAdvMapInt::fadventureOPtions,this), &ADVOPT.advOptions, SDLK_a), - -sysOptions(CGI->generaltexth->zelp[300].first,CGI->generaltexth->zelp[300].second, - std::bind(&CAdvMapInt::fsystemOptions,this), &ADVOPT.sysOptions, SDLK_o), - -nextHero(CGI->generaltexth->zelp[301].first,CGI->generaltexth->zelp[301].second, - std::bind(&CAdvMapInt::fnextHero,this), &ADVOPT.nextHero, SDLK_h), - -endTurn(CGI->generaltexth->zelp[302].first,CGI->generaltexth->zelp[302].second, - std::bind(&CAdvMapInt::fendTurn,this), &ADVOPT.endTurn, SDLK_e), -======= ->>>>>>> refactoring/guiClasses:client/windows/CAdvmapInterface.cpp - heroList(ADVOPT.hlistSize, Point(ADVOPT.hlistX, ADVOPT.hlistY), ADVOPT.hlistAU, ADVOPT.hlistAD), townList(ADVOPT.tlistSize, Point(ADVOPT.tlistX, ADVOPT.tlistY), ADVOPT.tlistAU, ADVOPT.tlistAD), infoBar(Rect(ADVOPT.infoboxX, ADVOPT.infoboxY, 192, 192) ) @@ -439,16 +406,16 @@ infoBar(Rect(ADVOPT.infoboxX, ADVOPT.infoboxY, 192, 192) ) return button; }; - kingOverview = makeButton(293, boost::bind(&CAdvMapInt::fshowOverview,this), ADVOPT.kingOverview, SDLK_k); - underground = makeButton(294, boost::bind(&CAdvMapInt::fswitchLevel,this), ADVOPT.underground, SDLK_u); - questlog = makeButton(295, boost::bind(&CAdvMapInt::fshowQuestlog,this), ADVOPT.questlog, SDLK_q); - sleepWake = makeButton(296, boost::bind(&CAdvMapInt::fsleepWake,this), ADVOPT.sleepWake, SDLK_w); - moveHero = makeButton(297, boost::bind(&CAdvMapInt::fmoveHero,this), ADVOPT.moveHero, SDLK_m); - spellbook = makeButton(298, boost::bind(&CAdvMapInt::fshowSpellbok,this), ADVOPT.spellbook, SDLK_c); - advOptions = makeButton(299, boost::bind(&CAdvMapInt::fadventureOPtions,this), ADVOPT.advOptions, SDLK_a); - sysOptions = makeButton(300, boost::bind(&CAdvMapInt::fsystemOptions,this), ADVOPT.sysOptions, SDLK_o); - nextHero = makeButton(301, boost::bind(&CAdvMapInt::fnextHero,this), ADVOPT.nextHero, SDLK_h); - endTurn = makeButton(302, boost::bind(&CAdvMapInt::fendTurn,this), ADVOPT.endTurn, SDLK_e); + kingOverview = makeButton(293, std::bind(&CAdvMapInt::fshowOverview,this), ADVOPT.kingOverview, SDLK_k); + underground = makeButton(294, std::bind(&CAdvMapInt::fswitchLevel,this), ADVOPT.underground, SDLK_u); + questlog = makeButton(295, std::bind(&CAdvMapInt::fshowQuestlog,this), ADVOPT.questlog, SDLK_q); + sleepWake = makeButton(296, std::bind(&CAdvMapInt::fsleepWake,this), ADVOPT.sleepWake, SDLK_w); + moveHero = makeButton(297, std::bind(&CAdvMapInt::fmoveHero,this), ADVOPT.moveHero, SDLK_m); + spellbook = makeButton(298, std::bind(&CAdvMapInt::fshowSpellbok,this), ADVOPT.spellbook, SDLK_c); + advOptions = makeButton(299, std::bind(&CAdvMapInt::fadventureOPtions,this), ADVOPT.advOptions, SDLK_a); + sysOptions = makeButton(300, std::bind(&CAdvMapInt::fsystemOptions,this), ADVOPT.sysOptions, SDLK_o); + nextHero = makeButton(301, std::bind(&CAdvMapInt::fnextHero,this), ADVOPT.nextHero, SDLK_h); + endTurn = makeButton(302, std::bind(&CAdvMapInt::fendTurn,this), ADVOPT.endTurn, SDLK_e); setPlayer(LOCPLINT->playerID); underground->block(!CGI->mh->map->twoLevel); @@ -1557,36 +1524,20 @@ CAdventureOptions::CAdventureOptions(): { OBJ_CONSTRUCTION_CAPTURING_ALL; -<<<<<<< HEAD:client/CAdvmapInterface.cpp - exit = new CAdventureMapButton("","",std::bind(&CAdventureOptions::close, this), 204, 313, "IOK6432.DEF",SDLK_RETURN); - exit->assignedKeys.insert(SDLK_ESCAPE); - - scenInfo = new CAdventureMapButton("","", std::bind(&CAdventureOptions::close, this), 24, 198, "ADVINFO.DEF",SDLK_i); - scenInfo->callback += CAdventureOptions::showScenarioInfo; - //viewWorld = new CAdventureMapButton("","",std::bind(&CGuiHandler::popIntTotally, &GH, this), 204, 313, "IOK6432.DEF",SDLK_RETURN); - - puzzle = new CAdventureMapButton("","", std::bind(&CAdventureOptions::close, this), 24, 81, "ADVPUZ.DEF"); - puzzle->callback += std::bind(&CPlayerInterface::showPuzzleMap, LOCPLINT); - - dig = new CAdventureMapButton("","", std::bind(&CAdventureOptions::close, this), 24, 139, "ADVDIG.DEF"); - if(const CGHeroInstance *h = adventureInt->curHero()) - dig->callback += std::bind(&CPlayerInterface::tryDiggging, LOCPLINT, h); -======= - exit = new CButton(Point(204, 313), "IOK6432.DEF", CButton::tooltip(), boost::bind(&CAdventureOptions::close, this), SDLK_RETURN); + exit = new CButton(Point(204, 313), "IOK6432.DEF", CButton::tooltip(), std::bind(&CAdventureOptions::close, this), SDLK_RETURN); exit->assignedKeys.insert(SDLK_ESCAPE); scenInfo = new CButton(Point(24, 198), "ADVINFO.DEF", CButton::tooltip(), [&]{ close(); }, SDLK_i); scenInfo->addCallback(CAdventureOptions::showScenarioInfo); - //viewWorld = new CButton("","",boost::bind(&CGuiHandler::popIntTotally, &GH, this), 204, 313, "IOK6432.DEF",SDLK_RETURN); + //viewWorld = new CButton("","",std::bind(&CGuiHandler::popIntTotally, &GH, this), 204, 313, "IOK6432.DEF",SDLK_RETURN); puzzle = new CButton(Point(24, 81), "ADVPUZ.DEF", CButton::tooltip(), [&]{ close(); }, SDLK_p); - puzzle->addCallback(boost::bind(&CPlayerInterface::showPuzzleMap, LOCPLINT)); + puzzle->addCallback(std::bind(&CPlayerInterface::showPuzzleMap, LOCPLINT)); dig = new CButton(Point(24, 139), "ADVDIG.DEF", CButton::tooltip(), [&]{ close(); }, SDLK_d); if(const CGHeroInstance *h = adventureInt->curHero()) - dig->addCallback(boost::bind(&CPlayerInterface::tryDiggging, LOCPLINT, h)); ->>>>>>> refactoring/guiClasses:client/windows/CAdvmapInterface.cpp + dig->addCallback(std::bind(&CPlayerInterface::tryDiggging, LOCPLINT, h)); else dig->block(true); } diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index 54199f195..38702805a 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -843,11 +843,7 @@ void CCastleBuildings::enterTownHall() else { LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[673]); -<<<<<<< HEAD:client/CCastleInterface.cpp - (dynamic_cast(GH.topInt()))->buttons[0]->callback += std::bind(&CCastleBuildings::openTownHall, this); -======= - dynamic_cast(GH.topInt())->buttons[0]->addCallback(boost::bind(&CCastleBuildings::openTownHall, this)); ->>>>>>> refactoring/guiClasses:client/windows/CCastleInterface.cpp + dynamic_cast(GH.topInt())->buttons[0]->addCallback(std::bind(&CCastleBuildings::openTownHall, this)); } } else @@ -892,21 +888,12 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst income = new CLabel(195, 443, FONT_SMALL, CENTER); icon = new CAnimImage("ITPT", 0, 0, 15, 387); -<<<<<<< HEAD:client/CCastleInterface.cpp - exit = new CAdventureMapButton(CGI->generaltexth->tcommands[8], "", std::bind(&CCastleInterface::close,this), 744, 544, "TSBTNS", SDLK_RETURN); -======= exit = new CButton(Point(744, 544), "TSBTNS", CButton::tooltip(CGI->generaltexth->tcommands[8]), [&]{close();}, SDLK_RETURN); ->>>>>>> refactoring/guiClasses:client/windows/CCastleInterface.cpp exit->assignedKeys.insert(SDLK_ESCAPE); exit->setImageOrder(4, 5, 6, 7); -<<<<<<< HEAD:client/CCastleInterface.cpp - split = new CAdventureMapButton(CGI->generaltexth->tcommands[3], "", std::bind(&CGarrisonInt::splitClick,garr), 744, 382, "TSBTNS.DEF"); - split->callback += std::bind(&HeroSlots::splitClicked, heroes); -======= split = new CButton(Point(744, 382), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), [&]{garr->splitClick();}); - split->addCallback(boost::bind(&HeroSlots::splitClicked, heroes)); ->>>>>>> refactoring/guiClasses:client/windows/CCastleInterface.cpp + split->addCallback(std::bind(&HeroSlots::splitClicked, heroes)); garr->addSplitBtn(split); Rect barRect(9, 182, 732, 18); @@ -1324,12 +1311,7 @@ CHallInterface::CHallInterface(const CGTownInstance *Town): statusBar = new CGStatusBar(new CPicture(*background, barRect, 5, 556, false)); title = new CLabel(399, 12, FONT_MEDIUM, CENTER, Colors::WHITE, town->town->buildings.at(BuildingID(town->hallLevel()+BuildingID::VILLAGE_HALL))->Name()); -<<<<<<< HEAD:client/CCastleInterface.cpp - exit = new CAdventureMapButton(CGI->generaltexth->hcommands[8], "", - std::bind(&CHallInterface::close,this), 748, 556, "TPMAGE1.DEF", SDLK_RETURN); -======= exit = new CButton(Point(748, 556), "TPMAGE1.DEF", CButton::tooltip(CGI->generaltexth->hcommands[8]), [&]{close();}, SDLK_RETURN); ->>>>>>> refactoring/guiClasses:client/windows/CCastleInterface.cpp exit->assignedKeys.insert(SDLK_ESCAPE); auto & boxList = town->town->clientInfo.hallSlots; @@ -1427,23 +1409,13 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin if(!rightClick) { //normal window -<<<<<<< HEAD:client/CCastleInterface.cpp - buy = new CAdventureMapButton(boost::str(boost::format(CGI->generaltexth->allTexts[595]) % building->Name()), - "", std::bind(&CBuildWindow::buyFunc,this), 45, 446,"IBUY30", SDLK_RETURN); -======= std::string tooltipYes = boost::str(boost::format(CGI->generaltexth->allTexts[595]) % building->Name()); std::string tooltipNo = boost::str(boost::format(CGI->generaltexth->allTexts[596]) % building->Name()); buy = new CButton(Point(45, 446), "IBUY30", CButton::tooltip(tooltipYes), [&]{ buyFunc(); }, SDLK_RETURN); ->>>>>>> refactoring/guiClasses:client/windows/CCastleInterface.cpp buy->borderColor = Colors::METALLIC_GOLD; -<<<<<<< HEAD:client/CCastleInterface.cpp - cancel = new CAdventureMapButton(boost::str(boost::format(CGI->generaltexth->allTexts[596]) % building->Name()), - "", std::bind(&CBuildWindow::close,this), 290, 445, "ICANCEL", SDLK_ESCAPE); -======= cancel = new CButton(Point(290, 445), "ICANCEL", CButton::tooltip(tooltipNo), [&] { close();}, SDLK_ESCAPE); ->>>>>>> refactoring/guiClasses:client/windows/CCastleInterface.cpp cancel->borderColor = Colors::METALLIC_GOLD; buy->block(state!=7 || LOCPLINT->playerID != town->tempOwner); } @@ -1474,11 +1446,7 @@ CFortScreen::CFortScreen(const CGTownInstance * town): title = new CLabel(400, 12, FONT_BIG, CENTER, Colors::WHITE, fortBuilding->Name()); std::string text = boost::str(boost::format(CGI->generaltexth->fcommands[6]) % fortBuilding->Name()); -<<<<<<< HEAD:client/CCastleInterface.cpp - exit = new CAdventureMapButton(text, "", std::bind(&CFortScreen::close,this) ,748, 556, "TPMAGE1", SDLK_RETURN); -======= exit = new CButton(Point(748, 556), "TPMAGE1", CButton::tooltip(text), [&]{ close(); }, SDLK_RETURN); ->>>>>>> refactoring/guiClasses:client/windows/CCastleInterface.cpp exit->assignedKeys.insert(SDLK_ESCAPE); std::vector positions; @@ -1687,11 +1655,7 @@ CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner,std::string imagem) Rect barRect(7, 556, 737, 18); statusBar = new CGStatusBar(new CPicture(*background, barRect, 7, 556, false)); -<<<<<<< HEAD:client/CCastleInterface.cpp - exit = new CAdventureMapButton(CGI->generaltexth->allTexts[593],"",std::bind(&CMageGuildScreen::close,this), 748, 556,"TPMAGE1.DEF",SDLK_RETURN); -======= exit = new CButton(Point(748, 556), "TPMAGE1.DEF", CButton::tooltip(CGI->generaltexth->allTexts[593]), [&]{ close(); }, SDLK_RETURN); ->>>>>>> refactoring/guiClasses:client/windows/CCastleInterface.cpp exit->assignedKeys.insert(SDLK_ESCAPE); std::vector > positions; @@ -1768,17 +1732,10 @@ CBlacksmithDialog::CBlacksmithDialog(bool possible, CreatureID creMachineID, Art boost::lexical_cast(CGI->arth->artifacts[aid]->price)); std::string text = boost::str(boost::format(CGI->generaltexth->allTexts[595]) % creature->nameSing); -<<<<<<< HEAD:client/CCastleInterface.cpp - buy = new CAdventureMapButton(text,"",std::bind(&CBlacksmithDialog::close, this), 42, 312,"IBUY30.DEF",SDLK_RETURN); - - text = boost::str(boost::format(CGI->generaltexth->allTexts[596]) % creature->nameSing); - cancel = new CAdventureMapButton(text,"",std::bind(&CBlacksmithDialog::close, this), 224, 312,"ICANCEL.DEF",SDLK_ESCAPE); -======= buy = new CButton(Point(42, 312), "IBUY30.DEF", CButton::tooltip(text), [&]{ close(); }, SDLK_RETURN); text = boost::str(boost::format(CGI->generaltexth->allTexts[596]) % creature->nameSing); cancel = new CButton(Point(224, 312), "ICANCEL.DEF", CButton::tooltip(text), [&]{ close(); }, SDLK_ESCAPE); ->>>>>>> refactoring/guiClasses:client/windows/CCastleInterface.cpp if(possible) buy->addCallback([=]{ LOCPLINT->cb->buyArtifact(LOCPLINT->cb->getHero(hid),aid); }); diff --git a/client/windows/CHeroWindow.cpp b/client/windows/CHeroWindow.cpp index cc25ed9aa..ebcb107cc 100644 --- a/client/windows/CHeroWindow.cpp +++ b/client/windows/CHeroWindow.cpp @@ -106,17 +106,10 @@ CHeroWindow::CHeroWindow(const CGHeroInstance *hero): //artifs = new CArtifactsOfHero(pos.topLeft(), true); ourBar = new CGStatusBar(7, 559, "ADROLLVR.bmp", 660); // new CStatusBar(pos.x+72, pos.y+567, "ADROLLVR.bmp", 660); -<<<<<<< HEAD:client/CHeroWindow.cpp - quitButton = new CAdventureMapButton(CGI->generaltexth->heroscrn[17], std::string(),std::bind(&CHeroWindow::close,this), 609, 516, "hsbtns.def", SDLK_RETURN); - quitButton->assignedKeys.insert(SDLK_ESCAPE); - dismissButton = new CAdventureMapButton(std::string(), CGI->generaltexth->heroscrn[28], std::bind(&CHeroWindow::dismissCurrent,this), 454, 429, "hsbtns2.def", SDLK_d); - questlogButton = new CAdventureMapButton(CGI->generaltexth->heroscrn[0], std::string(), std::bind(&CHeroWindow::questlog,this), 314, 429, "hsbtns4.def", SDLK_q); -======= quitButton = new CButton(Point(609, 516), "hsbtns.def", CButton::tooltip(heroscrn[17]), [&]{ close(); }, SDLK_RETURN); quitButton->assignedKeys.insert(SDLK_ESCAPE); dismissButton = new CButton(Point(454, 429), "hsbtns2.def", CButton::tooltip(heroscrn[28]), [&]{ dismissCurrent(); }, SDLK_d); questlogButton = new CButton(Point(314, 429), "hsbtns4.def", CButton::tooltip(heroscrn[0]), [&]{ questlog(); }, SDLK_q); ->>>>>>> refactoring/guiClasses:client/windows/CHeroWindow.cpp formations = new CToggleGroup(0); formations->addToggle(0, new CToggleButton(Point(481, 483), "hsbtns6.def", std::make_pair(heroscrn[23], heroscrn[29]), 0, SDLK_t)); @@ -124,12 +117,8 @@ CHeroWindow::CHeroWindow(const CGHeroInstance *hero): if (hero->commander) { -<<<<<<< HEAD:client/CHeroWindow.cpp - commanderButton = new CAdventureMapButton ("Commander", "Commander info", std::bind(&CHeroWindow::commanderWindow, this), 317, 18, "chftke.def", SDLK_c, nullptr, false); -======= auto texts = CGI->generaltexth->localizedTexts["heroWindow"]["openCommander"]; commanderButton = new CButton (Point(317, 18), "buttons/commander", CButton::tooltip(texts), [&]{ commanderWindow(); }, SDLK_c); ->>>>>>> refactoring/guiClasses:client/windows/CHeroWindow.cpp } //right list of heroes @@ -223,13 +212,7 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded /*= fals boost::algorithm::replace_first(helpBox, "%s", CGI->generaltexth->allTexts[43]); garr = new CGarrisonInt(15, 485, 8, Point(), background->bg, Point(15,485), curHero); -<<<<<<< HEAD:client/CHeroWindow.cpp - auto split = new CAdventureMapButton(CGI->generaltexth->allTexts[256], CGI->generaltexth->heroscrn[32], - std::bind(&CGarrisonInt::splitClick,garr), 539, 519, "hsbtns9.def", false, nullptr, false); //deleted by garrison destructor - boost::algorithm::replace_first(split->hoverTexts[0],"%s",CGI->generaltexth->allTexts[43]); -======= auto split = new CButton(Point(539, 519), "hsbtns9.def", CButton::tooltip(CGI->generaltexth->allTexts[256], helpBox), [&]{ garr->splitClick(); }); ->>>>>>> refactoring/guiClasses:client/windows/CHeroWindow.cpp garr->addSplitBtn(split); } @@ -301,14 +284,8 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded /*= fals } //setting formations -<<<<<<< HEAD:client/CHeroWindow.cpp - formations->onChange = 0; - formations->select(curHero->formation,true); - formations->onChange = std::bind(&CCallback::setFormation, LOCPLINT->cb.get(), curHero, _1); -======= formations->setSelected(curHero->formation); formations->addCallback([&] (int value) { LOCPLINT->cb->setFormation(curHero, value); }); ->>>>>>> refactoring/guiClasses:client/windows/CHeroWindow.cpp morale->set(&heroWArt); luck->set(&heroWArt); diff --git a/client/windows/CKingdomInterface.cpp b/client/windows/CKingdomInterface.cpp index bc7ec695a..c7859e26b 100644 --- a/client/windows/CKingdomInterface.cpp +++ b/client/windows/CKingdomInterface.cpp @@ -608,47 +608,19 @@ void CKingdomInterface::generateButtons() ui32 footerPos = conf.go()->ac.overviewSize * 116; //Main control buttons -<<<<<<< HEAD:client/CKingdomInterface.cpp - btnHeroes = new CAdventureMapButton (CGI->generaltexth->overview[11], CGI->generaltexth->overview[6], - std::bind(&CKingdomInterface::activateTab, this, 0),748,28+footerPos,"OVBUTN1.DEF", SDLK_h); - btnHeroes->block(true); - - btnTowns = new CAdventureMapButton (CGI->generaltexth->overview[12], CGI->generaltexth->overview[7], - std::bind(&CKingdomInterface::activateTab, this, 1),748,64+footerPos,"OVBUTN6.DEF", SDLK_t); - - btnExit = new CAdventureMapButton (CGI->generaltexth->allTexts[600],"", - std::bind(&CKingdomInterface::close, this),748,99+footerPos,"OVBUTN1.DEF", SDLK_RETURN); -======= btnHeroes = new CButton (Point(748, 28+footerPos), "OVBUTN1.DEF", CButton::tooltip(CGI->generaltexth->overview[11], CGI->generaltexth->overview[6]), - boost::bind(&CKingdomInterface::activateTab, this, 0), SDLK_h); + std::bind(&CKingdomInterface::activateTab, this, 0), SDLK_h); btnHeroes->block(true); btnTowns = new CButton (Point(748, 64+footerPos), "OVBUTN6.DEF", CButton::tooltip(CGI->generaltexth->overview[12], CGI->generaltexth->overview[7]), - boost::bind(&CKingdomInterface::activateTab, this, 1), SDLK_t); + std::bind(&CKingdomInterface::activateTab, this, 1), SDLK_t); btnExit = new CButton (Point(748,99+footerPos), "OVBUTN1.DEF", CButton::tooltip(CGI->generaltexth->allTexts[600]), - boost::bind(&CKingdomInterface::close, this), SDLK_RETURN); ->>>>>>> refactoring/guiClasses:client/windows/CKingdomInterface.cpp + std::bind(&CKingdomInterface::close, this), SDLK_RETURN); btnExit->assignedKeys.insert(SDLK_ESCAPE); btnExit->setImageOrder(3, 4, 5, 6); //Object list control buttons -<<<<<<< HEAD:client/CKingdomInterface.cpp - dwellTop = new CAdventureMapButton ("", "", std::bind(&CListBox::moveToPos, dwellingsList, 0), - 733, 4, "OVBUTN4.DEF"); - - dwellBottom = new CAdventureMapButton ("", "", std::bind(&CListBox::moveToPos, dwellingsList, -1), - 733, footerPos+2, "OVBUTN4.DEF"); - dwellBottom->setOffset(2); - - dwellUp = new CAdventureMapButton ("", "", std::bind(&CListBox::moveToPrev, dwellingsList), - 733, 24, "OVBUTN4.DEF"); - dwellUp->setOffset(4); - - dwellDown = new CAdventureMapButton ("", "", std::bind(&CListBox::moveToNext, dwellingsList), - 733, footerPos-18, "OVBUTN4.DEF"); - dwellDown->setOffset(6); -======= dwellTop = new CButton (Point(733, 4), "OVBUTN4.DEF", CButton::tooltip(), [&]{ dwellingsList->moveToPos(0);}); dwellBottom = new CButton (Point(733, footerPos+2), "OVBUTN4.DEF", CButton::tooltip(), [&]{ dwellingsList->moveToPos(-1); }); @@ -659,7 +631,6 @@ void CKingdomInterface::generateButtons() dwellDown = new CButton (Point(733, footerPos-18), "OVBUTN4.DEF", CButton::tooltip(), [&]{ dwellingsList->moveToNext(); }); dwellDown->setImageOrder(6, 7, 8, 9); ->>>>>>> refactoring/guiClasses:client/windows/CKingdomInterface.cpp } void CKingdomInterface::activateTab(size_t which) @@ -931,15 +902,9 @@ CHeroItem::CHeroItem(const CGHeroInstance* Hero, CArtifactsOfHero::SCommonPart * button->addTextOverlay(CGI->generaltexth->allTexts[stringID[it]], FONT_SMALL, Colors::YELLOW); artButtons->addToggle(it, button); } -<<<<<<< HEAD:client/CKingdomInterface.cpp - artButtons->onChange += std::bind(&CTabbedInt::setActive, artsTabs, _1); - artButtons->onChange += std::bind(&CHeroItem::onArtChange, this, _1); - artButtons->select(0,0); -======= - artButtons->addCallback(boost::bind(&CTabbedInt::setActive, artsTabs, _1)); - artButtons->addCallback(boost::bind(&CHeroItem::onArtChange, this, _1)); + artButtons->addCallback(std::bind(&CTabbedInt::setActive, artsTabs, _1)); + artButtons->addCallback(std::bind(&CHeroItem::onArtChange, this, _1)); artButtons->setSelected(0); ->>>>>>> refactoring/guiClasses:client/windows/CKingdomInterface.cpp garr = new CGarrisonInt(6, 78, 4, Point(), nullptr, Point(), hero, nullptr, true, true); diff --git a/client/windows/CQuestLog.cpp b/client/windows/CQuestLog.cpp index aa817c010..ea4003102 100644 --- a/client/windows/CQuestLog.cpp +++ b/client/windows/CQuestLog.cpp @@ -127,21 +127,12 @@ CQuestLog::CQuestLog (const std::vector & Quests) : void CQuestLog::init() { -<<<<<<< HEAD:client/CQuestLog.cpp - minimap = new CQuestMinimap (Rect (47, 33, 144, 144)); - description = new CTextBox ("", Rect(245, 33, 350, 355), 1, FONT_MEDIUM, TOPLEFT, Colors::WHITE); - ok = new CAdventureMapButton("",CGI->generaltexth->zelp[445].second, std::bind(&CQuestLog::close,this), 547, 401, "IOKAY.DEF", SDLK_RETURN); - - if (quests.size() > QUEST_COUNT) - slider = new CSlider(203, 199, 230, std::bind (&CQuestLog::sliderMoved, this, _1), QUEST_COUNT, quests.size(), false, 0); -======= minimap = new CQuestMinimap (Rect (33, 18, 144, 144)); description = new CTextBox ("", Rect(221, 18, 350, 355), 1, FONT_MEDIUM, TOPLEFT, Colors::WHITE); ok = new CButton(Point(533, 386), "IOKAY.DEF", CGI->generaltexth->zelp[445], boost::bind(&CQuestLog::close,this), SDLK_RETURN); if (quests.size() > QUEST_COUNT) - slider = new CSlider(Point(189, 184), 230, boost::bind (&CQuestLog::sliderMoved, this, _1), QUEST_COUNT, quests.size(), false, CSlider::BROWN); ->>>>>>> refactoring/guiClasses:client/windows/CQuestLog.cpp + slider = new CSlider(Point(189, 184), 230, std::bind (&CQuestLog::sliderMoved, this, _1), QUEST_COUNT, quests.size(), false, CSlider::BROWN); for (int i = 0; i < quests.size(); ++i) { @@ -149,13 +140,8 @@ void CQuestLog::init() quests[i].quest->getRolloverText (text, false); if (quests[i].obj) text.addReplacement (quests[i].obj->getObjectName()); //get name of the object -<<<<<<< HEAD:client/CQuestLog.cpp - CQuestLabel * label = new CQuestLabel (Rect(28, 199 + i * 24, 172,30), FONT_SMALL, TOPLEFT, Colors::WHITE, text.toString()); - label->callback = std::bind(&CQuestLog::selectQuest, this, i); -======= CQuestLabel * label = new CQuestLabel (Rect(14, 184 + i * 24, 172,30), FONT_SMALL, TOPLEFT, Colors::WHITE, text.toString()); label->callback = boost::bind(&CQuestLog::selectQuest, this, i); ->>>>>>> refactoring/guiClasses:client/windows/CQuestLog.cpp labels.push_back(label); } diff --git a/client/windows/CTradeWindow.cpp b/client/windows/CTradeWindow.cpp index f7c7b69ec..c4c98af07 100644 --- a/client/windows/CTradeWindow.cpp +++ b/client/windows/CTradeWindow.cpp @@ -394,7 +394,7 @@ void CTradeWindow::initItems(bool Left) artSets.push_back(arts); if(mode == EMarketMode::ARTIFACT_RESOURCE) - arts->highlightModeCallback = boost::bind(&CTradeWindow::artifactSelected, this, _1); + arts->highlightModeCallback = std::bind(&CTradeWindow::artifactSelected, this, _1); return; } @@ -702,7 +702,7 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan if(sliderNeeded) { - slider = new CSlider(Point(231, 490),137, boost::bind(&CMarketplaceWindow::sliderMoved,this,_1),0,0); + slider = new CSlider(Point(231, 490),137, std::bind(&CMarketplaceWindow::sliderMoved,this,_1),0,0); max = new CButton(Point(229, 520), "IRCBTNS.DEF", CGI->generaltexth->zelp[596], [&] { setMax(); }); max->block(true); } @@ -1108,11 +1108,11 @@ CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*= //To sacrifice creatures, move them from your army on to the Altar and click Sacrifice new CTextBox(CGI->generaltexth->allTexts[480], Rect(320, 56, 256, 40), 0, FONT_SMALL, CENTER, Colors::YELLOW); - slider = new CSlider(Point(231,481),137,boost::bind(&CAltarWindow::sliderMoved,this,_1),0,0); - max = new CButton(Point(147, 520), "IRCBTNS.DEF", CGI->generaltexth->zelp[578], boost::bind(&CSlider::moveToMax, slider)); + slider = new CSlider(Point(231,481),137,std::bind(&CAltarWindow::sliderMoved,this,_1),0,0); + max = new CButton(Point(147, 520), "IRCBTNS.DEF", CGI->generaltexth->zelp[578], std::bind(&CSlider::moveToMax, slider)); sacrificedUnits.resize(GameConstants::ARMY_SIZE, 0); - sacrificeAll = new CButton(Point(393, 520), "ALTARMY.DEF", CGI->generaltexth->zelp[579], boost::bind(&CAltarWindow::SacrificeAll,this)); + sacrificeAll = new CButton(Point(393, 520), "ALTARMY.DEF", CGI->generaltexth->zelp[579], std::bind(&CAltarWindow::SacrificeAll,this)); sacrificeBackpack = nullptr; initItems(true); @@ -1126,9 +1126,9 @@ CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*= //%s's Creatures new CLabel(302, 423, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[478]); - sacrificeAll = new CButton(Point(393, 520), "ALTFILL.DEF", CGI->generaltexth->zelp[571], boost::bind(&CAltarWindow::SacrificeAll,this)); + sacrificeAll = new CButton(Point(393, 520), "ALTFILL.DEF", CGI->generaltexth->zelp[571], std::bind(&CAltarWindow::SacrificeAll,this)); sacrificeAll->block(hero->artifactsInBackpack.empty() && hero->artifactsWorn.empty()); - sacrificeBackpack = new CButton(Point(147, 520), "ALTEMBK.DEF", CGI->generaltexth->zelp[570], boost::bind(&CAltarWindow::SacrificeBackpack,this)); + sacrificeBackpack = new CButton(Point(147, 520), "ALTEMBK.DEF", CGI->generaltexth->zelp[570], std::bind(&CAltarWindow::SacrificeBackpack,this)); sacrificeBackpack->block(hero->artifactsInBackpack.empty()); slider = nullptr; @@ -1150,12 +1150,12 @@ CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*= ok = new CButton(Point(516, 520), "IOK6432.DEF", CGI->generaltexth->zelp[568], [&]{ close();}, SDLK_RETURN); ok->assignedKeys.insert(SDLK_ESCAPE); - deal = new CButton(Point(269, 520), "ALTSACR.DEF", CGI->generaltexth->zelp[585], boost::bind(&CAltarWindow::makeDeal,this)); + deal = new CButton(Point(269, 520), "ALTSACR.DEF", CGI->generaltexth->zelp[585], std::bind(&CAltarWindow::makeDeal,this)); if(Hero->getAlignment() != ::EAlignment::EVIL && Mode == EMarketMode::CREATURE_EXP) - new CButton(Point(516, 421), "ALTART.DEF", CGI->generaltexth->zelp[580], boost::bind(&CTradeWindow::setMode,this, EMarketMode::ARTIFACT_EXP)); + new CButton(Point(516, 421), "ALTART.DEF", CGI->generaltexth->zelp[580], std::bind(&CTradeWindow::setMode,this, EMarketMode::ARTIFACT_EXP)); if(Hero->getAlignment() != ::EAlignment::GOOD && Mode == EMarketMode::ARTIFACT_EXP) - new CButton(Point(516, 421), "ALTSACC.DEF", CGI->generaltexth->zelp[572], boost::bind(&CTradeWindow::setMode,this, EMarketMode::CREATURE_EXP)); + new CButton(Point(516, 421), "ALTSACC.DEF", CGI->generaltexth->zelp[572], std::bind(&CTradeWindow::setMode,this, EMarketMode::CREATURE_EXP)); expPerUnit.resize(GameConstants::ARMY_SIZE, 0); getExpValues(); diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index 056af5970..5aec313c5 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -261,11 +261,11 @@ CRecruitmentWindow::CRecruitmentWindow(const CGDwelling *Dwelling, int Level, co OBJ_CONSTRUCTION_CAPTURING_ALL; new CGStatusBar(new CPicture(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26)); - slider = new CSlider(Point(176,279),135,boost::bind(&CRecruitmentWindow::sliderMoved,this, _1),0,0,0,true); + slider = new CSlider(Point(176,279),135,std::bind(&CRecruitmentWindow::sliderMoved,this, _1),0,0,0,true); - maxButton = new CButton(Point(134, 313), "IRCBTNS.DEF", CGI->generaltexth->zelp[553], boost::bind(&CSlider::moveToMax,slider), SDLK_m); - buyButton = new CButton(Point(212, 313), "IBY6432.DEF", CGI->generaltexth->zelp[554], boost::bind(&CRecruitmentWindow::buy,this), SDLK_RETURN); - cancelButton = new CButton(Point(290, 313), "ICN6432.DEF", CGI->generaltexth->zelp[555], boost::bind(&CRecruitmentWindow::close,this), SDLK_ESCAPE); + maxButton = new CButton(Point(134, 313), "IRCBTNS.DEF", CGI->generaltexth->zelp[553], std::bind(&CSlider::moveToMax,slider), SDLK_m); + buyButton = new CButton(Point(212, 313), "IBY6432.DEF", CGI->generaltexth->zelp[554], std::bind(&CRecruitmentWindow::buy,this), SDLK_RETURN); + cancelButton = new CButton(Point(290, 313), "ICN6432.DEF", CGI->generaltexth->zelp[555], std::bind(&CRecruitmentWindow::close,this), SDLK_ESCAPE); title = new CLabel(243, 32, FONT_BIG, CENTER, Colors::YELLOW); availableValue = new CLabel(205, 253, FONT_SMALL, CENTER, Colors::WHITE); @@ -374,17 +374,17 @@ CSplitWindow::CSplitWindow(const CCreature * creature, std::functionfilters.add(boost::bind(&CTextInput::numberFilter, _1, _2, leftMin, leftMax)); - rightInput->filters.add(boost::bind(&CTextInput::numberFilter, _1, _2, rightMin, rightMax)); + leftInput->filters.add(std::bind(&CTextInput::numberFilter, _1, _2, leftMin, leftMax)); + rightInput->filters.add(std::bind(&CTextInput::numberFilter, _1, _2, rightMin, rightMax)); leftInput->setText(boost::lexical_cast(leftAmount), false); rightInput->setText(boost::lexical_cast(rightAmount), false); @@ -392,7 +392,7 @@ CSplitWindow::CSplitWindow(const CCreature * creature, std::functiongeneraltexth->allTexts[256]; boost::algorithm::replace_first(title,"%s", creature->namePl); @@ -441,7 +441,7 @@ CLevelWindow::CLevelWindow(const CGHeroInstance *hero, PrimarySkill::PrimarySkil LOCPLINT->showingDialog->setn(true); new CAnimImage("PortraitsLarge", hero->portrait, 0, 170, 66); - new CButton(Point(297, 413), "IOKAY", CButton::tooltip(), boost::bind(&CLevelWindow::close, this), SDLK_RETURN); + new CButton(Point(297, 413), "IOKAY", CButton::tooltip(), std::bind(&CLevelWindow::close, this), SDLK_RETURN); //%s has gained a level. new CLabel(192, 33, FONT_MEDIUM, CENTER, Colors::WHITE, @@ -560,28 +560,28 @@ CSystemOptionsWindow::CSystemOptionsWindow(): heroMoveSpeed->addToggle(4, new CToggleButton(Point(124, 77), "sysopb3.def", CGI->generaltexth->zelp[351])); heroMoveSpeed->addToggle(8, new CToggleButton(Point(172, 77), "sysopb4.def", CGI->generaltexth->zelp[352])); heroMoveSpeed->setSelected(settings["adventure"]["heroSpeed"].Float()); - heroMoveSpeed->addCallback(boost::bind(&CSystemOptionsWindow::setHeroMoveSpeed, this, _1)); + heroMoveSpeed->addCallback(std::bind(&CSystemOptionsWindow::setHeroMoveSpeed, this, _1)); mapScrollSpeed = new CToggleGroup(0); mapScrollSpeed->addToggle(1, new CToggleButton(Point( 28, 210), "sysopb9.def", CGI->generaltexth->zelp[357])); mapScrollSpeed->addToggle(2, new CToggleButton(Point( 92, 210), "sysob10.def", CGI->generaltexth->zelp[358])); mapScrollSpeed->addToggle(4, new CToggleButton(Point(156, 210), "sysob11.def", CGI->generaltexth->zelp[359])); mapScrollSpeed->setSelected(settings["adventure"]["scrollSpeed"].Float()); - mapScrollSpeed->addCallback(boost::bind(&CSystemOptionsWindow::setMapScrollingSpeed, this, _1)); + mapScrollSpeed->addCallback(std::bind(&CSystemOptionsWindow::setMapScrollingSpeed, this, _1)); musicVolume = new CToggleGroup(0, true); for(int i=0; i<10; ++i) musicVolume->addToggle(i*11, new CToggleButton(Point(29 + 19*i, 359), "syslb.def", CGI->generaltexth->zelp[326+i])); musicVolume->setSelected(CCS->musich->getVolume()); - musicVolume->addCallback(boost::bind(&CSystemOptionsWindow::setMusicVolume, this, _1)); + musicVolume->addCallback(std::bind(&CSystemOptionsWindow::setMusicVolume, this, _1)); effectsVolume = new CToggleGroup(0, true); for(int i=0; i<10; ++i) effectsVolume->addToggle(i*11, new CToggleButton(Point(29 + 19*i, 425), "syslb.def", CGI->generaltexth->zelp[336+i])); effectsVolume->setSelected(CCS->soundh->getVolume()); - effectsVolume->addCallback(boost::bind(&CSystemOptionsWindow::setSoundVolume, this, _1)); + effectsVolume->addCallback(std::bind(&CSystemOptionsWindow::setSoundVolume, this, _1)); showReminder = new CToggleButton(Point(246, 87), "sysopchk.def", CGI->generaltexth->zelp[361], [&] (bool value) { toggleReminder(value);}); @@ -607,7 +607,7 @@ CSystemOptionsWindow::CSystemOptionsWindow(): onFullscreenChanged([&](const JsonNode &newState){ fullscreen->setSelected(newState.Bool());}); gameResButton = new CButton(Point(28, 275),"buttons/resolution", CButton::tooltip(texts["resolutionButton"]), - boost::bind(&CSystemOptionsWindow::selectGameRes, this), SDLK_g); + std::bind(&CSystemOptionsWindow::selectGameRes, this), SDLK_g); std::string resText; resText += boost::lexical_cast(settings["video"]["screenRes"]["width"].Float()); @@ -630,7 +630,7 @@ void CSystemOptionsWindow::selectGameRes() } GH.pushInt(new CObjectListWindow(items, nullptr, texts["label"].String(), texts["help"].String(), - boost::bind(&CSystemOptionsWindow::setGameRes, this, _1))); + std::bind(&CSystemOptionsWindow::setGameRes, this, _1))); } void CSystemOptionsWindow::setGameRes(int index) @@ -744,9 +744,9 @@ CTavernWindow::CTavernWindow(const CGObjectInstance *TavernObj): new CTextBox(LOCPLINT->cb->getTavernGossip(tavernObj), Rect(32, 190, 330, 68), 0, FONT_SMALL, CENTER, Colors::WHITE); new CGStatusBar(new CPicture(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26)); - cancel = new CButton(Point(310, 428), "ICANCEL.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[7]), boost::bind(&CTavernWindow::close, this), SDLK_ESCAPE); - recruit = new CButton(Point(272, 355), "TPTAV01.DEF", CButton::tooltip(), boost::bind(&CTavernWindow::recruitb, this), SDLK_RETURN); - thiefGuild = new CButton(Point(22, 428), "TPTAV02.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[5]), boost::bind(&CTavernWindow::thievesguildb, this), SDLK_t); + cancel = new CButton(Point(310, 428), "ICANCEL.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[7]), std::bind(&CTavernWindow::close, this), SDLK_ESCAPE); + recruit = new CButton(Point(272, 355), "TPTAV01.DEF", CButton::tooltip(), std::bind(&CTavernWindow::recruitb, this), SDLK_RETURN); + thiefGuild = new CButton(Point(22, 428), "TPTAV02.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[5]), std::bind(&CTavernWindow::thievesguildb, this), SDLK_t); if(LOCPLINT->cb->getResourceAmount(Res::GOLD) < 2500) //not enough gold { @@ -1019,20 +1019,20 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2, } //buttons - quit = new CButton(Point(732, 567), "IOKAY.DEF", CGI->generaltexth->zelp[600], boost::bind(&CExchangeWindow::close, this), SDLK_RETURN); + quit = new CButton(Point(732, 567), "IOKAY.DEF", CGI->generaltexth->zelp[600], std::bind(&CExchangeWindow::close, this), SDLK_RETURN); if(queryID.getNum() > 0) quit->addCallback([=]{ LOCPLINT->cb->selectionMade(0, queryID); }); - questlogButton[0] = new CButton(Point( 10, 44), "hsbtns4.def", CButton::tooltip(CGI->generaltexth->heroscrn[0]), boost::bind(&CExchangeWindow::questlog,this, 0)); - questlogButton[1] = new CButton(Point(740, 44), "hsbtns4.def", CButton::tooltip(CGI->generaltexth->heroscrn[0]), boost::bind(&CExchangeWindow::questlog,this, 1)); + questlogButton[0] = new CButton(Point( 10, 44), "hsbtns4.def", CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questlog,this, 0)); + questlogButton[1] = new CButton(Point(740, 44), "hsbtns4.def", CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questlog,this, 1)); Rect barRect(5, 578, 725, 18); ourBar = new CGStatusBar(new CPicture(*background, barRect, 5, 578, false)); //garrison interface garr = new CGarrisonInt(69, 131, 4, Point(418,0), *background, Point(69,131), heroInst[0],heroInst[1], true, true); - garr->addSplitBtn(new CButton( Point( 10, 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), boost::bind(&CGarrisonInt::splitClick, garr))); - garr->addSplitBtn(new CButton( Point(740, 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), boost::bind(&CGarrisonInt::splitClick, garr))); + garr->addSplitBtn(new CButton( Point( 10, 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), std::bind(&CGarrisonInt::splitClick, garr))); + garr->addSplitBtn(new CButton( Point(740, 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), std::bind(&CGarrisonInt::splitClick, garr))); } CExchangeWindow::~CExchangeWindow() //d-tor @@ -1065,8 +1065,8 @@ CShipyardWindow::CShipyardWindow(const std::vector &cost, int state, int b goldPic = new CAnimImage("RESOURCE", Res::GOLD, 0, 100, 244); woodPic = new CAnimImage("RESOURCE", Res::WOOD, 0, 196, 244); - quit = new CButton( Point(224, 312), "ICANCEL", CButton::tooltip(CGI->generaltexth->allTexts[599]), boost::bind(&CShipyardWindow::close, this), SDLK_RETURN); - build = new CButton( Point( 42, 312), "IBUY30", CButton::tooltip(CGI->generaltexth->allTexts[598]), boost::bind(&CShipyardWindow::close, this),SDLK_RETURN); + quit = new CButton( Point(224, 312), "ICANCEL", CButton::tooltip(CGI->generaltexth->allTexts[599]), std::bind(&CShipyardWindow::close, this), SDLK_RETURN); + build = new CButton( Point( 42, 312), "IBUY30", CButton::tooltip(CGI->generaltexth->allTexts[598]), std::bind(&CShipyardWindow::close, this),SDLK_RETURN); build->addCallback(onBuy); for(Res::ERes i = Res::WOOD; i <= Res::GOLD; vstd::advance(i, 1)) @@ -1092,7 +1092,7 @@ CPuzzleWindow::CPuzzleWindow(const int3 &GrailPos, double discoveredRatio): OBJ_CONSTRUCTION_CAPTURING_ALL; CCS->soundh->playSound(soundBase::OBELISK); - quitb = new CButton(Point(670, 538), "IOK6432.DEF", CButton::tooltip(CGI->generaltexth->allTexts[599]), boost::bind(&CPuzzleWindow::close, this), SDLK_RETURN); + quitb = new CButton(Point(670, 538), "IOK6432.DEF", CButton::tooltip(CGI->generaltexth->allTexts[599]), std::bind(&CPuzzleWindow::close, this), SDLK_RETURN); quitb->assignedKeys.insert(SDLK_ESCAPE); quitb->borderColor = Colors::METALLIC_GOLD; @@ -1430,7 +1430,7 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance *visitor, const CGObjectIn for (auto image : { "APHLF4R.DEF", "APHLF4Y.DEF", "APHLF4G.DEF" }) upgradeAll->addImage(image); - quit = new CButton(Point(294, 275), "IOKAY.DEF", CButton::tooltip(), boost::bind(&CHillFortWindow::close, this), SDLK_RETURN); + quit = new CButton(Point(294, 275), "IOKAY.DEF", CButton::tooltip(), std::bind(&CHillFortWindow::close, this), SDLK_RETURN); bar = new CGStatusBar(new CPicture(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26)); garr = new CGarrisonInt(108, 60, 18, Point(),background->bg,Point(108,60),hero,nullptr); @@ -1777,9 +1777,9 @@ void CObjectListWindow::init(CIntObject * titlePic, std::string _title, std::str title = new CLabel(152, 27, FONT_BIG, CENTER, Colors::YELLOW, _title); descr = new CLabel(145, 133, FONT_SMALL, CENTER, Colors::WHITE, _descr); - ok = new CButton(Point(15, 402), "IOKAY.DEF", CButton::tooltip(), boost::bind(&CObjectListWindow::elementSelected, this), SDLK_RETURN); + ok = new CButton(Point(15, 402), "IOKAY.DEF", CButton::tooltip(), std::bind(&CObjectListWindow::elementSelected, this), SDLK_RETURN); ok->block(true); - exit = new CButton( Point(228, 402), "ICANCEL.DEF", CButton::tooltip(), boost::bind(&CGuiHandler::popIntTotally,&GH, this), SDLK_ESCAPE); + exit = new CButton( Point(228, 402), "ICANCEL.DEF", CButton::tooltip(), std::bind(&CGuiHandler::popIntTotally,&GH, this), SDLK_ESCAPE); if (titlePic) { @@ -1789,7 +1789,7 @@ void CObjectListWindow::init(CIntObject * titlePic, std::string _title, std::str titleImage->pos.x = pos.w/2 + pos.x - titleImage->pos.w/2; titleImage->pos.y =75 + pos.y - titleImage->pos.h/2; } - list = new CListBox(boost::bind(&CObjectListWindow::genItem, this, _1), CListBox::DestroyFunc(), + list = new CListBox(std::bind(&CObjectListWindow::genItem, this, _1), CListBox::DestroyFunc(), Point(14, 151), Point(0, 25), 9, items.size(), 0, 1, Rect(262, -32, 256, 256) ); list->type |= REDRAW_PARENT; } diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index 8c7ff3a5e..99e7b67c6 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -74,8 +74,8 @@ CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperl { buttons.push_back(new CButton(Point(0,0), Buttons[i].first, CButton::tooltip(), Buttons[i].second)); if(!i && askID.getNum() >= 0) - buttons.back()->addCallback(boost::bind(&CSelWindow::madeChoice,this)); - buttons[i]->addCallback(boost::bind(&CInfoWindow::close,this)); //each button will close the window apart from call-defined actions + buttons.back()->addCallback(std::bind(&CSelWindow::madeChoice,this)); + buttons[i]->addCallback(std::bind(&CInfoWindow::close,this)); //each button will close the window apart from call-defined actions } text = new CTextBox(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::WHITE); @@ -84,14 +84,14 @@ CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperl buttons.back()->assignedKeys.insert(SDLK_ESCAPE); //last button - reacts on escape if(buttons.size() > 1 && askID.getNum() >= 0) //cancel button functionality - buttons.back()->addCallback(boost::bind(&CCallback::selectionMade,LOCPLINT->cb.get(),0,askID)); + buttons.back()->addCallback(std::bind(&CCallback::selectionMade,LOCPLINT->cb.get(),0,askID)); for(int i=0;irecActions = 255; addChild(comps[i]); components.push_back(comps[i]); - comps[i]->onSelect = boost::bind(&CSelWindow::selectionChange,this,i); + comps[i]->onSelect = std::bind(&CSelWindow::selectionChange,this,i); if(i<9) comps[i]->assignedKeys.insert(SDLK_1+i); } @@ -121,7 +121,7 @@ CInfoWindow::CInfoWindow(std::string Text, PlayerColor player, const TCompsInfo ID = QueryID(-1); for(auto & Button : Buttons) { - CButton *button = new CButton(Point(0,0), Button.first, CButton::tooltip(), boost::bind(&CInfoWindow::close,this)); + CButton *button = new CButton(Point(0,0), Button.first, CButton::tooltip(), std::bind(&CInfoWindow::close,this)); button->borderColor = Colors::METALLIC_GOLD; button->addCallback(Button.second); //each button will close the window apart from call-defined actions buttons.push_back(button); @@ -205,7 +205,7 @@ void CInfoWindow::showYesNoDialog(const std::string & text, const std::vector *components, const boost::function & onOk, bool delComps, PlayerColor player) +void CInfoWindow::showOkDialog(const std::string & text, const std::vector *components, const std::function & onOk, bool delComps, PlayerColor player) { std::vector > > pom; pom.push_back(std::pair >("IOKAY.DEF",0)); diff --git a/client/windows/InfoWindows.h b/client/windows/InfoWindows.h index afb5e3f95..540480d09 100644 --- a/client/windows/InfoWindows.h +++ b/client/windows/InfoWindows.h @@ -63,7 +63,7 @@ public: //use only before the game starts! (showYesNoDialog in LOCPLINT must be used then) static void showInfoDialog( const std::string & text, const std::vector *components, bool DelComps = true, PlayerColor player = PlayerColor(1)); - static void showOkDialog(const std::string & text, const std::vector *components, const boost::function & onOk, bool delComps = true, PlayerColor player = PlayerColor(1)); + static void showOkDialog(const std::string & text, const std::vector *components, const std::function & onOk, bool delComps = true, PlayerColor player = PlayerColor(1)); static void showYesNoDialog( const std::string & text, const std::vector *components, const CFunctionList &onYes, const CFunctionList &onNo, bool DelComps = true, PlayerColor player = PlayerColor(1)); static CInfoWindow *create(const std::string &text, PlayerColor playerID = PlayerColor(1), const std::vector *components = nullptr, bool DelComps = false);