1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Patches from Ubuntux:

* clicking on "advanced options" a second time now closes the tab instead of refreshing it.
* Fix position of maps names. Made the slider cursor much more responsive. Speedup the map select screen.
* CPlayerInterface::delComps was not initialized.
* Add a few missing inits.

vcmi_missing_init.diff
vcmi_infowin.diff
vcmi_fix_advoptions.diff
vcmi_fix_printMaps.diff
This commit is contained in:
Michał W. Urbańczyk
2009-05-01 16:14:29 +00:00
parent bb8e505ccd
commit e10ab66631
4 changed files with 33 additions and 18 deletions

View File

@@ -237,6 +237,7 @@ void CHighlightableButton::clickLeft( tribool down )
CHighlightableButton::CHighlightableButton( const CFunctionList<void()> &onSelect, const CFunctionList<void()> &onDeselect, const std::map<int,std::string> &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector<std::string> * add, int x, int y, int key )
{
onlyOn = false;
selected = false;
init(onSelect,Name,HelpBox,playerColoredButton,defName,add,x,y,key);
callback2 = onDeselect;
}

View File

@@ -574,9 +574,10 @@ void CGarrisonInt::deactivate()
deactiveteSlots();
}
CInfoWindow::CInfoWindow(std::string text, int player, int charperline, const std::vector<SComponent*> &comps, std::vector<std::pair<std::string,CFunctionList<void()> > > &Buttons)
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)
{
ID = -1;
this->delComps = delComps;
for(int i=0;i<Buttons.size();i++)
{
buttons.push_back(new AdventureMapButton("","",boost::bind(&CInfoWindow::close,this),0,0,Buttons[i].first));
@@ -595,6 +596,7 @@ CInfoWindow::CInfoWindow(std::string text, int player, int charperline, const st
CInfoWindow::CInfoWindow()
{
ID = -1;
delComps = false;
}
void CInfoWindow::close()
{
@@ -1118,6 +1120,7 @@ CPlayerInterface::CPlayerInterface(int Player, int serial)
adventureInt = NULL;
battleInt = NULL;
pim = new boost::recursive_mutex;
makingTurn = false;
showingDialog = new CondSh<bool>(false);
heroMoveSpeed = 2;
mapScrollingSpeed = 2;
@@ -2434,7 +2437,7 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector
std::vector<std::pair<std::string,CFunctionList<void()> > > pom;
pom.push_back(std::pair<std::string,CFunctionList<void()> >("IOKAY.DEF",0));
CInfoWindow * temp = new CInfoWindow(text,playerID,36,components,pom);
CInfoWindow * temp = new CInfoWindow(text,playerID,36,components,pom,false);
if(makingTurn && listInt.size())
{
@@ -2455,7 +2458,7 @@ void CPlayerInterface::showYesNoDialog(const std::string &text, const std::vecto
std::vector<std::pair<std::string,CFunctionList<void()> > > pom;
pom.push_back(std::pair<std::string,CFunctionList<void()> >("IOKAY.DEF",0));
pom.push_back(std::pair<std::string,CFunctionList<void()> >("ICANCEL.DEF",0));
CInfoWindow * temp = new CInfoWindow(text,playerID,36,components,pom);
CInfoWindow * temp = new CInfoWindow(text,playerID,36,components,pom,DelComps);
temp->delComps = DelComps;
for(int i=0;i<onYes.funcs.size();i++)
temp->buttons[0]->callback += onYes.funcs[i];
@@ -2830,6 +2833,7 @@ CHeroList::CHeroList(int Size)
posmany = pos.y+arrup->height+1;
from = 0;
selected = -1;
pressed = indeterminate;
}
@@ -3142,7 +3146,7 @@ CTownList::CTownList(int Size, int x, int y, std::string arrupg, std::string arr
pressed = indeterminate;
from = 0;
selected = -1;
}
void CTownList::genList()

View File

@@ -377,7 +377,7 @@ public:
virtual void show(SDL_Surface * to);
void activate();
void deactivate();
CInfoWindow(std::string text, int player, int charperline, const std::vector<SComponent*> &comps, std::vector<std::pair<std::string,CFunctionList<void()> > > &Buttons); //c-tor
CInfoWindow(std::string text, int player, int charperline, const std::vector<SComponent*> &comps, std::vector<std::pair<std::string,CFunctionList<void()> > > &Buttons, bool delComps); //c-tor
CInfoWindow(); //c-tor
~CInfoWindow(); //d-tor
};

View File

@@ -363,8 +363,8 @@ void Slider::handleIt(SDL_Event sEvent)
{
whereAreWe=ktory;
updateSlid();
fun(whereAreWe);
}
fun(whereAreWe);
}
}
@@ -911,12 +911,8 @@ void MapSel::printMaps(int from, int to, int at, bool abs)
{
if ((i-at+from) > curVector().size()-1)
{
SDL_Surface * scenin = CSDL_Ext::newSurface(351,25);
SDL_BlitSurface(bg,&genRect(25,351,22,(i-at)*25+115),scenin,NULL);
blitAt(scenin,24,121+(i-at)*25);
//SDL_Flip(screen);
CSDL_Ext::update(screen);
SDL_FreeSurface(scenin);
blitAt(scenin,25,121+(i-at)*25);
continue;
}
if (sizeFilter && ((curVector()[(i-at)+from]->width) != sizeFilter))
@@ -999,11 +995,10 @@ void MapSel::printMaps(int from, int to, int at, bool abs)
temp=curVector()[(i-at)+from]->lossCondition.typeOfLossCon;
blitAt(Dloss->ourImages[temp].bitmap,318,2,scenin);
blitAt(scenin,24,121+(i-at)*25);
SDL_UpdateRect(screen,24,121+(i-at)*25,scenin->w,scenin->h);
blitAt(scenin,25,121+(i-at)*25);
}
SDL_FreeSurface(scenin);
SDL_UpdateRect(screen, 25, 121, 351, 19*25);
}
int MapSel::whichWL(int nr)
{
@@ -1154,9 +1149,16 @@ void MapSel::init()
}
ourMaps.resize(pliczkiTemp.size());
boost::thread_group group;
int threads = std::max((unsigned int)1,boost::thread::hardware_concurrency());
for(int ti=0;ti<threads;ti++)
group.create_thread(boost::bind(&MapSel::processMaps,this,boost::ref(pliczkiTemp),ti,threads));
if(pliczkiTemp.size())
{
int threads = std::max((unsigned int)1,boost::thread::hardware_concurrency());
for(int ti=0;ti<threads;ti++)
group.create_thread(boost::bind(&MapSel::processMaps,this,boost::ref(pliczkiTemp),ti,threads));
}
else
{
tlog1 << "No maps in the /Maps directory!\n";
}
bg = BitmapHandler::loadBitmap("SCSELBCK.bmp");
SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255));
@@ -1709,7 +1711,13 @@ void CPreGame::showScenSel()
}
void CPreGame::showOptions()
{
ourOptions->show();
if (currentTab != ourOptions)
ourOptions->show();
else
{
currentTab->hide();
showScenSel();
}
}
void CPreGame::initNewMenu()
{
@@ -2049,6 +2057,8 @@ void CPreGame::scenHandleEv(SDL_Event& sEvent)
StartInfo CPreGame::runLoop()
{
SDL_Event sEvent;
ret.turnTime = 0;
while(run)
{
try