mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
- removed some no longer needed code from map handler - blocked "back" button on campaign map screen if some of scenarios are already completed
This commit is contained in:
parent
5e812492e0
commit
1f325bafb3
@ -3136,6 +3136,8 @@ void CBonusSelection::init()
|
|||||||
startB = new CAdventureMapButton("", "", boost::bind(&CBonusSelection::startMap, this), 475, 536, "CBBEGIB.DEF", SDLK_RETURN);
|
startB = new CAdventureMapButton("", "", boost::bind(&CBonusSelection::startMap, this), 475, 536, "CBBEGIB.DEF", SDLK_RETURN);
|
||||||
restartB = new CAdventureMapButton("", "", boost::bind(&CBonusSelection::restartMap, this), 475, 536, "CBRESTB.DEF", SDLK_RETURN);
|
restartB = new CAdventureMapButton("", "", boost::bind(&CBonusSelection::restartMap, this), 475, 536, "CBRESTB.DEF", SDLK_RETURN);
|
||||||
backB = new CAdventureMapButton("", "", boost::bind(&CBonusSelection::goBack, this), 624, 536, "CBCANCB.DEF", SDLK_ESCAPE);
|
backB = new CAdventureMapButton("", "", boost::bind(&CBonusSelection::goBack, this), 624, 536, "CBCANCB.DEF", SDLK_ESCAPE);
|
||||||
|
// block back button for in-progress campaigns. May not be H3 behaviour but avoids the crash
|
||||||
|
backB->block(!ourCampaign->mapsConquered.empty());
|
||||||
|
|
||||||
//campaign name
|
//campaign name
|
||||||
if (ourCampaign->camp->header.name.length())
|
if (ourCampaign->camp->header.name.length())
|
||||||
|
@ -492,7 +492,6 @@ void HeroRecruited::applyCl( CClient *cl )
|
|||||||
logNetwork->errorStream() << "Something wrong with hero recruited!";
|
logNetwork->errorStream() << "Something wrong with hero recruited!";
|
||||||
}
|
}
|
||||||
|
|
||||||
CGI->mh->initHeroDef(h);
|
|
||||||
CGI->mh->printObject(h);
|
CGI->mh->printObject(h);
|
||||||
|
|
||||||
if(vstd::contains(cl->playerint,h->tempOwner))
|
if(vstd::contains(cl->playerint,h->tempOwner))
|
||||||
@ -506,7 +505,6 @@ void HeroRecruited::applyCl( CClient *cl )
|
|||||||
void GiveHero::applyCl( CClient *cl )
|
void GiveHero::applyCl( CClient *cl )
|
||||||
{
|
{
|
||||||
CGHeroInstance *h = GS(cl)->getHero(id);
|
CGHeroInstance *h = GS(cl)->getHero(id);
|
||||||
CGI->mh->initHeroDef(h);
|
|
||||||
CGI->mh->printObject(h);
|
CGI->mh->printObject(h);
|
||||||
cl->playerint[h->tempOwner]->heroCreated(h);
|
cl->playerint[h->tempOwner]->heroCreated(h);
|
||||||
}
|
}
|
||||||
|
@ -314,11 +314,6 @@ void CMapHandler::initObjectRects()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapHandler::initHeroDef(const CGHeroInstance * h)
|
|
||||||
{
|
|
||||||
graphics->advmapobjGraphics[h->appearance.animationFile] = graphics->flags1[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMapHandler::init()
|
void CMapHandler::init()
|
||||||
{
|
{
|
||||||
CStopWatch th;
|
CStopWatch th;
|
||||||
@ -356,14 +351,6 @@ void CMapHandler::init()
|
|||||||
offsetX = (mapW - (2*frameW+1)*32)/2;
|
offsetX = (mapW - (2*frameW+1)*32)/2;
|
||||||
offsetY = (mapH - (2*frameH+1)*32)/2;
|
offsetY = (mapH - (2*frameH+1)*32)/2;
|
||||||
|
|
||||||
for(auto & elem : map->heroesOnMap)
|
|
||||||
{
|
|
||||||
if( !graphics->getDef(elem) )
|
|
||||||
{
|
|
||||||
initHeroDef(elem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
prepareFOWDefs();
|
prepareFOWDefs();
|
||||||
roadsRiverTerrainInit(); //road's and river's DefHandlers; and simple values initialization
|
roadsRiverTerrainInit(); //road's and river's DefHandlers; and simple values initialization
|
||||||
borderAndTerrainBitmapInit();
|
borderAndTerrainBitmapInit();
|
||||||
@ -894,25 +881,23 @@ bool CMapHandler::printObject(const CGObjectInstance *obj)
|
|||||||
|
|
||||||
bool CMapHandler::hideObject(const CGObjectInstance *obj)
|
bool CMapHandler::hideObject(const CGObjectInstance *obj)
|
||||||
{
|
{
|
||||||
CDefEssential * curd = graphics->getDef(obj);
|
for (size_t i=0; i<map->width; i++)
|
||||||
if(!curd) return false;
|
|
||||||
const SDL_Surface *bitmap = curd->ourImages[0].bitmap;
|
|
||||||
for(int fx=0; fx<bitmap->w/32; ++fx)
|
|
||||||
{
|
{
|
||||||
for(int fy=0; fy<bitmap->h/32; ++fy)
|
for (size_t j=0; j<map->height; j++)
|
||||||
{
|
{
|
||||||
if((obj->pos.x + fx - bitmap->w/32+1)>=0 && (obj->pos.x + fx - bitmap->w/32+1)<ttiles.size()-frameW && (obj->pos.y + fy - bitmap->h/32+1)>=0 && (obj->pos.y + fy - bitmap->h/32+1)<ttiles[0].size()-frameH)
|
for (size_t k=0; k<(map->twoLevel ? 2 : 1); k++)
|
||||||
{
|
{
|
||||||
std::vector < std::pair<const CGObjectInstance*,SDL_Rect> > & ctile = ttiles[obj->pos.x + fx - bitmap->w/32+1][obj->pos.y + fy - bitmap->h/32+1][obj->pos.z].objects;
|
for(size_t x=0; x < ttiles[i][j][k].objects.size(); x++)
|
||||||
for(size_t dd=0; dd < ctile.size(); ++dd)
|
|
||||||
{
|
{
|
||||||
if(ctile[dd].first->id==obj->id)
|
if (ttiles[i][j][k].objects[x].first->id == obj->id)
|
||||||
ctile.erase(ctile.begin() + dd);
|
{
|
||||||
|
ttiles[i][j][k].objects.erase(ttiles[i][j][k].objects.begin() + x);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} // for(int fy=0; fy<bitmap->h/32; ++fy)
|
}
|
||||||
} //for(int fx=0; fx<bitmap->w/32; ++fx)
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool CMapHandler::removeObject(CGObjectInstance *obj)
|
bool CMapHandler::removeObject(CGObjectInstance *obj)
|
||||||
|
@ -117,7 +117,6 @@ public:
|
|||||||
bool printObject(const CGObjectInstance * obj); //puts appropriate things to ttiles, so obj will be visible on map
|
bool printObject(const CGObjectInstance * obj); //puts appropriate things to ttiles, so obj will be visible on map
|
||||||
bool hideObject(const CGObjectInstance * obj); //removes appropriate things from ttiles, so obj will be no longer visible on map (but still will exist)
|
bool hideObject(const CGObjectInstance * obj); //removes appropriate things from ttiles, so obj will be no longer visible on map (but still will exist)
|
||||||
bool removeObject(CGObjectInstance * obj); //removes object from each place in VCMI (I hope)
|
bool removeObject(CGObjectInstance * obj); //removes object from each place in VCMI (I hope)
|
||||||
void initHeroDef(const CGHeroInstance * h);
|
|
||||||
void init();
|
void init();
|
||||||
void calculateBlockedPos();
|
void calculateBlockedPos();
|
||||||
void initObjectRects();
|
void initObjectRects();
|
||||||
|
@ -550,6 +550,7 @@ DLL_LINKAGE void GiveHero::applyGs( CGameState *gs )
|
|||||||
//bonus system
|
//bonus system
|
||||||
h->detachFrom(&gs->globalEffects);
|
h->detachFrom(&gs->globalEffects);
|
||||||
h->attachTo(gs->getPlayer(player));
|
h->attachTo(gs->getPlayer(player));
|
||||||
|
h->appearance = VLC->dobjinfo->pickCandidates(Obj::HERO, h->type->heroClass->id).front();
|
||||||
|
|
||||||
gs->map->removeBlockVisTiles(h,true);
|
gs->map->removeBlockVisTiles(h,true);
|
||||||
h->setOwner(player);
|
h->setOwner(player);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user