zabuzo
Well-Known Member
- Joined
- Jun 10, 2016
- Messages
- 238
- Reaction score
- 54
I'm using the elevation system to make the famous parcel trap:
Its just this 3 changes made by mkalo:
Game.cpp:
Tile.cpp:
Tile.h:
But there is a bug to get down on montains
I mean, i can get up normally
as u can see on this imgs:
But i cant get down, with 3,4 parcels, nothing works
Why?
Its just this 3 changes made by mkalo:
Game.cpp:
Code:
ReturnValue Game::internalMoveCreature(Creature* actor, Creature* creature, Cylinder* fromCylinder, Cylinder* toCylinder, uint32_t flags/* = 0*/)
{
//check if we can move the creature to the destination
ReturnValue ret = toCylinder->__queryAdd(0, creature, 1, flags);
if(ret != RET_NOERROR)
return ret;
//height check
Tile* toTile = toCylinder->getTile();
Tile* fromTile = fromCylinder->getTile();
if(toTile->getHeight() - fromTile->getHeight() >= 2) {
return RET_NOTPOSSIBLE;
}
fromCylinder->getTile()->moveCreature(actor, creature, toCylinder);
if(creature->getParent() != toCylinder)
return RET_NOERROR;
Item* toItem = NULL;
Cylinder* subCylinder = NULL;
int32_t n = 0, tmp = 0;
while((subCylinder = toCylinder->__queryDestination(tmp, creature, &toItem, flags)) != toCylinder)
{
toCylinder->getTile()->moveCreature(actor, creature, subCylinder);
if(creature->getParent() != subCylinder) //could happen if a script move the creature
break;
toCylinder = subCylinder;
flags = 0;
if(++n >= MAP_MAX_LAYERS) //to prevent infinite loop
break;
}
return RET_NOERROR;
}
Tile.cpp:
Code:
int32_t Tile::getHeight() {
int32_t height = 0;
if(ground) {
if(ground->hasProperty(HASHEIGHT)) {
++height;
}
}
if(const TileItemVector* items = getItemList()) {
for(ItemVector::const_iterator it = items->begin(); it != items->end(); ++it) {
if((*it)->hasProperty(HASHEIGHT)) {
++height;
}
}
}
return height;
}
Tile.h:
Code:
int32_t getHeight();
But there is a bug to get down on montains
I mean, i can get up normally
as u can see on this imgs:
Screenshot-from-2019-12-09-00-45-16 hosted at ImgBB
Image Screenshot-from-2019-12-09-00-45-16 hosted in ImgBB
ibb.co
Screenshot-from-2019-12-09-00-45-04 hosted at ImgBB
Image Screenshot-from-2019-12-09-00-45-04 hosted in ImgBB
ibb.co
But i cant get down, with 3,4 parcels, nothing works
Screenshot-from-2019-12-09-00-44-49 hosted at ImgBB
Image Screenshot-from-2019-12-09-00-44-49 hosted in ImgBB
ibb.co
Screenshot-from-2019-12-09-00-44-27 hosted at ImgBB
Image Screenshot-from-2019-12-09-00-44-27 hosted in ImgBB
ibb.co
Why?