mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
* fixed bug with disappearing head of a hero in adventure map
* some objects are no longer accessible from the top * minor fixes
This commit is contained in:
parent
70673674dc
commit
5ee37eeb3d
@ -6,6 +6,7 @@
|
|||||||
#include "mapHandler.h"
|
#include "mapHandler.h"
|
||||||
#include "CGameState.h"
|
#include "CGameState.h"
|
||||||
#include "hch/CObjectHandler.h"
|
#include "hch/CObjectHandler.h"
|
||||||
|
#include "hch/CDefObjInfoHandler.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -168,9 +169,85 @@ void CPathfinder::AddNeighbors(vector<Coordinate>* branch)
|
|||||||
|
|
||||||
if(c.g != -1 && c.h != -1)
|
if(c.g != -1 && c.h != -1)
|
||||||
{
|
{
|
||||||
vector<Coordinate> toAdd = *branch;
|
bool pass = true; //checking for allowed visiting direction
|
||||||
toAdd.push_back(c);
|
for(int b=0; b<CGI->mh->ttiles[i][j][node.z].tileInfo->visitableObjects.size(); ++b) //checking destination tile
|
||||||
Open.push(toAdd);
|
{
|
||||||
|
CGDefInfo * di = CGI->mh->ttiles[i][j][node.z].tileInfo->visitableObjects[b]->defInfo;
|
||||||
|
if( (i == node.x-1 && j == node.y-1) && !(di->visitDir & (1<<4)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x && j == node.y-1) && !(di->visitDir & (1<<5)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x+1 && j == node.y-1) && !(di->visitDir & (1<<6)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x+1 && j == node.y) && !(di->visitDir & (1<<7)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x+1 && j == node.y+1) && !(di->visitDir & (1<<0)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x && j == node.y+1) && !(di->visitDir & (1<<1)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x-1 && j == node.y+1) && !(di->visitDir & (1<<2)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x-1 && j == node.y) && !(di->visitDir & (1<<3)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int b=0; b<CGI->mh->ttiles[node.x][node.y][node.z].tileInfo->visitableObjects.size(); ++b) //checking source tile
|
||||||
|
{
|
||||||
|
CGDefInfo * di = CGI->mh->ttiles[node.x][node.y][node.z].tileInfo->visitableObjects[b]->defInfo;
|
||||||
|
if( (i == node.x-1 && j == node.y-1) && !(di->visitDir & (1<<0)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x && j == node.y-1) && !(di->visitDir & (1<<1)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x+1 && j == node.y-1) && !(di->visitDir & (1<<2)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x+1 && j == node.y) && !(di->visitDir & (1<<3)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x+1 && j == node.y+1) && !(di->visitDir & (1<<4)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x && j == node.y+1) && !(di->visitDir & (1<<5)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x-1 && j == node.y+1) && !(di->visitDir & (1<<6)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
if( (i == node.x-1 && j == node.y) && !(di->visitDir & (1<<7)) )
|
||||||
|
{
|
||||||
|
pass = false; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pass)
|
||||||
|
{
|
||||||
|
vector<Coordinate> toAdd = *branch;
|
||||||
|
toAdd.push_back(c);
|
||||||
|
Open.push(toAdd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//delete c;
|
//delete c;
|
||||||
}
|
}
|
||||||
|
@ -1519,6 +1519,16 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
delObjRect(hp.x, hp.y-1, hp.z, ho->id);
|
delObjRect(hp.x, hp.y-1, hp.z, ho->id);
|
||||||
delObjRect(hp.x, hp.y, hp.z, ho->id);
|
delObjRect(hp.x, hp.y, hp.z, ho->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//restoring good order of objects
|
||||||
|
std::stable_sort(CGI->mh->ttiles[details.dst.x-2][details.dst.y-1][details.dst.z].objects.begin(), CGI->mh->ttiles[details.dst.x-2][details.dst.y-1][details.dst.z].objects.end(), ocmptwo_cgin);
|
||||||
|
std::stable_sort(CGI->mh->ttiles[details.dst.x-1][details.dst.y-1][details.dst.z].objects.begin(), CGI->mh->ttiles[details.dst.x-1][details.dst.y-1][details.dst.z].objects.end(), ocmptwo_cgin);
|
||||||
|
std::stable_sort(CGI->mh->ttiles[details.dst.x][details.dst.y-1][details.dst.z].objects.begin(), CGI->mh->ttiles[details.dst.x][details.dst.y-1][details.dst.z].objects.end(), ocmptwo_cgin);
|
||||||
|
|
||||||
|
std::stable_sort(CGI->mh->ttiles[details.dst.x-2][details.dst.y][details.dst.z].objects.begin(), CGI->mh->ttiles[details.dst.x-2][details.dst.y][details.dst.z].objects.end(), ocmptwo_cgin);
|
||||||
|
std::stable_sort(CGI->mh->ttiles[details.dst.x-1][details.dst.y][details.dst.z].objects.begin(), CGI->mh->ttiles[details.dst.x-1][details.dst.y][details.dst.z].objects.end(), ocmptwo_cgin);
|
||||||
|
std::stable_sort(CGI->mh->ttiles[details.dst.x][details.dst.y][details.dst.z].objects.begin(), CGI->mh->ttiles[details.dst.x][details.dst.y][details.dst.z].objects.end(), ocmptwo_cgin);
|
||||||
|
|
||||||
ho->isStanding = true;
|
ho->isStanding = true;
|
||||||
//move finished
|
//move finished
|
||||||
adventureInt->minimap.draw();
|
adventureInt->minimap.draw();
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
49 151
|
49 151
|
||||||
49 100 151
|
49 100 151
|
||||||
15 83 117 185
|
15 83 117 185
|
||||||
17 49 100 151 185
|
15 49 100 151 185
|
||||||
17 49 83 117 151 185
|
15 49 83 117 151 185
|
||||||
17 49 83 100 117 151 185
|
15 49 83 100 117 151 185
|
||||||
//tight_formation
|
//tight_formation
|
||||||
//atacker
|
//atacker
|
||||||
86
|
86
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "CLodHandler.h"
|
#include "CLodHandler.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "../lib/VCMI_Lib.h"
|
#include "../lib/VCMI_Lib.h"
|
||||||
|
#include <set>
|
||||||
extern CLodHandler * bitmaph;
|
extern CLodHandler * bitmaph;
|
||||||
bool CGDefInfo::isVisitable()
|
bool CGDefInfo::isVisitable()
|
||||||
{
|
{
|
||||||
@ -26,6 +27,7 @@ void CDefObjInfoHandler::load()
|
|||||||
std::istringstream inp(bitmaph->getTextFile("ZOBJCTS.TXT"));
|
std::istringstream inp(bitmaph->getTextFile("ZOBJCTS.TXT"));
|
||||||
int objNumber;
|
int objNumber;
|
||||||
inp>>objNumber;
|
inp>>objNumber;
|
||||||
|
std::set<int> ids;
|
||||||
for(int hh=0; hh<objNumber; ++hh)
|
for(int hh=0; hh<objNumber; ++hh)
|
||||||
{
|
{
|
||||||
CGDefInfo* nobj = new CGDefInfo();
|
CGDefInfo* nobj = new CGDefInfo();
|
||||||
@ -65,6 +67,13 @@ void CDefObjInfoHandler::load()
|
|||||||
inp>>nobj->id;
|
inp>>nobj->id;
|
||||||
inp>>nobj->subid;
|
inp>>nobj->subid;
|
||||||
inp>>nobj->type;
|
inp>>nobj->type;
|
||||||
|
if(nobj->type == 2 || nobj->type == 3 || nobj->type == 4 || nobj->type == 5 || nobj->id == 111) //creature, hero, artifact, resource or whripool
|
||||||
|
{
|
||||||
|
nobj->visitDir = 0xff;
|
||||||
|
ids.insert(nobj->id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nobj->visitDir = (8|16|32|64|128); //disabled visiting from the top
|
||||||
inp>>nobj->printPriority;
|
inp>>nobj->printPriority;
|
||||||
gobjs[nobj->id][nobj->subid] = nobj;
|
gobjs[nobj->id][nobj->subid] = nobj;
|
||||||
if(nobj->id==98)
|
if(nobj->id==98)
|
||||||
|
@ -91,7 +91,7 @@ public:
|
|||||||
int portrait; //may be custom
|
int portrait; //may be custom
|
||||||
int mana; // remaining spell points
|
int mana; // remaining spell points
|
||||||
std::vector<int> primSkills; //0-attack, 1-defence, 2-spell power, 3-knowledge
|
std::vector<int> primSkills; //0-attack, 1-defence, 2-spell power, 3-knowledge
|
||||||
std::vector<std::pair<int,int> > secSkills; //first - ID of skill, second - level of skill (0 - basic, 1 - adv., 2 - expert)
|
std::vector<std::pair<int,int> > secSkills; //first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
|
||||||
int movement; //remaining movement points
|
int movement; //remaining movement points
|
||||||
int identifier; //from the map file
|
int identifier; //from the map file
|
||||||
bool sex;
|
bool sex;
|
||||||
|
4
map.cpp
4
map.cpp
@ -1725,6 +1725,10 @@ void Mapa::readDefInfo( unsigned char * bufor, int &i)
|
|||||||
vinya->visitMap[zi] = reverse(bytes[6+zi]);
|
vinya->visitMap[zi] = reverse(bytes[6+zi]);
|
||||||
}
|
}
|
||||||
i+=16;
|
i+=16;
|
||||||
|
if(vinya->id!=34)
|
||||||
|
vinya->visitDir = VLC->dobjinfo->gobjs[vinya->id][vinya->subid]->visitDir;
|
||||||
|
else
|
||||||
|
vinya->visitDir = 0xff;
|
||||||
defy.push_back(vinya); // add this def to the vector
|
defy.push_back(vinya); // add this def to the vector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ void CGameHandler::changePrimSkill(int ID, int which, int val, bool abs)
|
|||||||
for(int i=0;i<SKILL_QUANTITY;i++) none.insert(i);
|
for(int i=0;i<SKILL_QUANTITY;i++) none.insert(i);
|
||||||
for(unsigned i=0;i<hero->secSkills.size();i++)
|
for(unsigned i=0;i<hero->secSkills.size();i++)
|
||||||
{
|
{
|
||||||
if(hero->secSkills[i].second < 2)
|
if(hero->secSkills[i].second < 3)
|
||||||
basicAndAdv.insert(hero->secSkills[i].first);
|
basicAndAdv.insert(hero->secSkills[i].first);
|
||||||
else
|
else
|
||||||
expert.insert(hero->secSkills[i].first);
|
expert.insert(hero->secSkills[i].first);
|
||||||
|
Loading…
Reference in New Issue
Block a user