|
@@ -5906,79 +5906,48 @@ CExchangeWindow::~CExchangeWindow() //d-tor
|
|
|
delete speciality[g];
|
|
|
}
|
|
|
|
|
|
-void CShipyardWindow::activate()
|
|
|
+CShipyardWindow::CShipyardWindow(const std::vector<si32> &cost, int state, int boatType, const boost::function<void()> &onBuy)
|
|
|
{
|
|
|
- build->activate();
|
|
|
- quit->activate();
|
|
|
-}
|
|
|
+ OBJ_CONSTRUCTION_CAPTURING_ALL;
|
|
|
+ bg = new CPicture("TPSHIP");
|
|
|
+ bg->colorize(LOCPLINT->playerID);
|
|
|
+ pos = bg->center();
|
|
|
|
|
|
-void CShipyardWindow::deactivate()
|
|
|
-{
|
|
|
- build->deactivate();
|
|
|
- quit->deactivate();
|
|
|
-}
|
|
|
+ bgWater = new CPicture("TPSHIPBK", 100, 69);
|
|
|
|
|
|
-void CShipyardWindow::show( SDL_Surface * to )
|
|
|
-{
|
|
|
- blitAt(bg,pos,to);
|
|
|
- Rect clipRect = genRect(64, 96, pos.x+110, pos.y+85);
|
|
|
- CSDL_Ext::blit8bppAlphaTo24bpp(graphics->boatAnims[boat]->ourImages[21 + frame++/8%8].bitmap, NULL, to, &clipRect);
|
|
|
- build->showAll(to);
|
|
|
- quit->showAll(to);
|
|
|
-}
|
|
|
+ std::string boatFilenames[3] = {"AB01_", "AB02_", "AB03_"};
|
|
|
|
|
|
-CShipyardWindow::~CShipyardWindow()
|
|
|
-{
|
|
|
- delete build;
|
|
|
- delete quit;
|
|
|
-}
|
|
|
+ Point waterCenter = Point(bgWater->pos.x+bgWater->pos.w/2, bgWater->pos.y+bgWater->pos.h/2);
|
|
|
+ bgShip = new CAnimImage(boatFilenames[boatType], 0, 7, 120, 96, CShowableAnim::USE_RLE);
|
|
|
+ bgShip->center(waterCenter);
|
|
|
|
|
|
-CShipyardWindow::CShipyardWindow(const std::vector<si32> &cost, int state, int boatType, const boost::function<void()> &onBuy)
|
|
|
-{
|
|
|
- boat = boatType;
|
|
|
- frame = 0;
|
|
|
- SDL_Surface * bgtemp; //loaded as 8bpp surface
|
|
|
- bgtemp = BitmapHandler::loadBitmap("TPSHIP.bmp");
|
|
|
- pos.x = screen->w/2 - bgtemp->w/2;
|
|
|
- pos.y = screen->h/2 - bgtemp->h/2;
|
|
|
- pos.w = bgtemp->w;
|
|
|
- pos.h = bgtemp->h;
|
|
|
- SDL_SetColorKey(bgtemp,SDL_SRCCOLORKEY,SDL_MapRGB(bgtemp->format,0,255,255));
|
|
|
- graphics->blueToPlayersAdv(bgtemp, LOCPLINT->playerID);
|
|
|
- bg = SDL_ConvertSurface(bgtemp, screen->format, screen->flags); //to 24 bpp
|
|
|
- SDL_FreeSurface(bgtemp);
|
|
|
+ // Create resource icons and costs.
|
|
|
+ std::string goldValue = boost::lexical_cast<std::string>(cost[Res::GOLD]);
|
|
|
+ std::string woodValue = boost::lexical_cast<std::string>(cost[Res::WOOD]);
|
|
|
|
|
|
- bgtemp = BitmapHandler::loadBitmap("TPSHIPBK.bmp");
|
|
|
- blitAt(bgtemp, 100, 69, bg);
|
|
|
- SDL_FreeSurface(bgtemp);
|
|
|
+ goldCost = new CLabel(118, 294, FONT_SMALL, CENTER, zwykly, goldValue);
|
|
|
+ woodCost = new CLabel(212, 294, FONT_SMALL, CENTER, zwykly, woodValue);
|
|
|
+
|
|
|
+ goldPic = new CAnimImage("RESOURCE", Res::GOLD, 0, 100, 244);
|
|
|
+ woodPic = new CAnimImage("RESOURCE", Res::WOOD, 0, 196, 244);
|
|
|
|
|
|
- // Draw resource icons and costs.
|
|
|
- std::string goldCost = boost::lexical_cast<std::string>(1000);
|
|
|
- std::string woodCost = boost::lexical_cast<std::string>(10);
|
|
|
- blitAt(graphics->resources32->ourImages[6].bitmap, 100, 244, bg);
|
|
|
- printAtMiddle(goldCost.c_str(), 118, 294, FONT_SMALL, zwykly, bg);
|
|
|
- blitAt(graphics->resources32->ourImages[0].bitmap, 196, 244, bg);
|
|
|
- printAtMiddle(woodCost.c_str(), 212, 294, FONT_SMALL, zwykly, bg);
|
|
|
+ quit = new AdventureMapButton(CGI->generaltexth->allTexts[599], "", boost::bind(&CGuiHandler::popIntTotally, &GH, this), 224, 312, "ICANCEL", SDLK_RETURN);
|
|
|
+ build = new AdventureMapButton(CGI->generaltexth->allTexts[598], "", boost::bind(&CGuiHandler::popIntTotally, &GH, this), 42, 312, "IBUY30", SDLK_RETURN);
|
|
|
+ build->callback += onBuy;
|
|
|
|
|
|
- bool affordable = true;
|
|
|
- for(int i = 0; i < cost.size(); i++)
|
|
|
+ for(size_t i = 0; i < cost.size(); i++)
|
|
|
{
|
|
|
if(cost[i] > LOCPLINT->cb->getResourceAmount(i))
|
|
|
{
|
|
|
- affordable = false;
|
|
|
+ build->block(true);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- quit = new AdventureMapButton(CGI->generaltexth->allTexts[599], "", boost::bind(&CGuiHandler::popIntTotally, &GH, this), pos.x+224, pos.y+312, "ICANCEL.DEF", SDLK_RETURN);
|
|
|
- build = new AdventureMapButton(CGI->generaltexth->allTexts[598], "", boost::bind(&CGuiHandler::popIntTotally, &GH, this), pos.x+42, pos.y+312, "IBY6432.DEF", SDLK_RETURN);
|
|
|
- build->callback += onBuy;
|
|
|
-
|
|
|
- if(!affordable)
|
|
|
- build->block(true);
|
|
|
+ statusBar = new CGStatusBar(bg->pos.w/2, bg->pos.h-16);
|
|
|
|
|
|
- printAtMiddle(CGI->generaltexth->jktexts[13], 164, 27, FONT_BIG, tytulowy, bg); //Build A New Ship
|
|
|
- printAtMiddle(CGI->generaltexth->jktexts[14], 164, 220, FONT_MEDIUM, zwykly, bg); //Resource cost:
|
|
|
+ title = new CLabel(164, 27, FONT_BIG, CENTER, tytulowy, CGI->generaltexth->jktexts[13]);
|
|
|
+ costLabel = new CLabel(164, 220, FONT_MEDIUM, CENTER, zwykly, CGI->generaltexth->jktexts[14]);
|
|
|
}
|
|
|
|
|
|
CPuzzleWindow::CPuzzleWindow(const int3 &grailPos, float discoveredRatio)
|