mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	* improved "Split" button behavior. It can be used for calling hero meeting screen in town screen.
*fixed problems with underground switch button in higher resolutions * minor graphical fixes for Marketplace window * minor fixes
This commit is contained in:
		| @@ -526,15 +526,15 @@ void CSlider::clickLeft(tribool down, bool previousState) | ||||
| 		float rw = 0; | ||||
| 		if(horizontal) | ||||
| 		{ | ||||
| 			pw = GH.current->motion.x-pos.x-24; | ||||
| 			pw = GH.current->motion.x-pos.x-16; | ||||
| 			rw = pw / ((float)(pos.w-48)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			pw = GH.current->motion.y-pos.y-24; | ||||
| 			pw = GH.current->motion.y-pos.y-16; | ||||
| 			rw = pw / ((float)(pos.h-48)); | ||||
| 		} | ||||
| 		if(pw < -8  ||  pw > (horizontal ? pos.w : pos.h) + 8) | ||||
| 		if(pw < 0  ||  pw > (horizontal ? pos.w : pos.h) - 32) | ||||
| 			return; | ||||
| // 		if (rw>1) return; | ||||
| // 		if (rw<0) return; | ||||
| @@ -556,7 +556,7 @@ CSlider::~CSlider() | ||||
| CSlider::CSlider(int x, int y, int totalw, boost::function<void(int)> Moved, int Capacity, int Amount, int Value, bool Horizontal, int style) | ||||
| :capacity(Capacity),amount(Amount),horizontal(Horizontal), moved(Moved) | ||||
| { | ||||
| 	OBJ_CONSTRUCTION; | ||||
| 	OBJ_CONSTRUCTION_CAPTURING_ALL; | ||||
| 	setAmount(amount); | ||||
|  | ||||
| 	used = LCLICK; | ||||
|   | ||||
| @@ -1277,24 +1277,19 @@ CDefHandler * CInfoBar::getAnim(int mode) | ||||
| 	{ | ||||
| 	case 0: | ||||
| 		return day; | ||||
| 		break; | ||||
| 	case 1: | ||||
| 		return week1; | ||||
| 		break; | ||||
| 	case 2: | ||||
| 		return week2; | ||||
| 		break; | ||||
| 	case 3: | ||||
| 		return week3; | ||||
| 		break; | ||||
| 	case 4: | ||||
| 		return week4; | ||||
| 		break; | ||||
| 	default: | ||||
| 		return NULL; | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CInfoBar::blitAnim(int mode)//0 - day, 1 - week | ||||
| { | ||||
| 	CDefHandler * anim = NULL; | ||||
| @@ -1313,6 +1308,7 @@ void CInfoBar::blitAnim(int mode)//0 - day, 1 - week | ||||
| 	if (pom == anim->ourImages.size()-1) | ||||
| 		toNextTick+=750; | ||||
| } | ||||
|  | ||||
| void CInfoBar::newDay(int Day) | ||||
| { | ||||
| 	if(LOCPLINT->cb->getDate(1) != 1) | ||||
| @@ -1344,7 +1340,6 @@ void CInfoBar::newDay(int Day) | ||||
| 	activateTimer(); | ||||
| 	toNextTick = 500; | ||||
| 	blitAnim(mode); | ||||
| 	//blitAt(day->ourImages[pom].bitmap,pos.x+10,pos.y+10); | ||||
| } | ||||
|  | ||||
| void CInfoBar::showComp(SComponent * comp, int time) | ||||
| @@ -1390,6 +1385,7 @@ void CInfoBar::show( SDL_Surface * to ) | ||||
| { | ||||
|  | ||||
| } | ||||
|  | ||||
| CAdvMapInt::CAdvMapInt(int Player) | ||||
| :player(Player), | ||||
| statusbar(ADVOPT.statusbarX,ADVOPT.statusbarY,ADVOPT.statusbarG), | ||||
|   | ||||
| @@ -120,7 +120,7 @@ public: | ||||
|  | ||||
| 	CInfoBar(); | ||||
| 	~CInfoBar(); | ||||
| 	void newDay(int Day); | ||||
| 	void newDay(int Day); //start showing new day/week animation | ||||
| 	void showComp(SComponent * comp, int time=5000); | ||||
| 	void tick(); | ||||
| 	void draw(SDL_Surface * to, const CGObjectInstance * specific=NULL); // if specific==0 function draws info about selected hero/town | ||||
|   | ||||
| @@ -261,9 +261,10 @@ void CHeroGSlot::clickLeft(tribool down, bool previousState) | ||||
| 	{ | ||||
| 		owner->garr->splitting = false; | ||||
| 		owner->garr->highlighted = NULL; | ||||
|  | ||||
| 		if(hero && highlight) | ||||
| 		{ | ||||
| 			highlight = false; | ||||
| 			setHighlight(false); | ||||
| 			LOCPLINT->openHeroWindow(hero); | ||||
| 		} | ||||
| 		else if(other->hero && other->highlight) | ||||
| @@ -284,13 +285,16 @@ void CHeroGSlot::clickLeft(tribool down, bool previousState) | ||||
| 					allow = false; | ||||
| 				} | ||||
| 			} | ||||
| 			other->highlight = highlight = false; | ||||
|  | ||||
| 			setHighlight(false); | ||||
| 			other->setHighlight(false); | ||||
|  | ||||
| 			if(allow) | ||||
| 				LOCPLINT->cb->swapGarrisonHero(owner->town); | ||||
| 		} | ||||
| 		else if(hero) | ||||
| 		{ | ||||
| 			highlight = true; | ||||
| 			setHighlight(true); | ||||
| 			owner->garr->highlighted = NULL; | ||||
| 			show(screen2); | ||||
| 		} | ||||
| @@ -344,6 +348,16 @@ CHeroGSlot::~CHeroGSlot() | ||||
| { | ||||
| } | ||||
|  | ||||
| void CHeroGSlot::setHighlight( bool on ) | ||||
| { | ||||
| 	highlight = on; | ||||
| 	if(owner->hslotup.hero && owner->hslotdown.hero) //two heroes in town | ||||
| 	{ | ||||
| 		for(size_t i = 0; i<owner->garr->splitButtons.size(); i++) //splitting enabled when slot higlighted | ||||
| 			owner->garr->splitButtons[i]->block(!on); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| static std::string getBgName(int type) //TODO - co z tym zrobi�? | ||||
| { | ||||
| 	switch (type) | ||||
| @@ -415,8 +429,9 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, int listPos) | ||||
| 	exit = new AdventureMapButton | ||||
| 		(CGI->generaltexth->tcommands[8],"",boost::bind(&CCastleInterface::close,this),pos.x+744,pos.y+544,"TSBTNS.DEF",SDLK_RETURN); | ||||
| 	exit->assignedKeys.insert(SDLK_ESCAPE); | ||||
| 	split = new AdventureMapButton | ||||
| 		(CGI->generaltexth->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),pos.x+744,pos.y+382,"TSBTNS.DEF"); | ||||
| 	split = new AdventureMapButton(CGI->generaltexth->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),pos.x+744,pos.y+382,"TSBTNS.DEF"); | ||||
| 	split->callback += boost::bind(&CCastleInterface::splitClicked,this); | ||||
| 	garr->splitButtons.push_back(split); | ||||
| 	statusbar = new CStatusBar(pos.x+7,pos.y+555,"TSTATBAR.bmp",732); | ||||
| 	resdatabar = new CResDataBar("ZRESBAR.bmp",pos.x+3,pos.y+575,32,2,85,85); | ||||
| 	resdatabar->pos.x = pos.x+3; resdatabar->pos.y = pos.y+575; | ||||
| @@ -1021,6 +1036,14 @@ void CCastleInterface::keyPressed( const SDL_KeyboardEvent & key ) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CCastleInterface::splitClicked() | ||||
| { | ||||
| 	if(town->visitingHero && town->garrisonHero && (hslotdown.highlight || hslotup.highlight)) | ||||
| 	{ | ||||
| 		LOCPLINT->heroExchangeStarted(town->visitingHero->id, town->garrisonHero->id); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CHallInterface::CBuildingBox::hover(bool on) | ||||
| { | ||||
| 	//Hoverable::hover(on); | ||||
|   | ||||
| @@ -58,6 +58,8 @@ public: | ||||
| 	int upg; //0 - up garrison, 1 - down garrison | ||||
| 	bool highlight; //indicates id the slot is highlighted | ||||
|  | ||||
| 	void setHighlight(bool on); | ||||
|  | ||||
| 	void hover (bool on); | ||||
| 	void clickRight(tribool down, bool previousState); | ||||
| 	void clickLeft(tribool down, bool previousState); | ||||
| @@ -105,6 +107,7 @@ public: | ||||
| 	void buildingClicked(int building); | ||||
| 	void enterTavern(); | ||||
| 	void enterMageGuild(); | ||||
| 	void splitClicked(); //for hero meeting (splitting stacks is handled by garrison int) | ||||
| 	CRecruitmentWindow * showRecruitmentWindow(int building); | ||||
| 	void enterHall(); | ||||
| 	void close(); | ||||
|   | ||||
| @@ -153,6 +153,14 @@ struct AddDefForButton | ||||
| 		currentButton->additionalDefs.push_back(str); | ||||
| 	} | ||||
| }; | ||||
| struct ClearAdditionalDefs | ||||
| { | ||||
| 	template <typename Z> | ||||
| 	void operator()(const Z first, const Z last) const | ||||
| 	{ | ||||
| 		currentButton->additionalDefs.clear(); | ||||
| 	} | ||||
| }; | ||||
| static void addGRes() | ||||
| { | ||||
| 	if(current) | ||||
| @@ -248,7 +256,8 @@ struct SettingsGrammar : public grammar<SettingsGrammar> | ||||
| 							  |	"y=" >> uint_p[SetButtonProp_a(&ButtonInfo::y)] | ||||
| 							  |	"playerColoured=" >> uint_p[SetButtonProp_a(&ButtonInfo::playerColoured)] | ||||
| 							  |	"graphic=" >> fname[SetButtonStr(&ButtonInfo::defName)] | ||||
| 							  | "additionalDefs=" >> ch_p('(') >> fname[AddDefForButton()]  | ||||
| 							  | str_p("additionalDefs=")[ClearAdditionalDefs()]  | ||||
| 									>> ch_p('(') >> fname[AddDefForButton()]  | ||||
| 									>> *(',' >> fname[AddDefForButton()]) >> ')' | ||||
| 							)  | ||||
| 						 ) | ||||
|   | ||||
| @@ -66,8 +66,6 @@ CHeroWindow::CHeroWindow(int playerColor): | ||||
|  | ||||
|  | ||||
| 	gar2button = new CHighlightableButton(0, 0, map_list_of(0,CGI->generaltexth->heroscrn[26])(3,CGI->generaltexth->heroscrn[25]), CGI->generaltexth->heroscrn[31], false, "hsbtns8.def", NULL, pos.x+604, pos.y+491, SDLK_b); | ||||
| 	gar4button = new AdventureMapButton(CGI->generaltexth->allTexts[256], CGI->generaltexth->heroscrn[32], boost::function<void()>(), pos.x+604, pos.y+527, "hsbtns9.def", false, NULL, false); | ||||
| 	boost::algorithm::replace_first(gar4button->hoverTexts[0],"%s",CGI->generaltexth->allTexts[43]); | ||||
|  | ||||
|  | ||||
| 	//right list of heroes | ||||
| @@ -127,7 +125,7 @@ CHeroWindow::~CHeroWindow() | ||||
| 	delete questlogButton; | ||||
| 	delete formations; | ||||
| 	delete gar2button; | ||||
| 	delete gar4button; | ||||
| 	//delete gar4button; | ||||
|  | ||||
| 	for(size_t g=0; g<heroListMi.size(); ++g) | ||||
| 	{ | ||||
| @@ -172,7 +170,7 @@ void CHeroWindow::show(SDL_Surface *to) | ||||
| 	questlogButton->show(to); | ||||
| 	formations->show(to); | ||||
| 	gar2button->show(to); | ||||
| 	gar4button->show(to); | ||||
| 	//gar4button->show(to); | ||||
|  | ||||
| 	garr->show(to); | ||||
| 	ourBar->show(to); | ||||
| @@ -208,7 +206,10 @@ void CHeroWindow::setHero(const CGHeroInstance *hero) | ||||
| 	delete garr; | ||||
| 	garr = new CGarrisonInt(pos.x+80, pos.y+493, 8, Point(), curBack, Point(16,486), curHero); | ||||
| 	garr->update = false; | ||||
| 	gar4button->callback =  boost::bind(&CGarrisonInt::splitClick,garr);//actualization of callback function | ||||
|  | ||||
| 	AdventureMapButton * split = new AdventureMapButton(CGI->generaltexth->allTexts[256], CGI->generaltexth->heroscrn[32], boost::bind(&CGarrisonInt::splitClick,garr), pos.x+604, pos.y+527, "hsbtns9.def", false, NULL, false); //deleted by garrison destructor | ||||
| 	boost::algorithm::replace_first(split->hoverTexts[0],"%s",CGI->generaltexth->allTexts[43]); | ||||
| 	garr->splitButtons.push_back(split); | ||||
|  | ||||
| 	//primary skills support | ||||
| 	for(size_t g=0; g<primSkillAreas.size(); ++g) | ||||
| @@ -299,7 +300,7 @@ void CHeroWindow::activate() | ||||
| 	questlogButton->activate(); | ||||
| 	gar2button->activate(); | ||||
| 	formations->activate(); | ||||
| 	gar4button->activate(); | ||||
| 	//gar4button->activate(); | ||||
| 	portraitArea->activate(); | ||||
| 	expArea->activate(); | ||||
| 	spellPointsArea->activate(); | ||||
| @@ -334,7 +335,7 @@ void CHeroWindow::deactivate() | ||||
| 	questlogButton->deactivate(); | ||||
| 	gar2button->deactivate(); | ||||
| 	formations->deactivate(); | ||||
| 	gar4button->deactivate(); | ||||
| 	//gar4button->deactivate(); | ||||
| 	portraitArea->deactivate(); | ||||
| 	expArea->deactivate(); | ||||
| 	spellPointsArea->deactivate(); | ||||
|   | ||||
| @@ -36,7 +36,7 @@ class CHeroWindow: public CWindowWithGarrison | ||||
| 	CDefEssential *flags; | ||||
|  | ||||
| 	//buttons | ||||
| 	AdventureMapButton * gar4button; //splitting | ||||
| 	//AdventureMapButton * gar4button; //splitting | ||||
| 	std::vector<LClickableAreaHero *> heroListMi; //new better list of heroes | ||||
|  | ||||
| 	CArtifactsOfHero * artifs; | ||||
|   | ||||
| @@ -724,9 +724,9 @@ SDLKey numToDigit( SDLKey key ) | ||||
| bool isNumKey( SDLKey key, bool number ) | ||||
| { | ||||
| 	if(number) | ||||
| 		return key >= SDLK_KP0 && key <= SDLK_KP_EQUALS; | ||||
| 	else | ||||
| 		return key >= SDLK_KP0 && key <= SDLK_KP9; | ||||
| 	else | ||||
| 		return key >= SDLK_KP0 && key <= SDLK_KP_EQUALS; | ||||
| } | ||||
|  | ||||
| bool isArrowKey( SDLKey key ) | ||||
|   | ||||
| @@ -213,6 +213,11 @@ void CGarrisonSlot::clickLeft(tribool down, bool previousState) | ||||
| 				GH.pushInt(creWindow); | ||||
|  | ||||
| 				owner->highlighted = NULL; | ||||
| 				owner->splitting = false; | ||||
|  | ||||
| 				for(size_t i = 0; i<owner->splitButtons.size(); i++) | ||||
| 					owner->splitButtons[i]->block(true); | ||||
|  | ||||
| 				show(screen2); | ||||
| 				refr = true; | ||||
| 				delete pom2; | ||||
| @@ -268,7 +273,12 @@ void CGarrisonSlot::clickLeft(tribool down, bool previousState) | ||||
| 		else //highlight | ||||
| 		{ | ||||
| 			if(creature) | ||||
| 			{ | ||||
| 				owner->highlighted = this; | ||||
|  | ||||
| 				for(size_t i = 0; i<owner->splitButtons.size(); i++) | ||||
| 					owner->splitButtons[i]->block(false); | ||||
| 			} | ||||
| 			show(screen2); | ||||
| 			refr = true; | ||||
| 		} | ||||
| @@ -386,6 +396,9 @@ void CGarrisonInt::show(SDL_Surface * to) | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	for(size_t i = 0; i<splitButtons.size(); i++) | ||||
| 		splitButtons[i]->show(to); | ||||
| } | ||||
| void CGarrisonInt::deactiveteSlots() | ||||
| { | ||||
| @@ -432,6 +445,9 @@ void CGarrisonInt::activeteSlots() | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	for(size_t i = 0; i<splitButtons.size(); i++) | ||||
| 		splitButtons[i]->activate(); | ||||
| } | ||||
| void CGarrisonInt::createSlots() | ||||
| { | ||||
| @@ -508,6 +524,10 @@ void CGarrisonInt::recreateSlots() | ||||
| { | ||||
| 	splitting = false; | ||||
| 	highlighted = NULL; | ||||
|  | ||||
| 	for(size_t i = 0; i<splitButtons.size(); i++) | ||||
| 		splitButtons[i]->block(true); | ||||
|  | ||||
| 	if(active) | ||||
| 	{ | ||||
| 		deactiveteSlots(); | ||||
| @@ -558,6 +578,10 @@ CGarrisonInt::CGarrisonInt(int x, int y, int inx, const Point &garsOffset, SDL_S | ||||
|  | ||||
| void CGarrisonInt::activate() | ||||
| { | ||||
| 	for(size_t i = 0; i<splitButtons.size(); i++) | ||||
| 		if(splitButtons[i]->blocked != !highlighted) | ||||
| 			splitButtons[i]->block(!highlighted); | ||||
|  | ||||
| 	active = true; | ||||
| 	if(sup) | ||||
| 	{ | ||||
| @@ -571,11 +595,16 @@ void CGarrisonInt::activate() | ||||
| 			if((*sdown)[i]) | ||||
| 				(*sdown)[i]->activate(); | ||||
| 	} | ||||
|  | ||||
| 	for(size_t i = 0; i<splitButtons.size(); i++) | ||||
| 		splitButtons[i]->activate(); | ||||
| } | ||||
| void CGarrisonInt::deactivate() | ||||
| { | ||||
| 	active = false; | ||||
| 	deactiveteSlots(); | ||||
| 	for(size_t i = 0; i<splitButtons.size(); i++) | ||||
| 		splitButtons[i]->deactivate(); | ||||
| } | ||||
|  | ||||
| CInfoWindow::CInfoWindow(std::string text, int player, int charperline, const std::vector<SComponent*> &comps, std::vector<std::pair<std::string,CFunctionList<void()> > > &Buttons, bool delComps) | ||||
| @@ -2498,7 +2527,7 @@ void CMarketplaceWindow::CTradeableItem::clickLeft(tribool down, bool previousSt | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			if(mw->hRight != this) | ||||
| 			if(mw->hRight != this)  | ||||
| 				mw->hRight = this; | ||||
| 			else | ||||
| 				return; | ||||
| @@ -2552,9 +2581,9 @@ void CMarketplaceWindow::setMode( int mode ) | ||||
| 			graphics->blueToPlayersAdv(bg2,LOCPLINT->playerID); | ||||
| 			bg = SDL_ConvertSurface(bg2,screen->format,0);  | ||||
| 			SDL_FreeSurface(bg2); | ||||
| 			lpos += genRect(66,69,39,180), genRect(66,69,122,180), genRect(66,69,204,180), | ||||
| 				genRect(66,69,39,259), genRect(66,69,122,259), genRect(66,69,204,259), | ||||
| 				genRect(66,69,122,338); | ||||
| 			lpos += genRect(66,74,39,180), genRect(66,74,122,180), genRect(66,74,204,180), | ||||
| 				genRect(66,74,39,259), genRect(66,74,122,259), genRect(66,74,204,259), | ||||
| 				genRect(66,74,122,338); | ||||
| 			for(int i=0;i<lpos.size();i++) | ||||
| 			{ | ||||
| 				lpos[i].x += pos.x; | ||||
| @@ -2564,9 +2593,9 @@ void CMarketplaceWindow::setMode( int mode ) | ||||
| 			} | ||||
| 			initItems(left,lpos,0,7,true,NULL); | ||||
| 			initItems(right,rpos,0,7,false,NULL); | ||||
| 			printAtMiddle(CGI->generaltexth->allTexts[158],303,28,GEORXX,tytulowy,bg); //title | ||||
| 			printAtMiddle(CGI->generaltexth->allTexts[270],158,148,GEOR13,zwykly,bg); //kingdom res. | ||||
| 			printAtMiddle(CGI->generaltexth->allTexts[168],450,148,GEOR13,zwykly,bg); //available for trade | ||||
| 			printAtMiddle(CGI->generaltexth->allTexts[158],300,27,FONT_BIG,tytulowy,bg); //title | ||||
| 			printAtMiddle(CGI->generaltexth->allTexts[270],155,148,FONT_SMALL,zwykly,bg); //kingdom res. | ||||
| 			printAtMiddle(CGI->generaltexth->allTexts[168],450,147,FONT_SMALL,zwykly,bg); //available for trade | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -2629,26 +2658,26 @@ void CMarketplaceWindow::show(SDL_Surface * to) | ||||
| 		for(int i=0;i<left.size();i++) | ||||
| 		{ | ||||
| 			SDL_itoa(LOCPLINT->cb->getResourceAmount(i),buf,10); | ||||
| 			printAtMiddle(buf,left[i]->pos.x+35,left[i]->pos.y+56,GEOR13,zwykly,to); | ||||
| 			printAtMiddle(buf,left[i]->pos.x+36,left[i]->pos.y+57,FONT_SMALL,zwykly,to); | ||||
| 		} | ||||
| 		if(hLeft) //print prices | ||||
| 		{ | ||||
| 			for(int i=0; i<right.size();i++) | ||||
| 			{ | ||||
| 				if(right[i]->id != hLeft->id) | ||||
| 					printAtMiddle(rSubs[i],right[i]->pos.x+35,right[i]->pos.y+56,GEOR13,zwykly,to); | ||||
| 					printAtMiddle(rSubs[i],right[i]->pos.x+36,right[i]->pos.y+57,FONT_SMALL,zwykly,to); | ||||
| 				else | ||||
| 					printAtMiddle(CGI->generaltexth->allTexts[164],right[i]->pos.x+35,right[i]->pos.y+56,GEOR13,zwykly,to); | ||||
| 					printAtMiddle(CGI->generaltexth->allTexts[164],right[i]->pos.x+36,right[i]->pos.y+57,FONT_SMALL,zwykly,to); | ||||
| 			} | ||||
| 		} | ||||
| 		if(hLeft && hRight && hLeft->id!= hRight->id) | ||||
| 		{ | ||||
| 			blitAt(hLeft->getSurface(),pos.x+142,pos.y+457,to); | ||||
| 			blitAt(hRight->getSurface(),pos.x+430,pos.y+457,to); | ||||
| 			blitAt(hLeft->getSurface(),pos.x+141,pos.y+457,to); | ||||
| 			blitAt(hRight->getSurface(),pos.x+429,pos.y+457,to); | ||||
| 			SDL_itoa(slider->value * r1,buf,10); | ||||
| 			printAtMiddle(buf,pos.x+158,pos.y+504,GEOR13,zwykly,to); | ||||
| 			printAtMiddle(buf,pos.x+156,pos.y+505,FONT_SMALL,zwykly,to); | ||||
| 			SDL_itoa(slider->value * r2,buf,10); | ||||
| 			printAtMiddle(buf,pos.x+446,pos.y+504,GEOR13,zwykly,to); | ||||
| 			printAtMiddle(buf,pos.x+443,pos.y+505,FONT_SMALL,zwykly,to); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -3270,14 +3299,12 @@ void CGarrisonWindow::close() | ||||
|  | ||||
| void CGarrisonWindow::activate() | ||||
| { | ||||
| 	split->activate(); | ||||
| 	quit->activate(); | ||||
| 	garr->activate(); | ||||
| } | ||||
|  | ||||
| void CGarrisonWindow::deactivate() | ||||
| { | ||||
| 	split->deactivate(); | ||||
| 	quit->deactivate(); | ||||
| 	garr->deactivate(); | ||||
| } | ||||
| @@ -3285,7 +3312,6 @@ void CGarrisonWindow::deactivate() | ||||
| void CGarrisonWindow::show(SDL_Surface * to) | ||||
| { | ||||
| 	blitAt(bg,pos,to); | ||||
| 	split->show(to); | ||||
| 	quit->show(to); | ||||
| 	garr->show(to); | ||||
|  | ||||
| @@ -3305,14 +3331,13 @@ CGarrisonWindow::CGarrisonWindow( const CArmedInstance *up, const CGHeroInstance | ||||
| 	pos.h = screen->h; | ||||
|  | ||||
| 	garr = new CGarrisonInt(pos.x+92, pos.y+127, 4, Point(0,96), bg, Point(93,127), up, down); | ||||
| 	split = new AdventureMapButton(CGI->generaltexth->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),pos.x+88,pos.y+314,"IDV6432.DEF"); | ||||
| 	garr->splitButtons.push_back(new AdventureMapButton(CGI->generaltexth->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),pos.x+88,pos.y+314,"IDV6432.DEF")); | ||||
| 	quit = new AdventureMapButton(CGI->generaltexth->tcommands[8],"",boost::bind(&CGarrisonWindow::close,this),pos.x+399,pos.y+314,"IOK6432.DEF",SDLK_RETURN); | ||||
| } | ||||
|  | ||||
| CGarrisonWindow::~CGarrisonWindow() | ||||
| { | ||||
| 	SDL_FreeSurface(bg); | ||||
| 	delete split; | ||||
| 	delete quit; | ||||
| 	delete garr; | ||||
| } | ||||
| @@ -3774,8 +3799,6 @@ void CExchangeWindow::activate() | ||||
| { | ||||
| 	quit->activate(); | ||||
| 	garr->activate(); | ||||
| 	splitButton[0]->activate(); | ||||
| 	splitButton[1]->activate(); | ||||
|  | ||||
| 	artifs[0]->activate(); | ||||
| 	artifs[1]->activate(); | ||||
| @@ -3815,8 +3838,6 @@ void CExchangeWindow::deactivate() | ||||
| { | ||||
| 	quit->deactivate(); | ||||
| 	garr->deactivate(); | ||||
| 	splitButton[0]->deactivate(); | ||||
| 	splitButton[1]->deactivate(); | ||||
|  | ||||
| 	artifs[0]->deactivate(); | ||||
| 	artifs[1]->deactivate(); | ||||
| @@ -3871,8 +3892,6 @@ void CExchangeWindow::show(SDL_Surface * to) | ||||
| 	} | ||||
|  | ||||
| 	garr->show(to); | ||||
| 	splitButton[0]->show(to); | ||||
| 	splitButton[1]->show(to); | ||||
| } | ||||
|  | ||||
| void CExchangeWindow::questlog(int whichHero) | ||||
| @@ -4044,8 +4063,8 @@ CExchangeWindow::CExchangeWindow(si32 hero1, si32 hero2) : bg(NULL) | ||||
| 	//garrison interface | ||||
| 	garr = new CGarrisonInt(pos.x + 69, pos.y + 131, 4, Point(418,0), bg, Point(69,131), heroInst[0],heroInst[1], true); | ||||
|  | ||||
| 	splitButton[0] = new AdventureMapButton(CGI->generaltexth->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),pos.x+10,pos.y+132,"TSBTNS.DEF"); | ||||
| 	splitButton[1] = new AdventureMapButton(CGI->generaltexth->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),pos.x+740,pos.y+132,"TSBTNS.DEF"); | ||||
| 	garr->splitButtons.push_back(new AdventureMapButton(CGI->generaltexth->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),pos.x+10,pos.y+132,"TSBTNS.DEF")); | ||||
| 	garr->splitButtons.push_back(new AdventureMapButton(CGI->generaltexth->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),pos.x+740,pos.y+132,"TSBTNS.DEF")); | ||||
| } | ||||
|  | ||||
| CExchangeWindow::~CExchangeWindow() //d-tor | ||||
| @@ -4061,8 +4080,6 @@ CExchangeWindow::~CExchangeWindow() //d-tor | ||||
| 	delete artifs[1]; | ||||
|  | ||||
| 	delete garr; | ||||
| 	delete splitButton[0]; | ||||
| 	delete splitButton[1]; | ||||
| 	delete ourBar; | ||||
|  | ||||
| 	for(int g=0; g<ARRAY_COUNT(secSkillAreas); g++) | ||||
|   | ||||
| @@ -205,6 +205,7 @@ public: | ||||
| 	Point garOffset, //offset between garrisons (not used if only one hero) | ||||
| 		surOffset; //offset between garrison position on the bg surface and position on the screen | ||||
| 	CGarrisonSlot *highlighted; //chosen slot | ||||
| 	std::vector<AdventureMapButton *> splitButtons; //may be empty if no buttons | ||||
|  | ||||
| 	SDL_Surface *&sur; //bg surface | ||||
| 	int p2; //TODO: comment me | ||||
| @@ -681,7 +682,7 @@ class CGarrisonWindow : public CWindowWithGarrison | ||||
| { | ||||
| public: | ||||
| 	SDL_Surface *bg; //background surface | ||||
| 	AdventureMapButton *split, *quit; | ||||
| 	AdventureMapButton *quit; | ||||
|  | ||||
| 	void close(); | ||||
| 	void activate(); | ||||
| @@ -697,7 +698,7 @@ class CExchangeWindow : public CWindowWithGarrison | ||||
| 	CStatusBar * ourBar; //internal statusbar | ||||
|  | ||||
| 	SDL_Surface *bg; //background | ||||
| 	AdventureMapButton * quit, * questlogButton[2], * splitButton[2]; | ||||
| 	AdventureMapButton * quit, * questlogButton[2]; | ||||
|  | ||||
| 	std::vector<LRClickableAreaWTextComp *> secSkillAreas[2], primSkillAreas; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user