1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fourth part of sailing code.

Support for Shipyard (both for town and adventure map versions). Improved boat displaying code. Minor changes.
This commit is contained in:
Michał W. Urbańczyk
2009-07-26 03:33:13 +00:00
parent 7853a19b54
commit 9fd4b5bb62
23 changed files with 527 additions and 52 deletions

View File

@@ -1726,6 +1726,7 @@ const CGHeroInstance * CPlayerInterface::getWHero( int pos )
void CPlayerInterface::showRecruitmentDialog(const CGDwelling *dwelling, int level)
{
waitWhileDialog();
boost::unique_lock<boost::recursive_mutex> un(*pim);
std::vector<std::pair<int,int> > cres;
for(int i = 0; i < dwelling->creatures.size(); i++)
{
@@ -1744,6 +1745,30 @@ void CPlayerInterface::waitWhileDialog()
showingDialog->cond.wait(un);
}
void CPlayerInterface::showShipyardDialog(const IShipyard *obj)
{
boost::unique_lock<boost::recursive_mutex> un(*pim);
int state = obj->state();
std::vector<si32> cost;
obj->getBoatCost(cost);
CShipyardWindow *csw = new CShipyardWindow(cost, state, boost::bind(&CCallback::buildBoat, cb, obj));
pushInt(csw);
}
void CPlayerInterface::newObject( const CGObjectInstance * obj )
{
boost::unique_lock<boost::recursive_mutex> un(*pim);
CGI->mh->printObject(obj);
//we might have built a boat in shipyard in opened town screen
if(obj->ID == 8
&& LOCPLINT->castleInt
&& obj->pos-obj->getVisitableOffset() == LOCPLINT->castleInt->town->bestLocation())
{
CGI->soundh->playSound(soundBase::newBuilding);
LOCPLINT->castleInt->recreateBuildings();
}
}
void SystemOptions::setMusicVolume( int newVolume )
{
musicVolume = newVolume;