mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-21 12:06:49 +02:00
* campaign against magic numbers
* ArtifactID was misleading and wrongly used in one place -- renamed and fixed * minor changes
This commit is contained in:
parent
3fcba4fb5c
commit
6a81c8b1af
@ -385,20 +385,20 @@ ui64 evaluateDanger(const CGObjectInstance *obj)
|
|||||||
|
|
||||||
switch(obj->ID)
|
switch(obj->ID)
|
||||||
{
|
{
|
||||||
case GameConstants::HEROI_TYPE:
|
case Obj::HERO:
|
||||||
{
|
{
|
||||||
InfoAboutHero iah;
|
InfoAboutHero iah;
|
||||||
cb->getHeroInfo(obj, iah);
|
cb->getHeroInfo(obj, iah);
|
||||||
return iah.army.getStrength();
|
return iah.army.getStrength();
|
||||||
}
|
}
|
||||||
case GameConstants::TOWNI_TYPE:
|
case Obj::TOWN:
|
||||||
case Obj::GARRISON: case Obj::GARRISON2: //garrison
|
case Obj::GARRISON: case Obj::GARRISON2: //garrison
|
||||||
{
|
{
|
||||||
InfoAboutTown iat;
|
InfoAboutTown iat;
|
||||||
cb->getTownInfo(obj, iat);
|
cb->getTownInfo(obj, iat);
|
||||||
return iat.army.getStrength();
|
return iat.army.getStrength();
|
||||||
}
|
}
|
||||||
case GameConstants::CREI_TYPE:
|
case Obj::MONSTER:
|
||||||
{
|
{
|
||||||
//TODO!!!!!!!!
|
//TODO!!!!!!!!
|
||||||
const CGCreature *cre = dynamic_cast<const CGCreature*>(obj);
|
const CGCreature *cre = dynamic_cast<const CGCreature*>(obj);
|
||||||
@ -711,7 +711,7 @@ void VCAI::objectRemoved(const CGObjectInstance *obj)
|
|||||||
//there are other places where CGObjectinstance ptrs are stored...
|
//there are other places where CGObjectinstance ptrs are stored...
|
||||||
//
|
//
|
||||||
|
|
||||||
if(obj->ID == GameConstants::HEROI_TYPE && obj->tempOwner == playerID)
|
if(obj->ID == Obj::HERO && obj->tempOwner == playerID)
|
||||||
{
|
{
|
||||||
lostHero(cb->getHero(obj->id)); //we can promote, since objectRemoved is killed just before actual deletion
|
lostHero(cb->getHero(obj->id)); //we can promote, since objectRemoved is killed just before actual deletion
|
||||||
}
|
}
|
||||||
@ -1100,7 +1100,7 @@ void VCAI::performObjectInteraction(const CGObjectInstance * obj, HeroPtr h)
|
|||||||
recruitCreatures (dynamic_cast<const CGDwelling *>(obj));
|
recruitCreatures (dynamic_cast<const CGDwelling *>(obj));
|
||||||
checkHeroArmy (h);
|
checkHeroArmy (h);
|
||||||
break;
|
break;
|
||||||
case GameConstants::TOWNI_TYPE:
|
case Obj::TOWN:
|
||||||
moveCreaturesToHero (dynamic_cast<const CGTownInstance *>(obj));
|
moveCreaturesToHero (dynamic_cast<const CGTownInstance *>(obj));
|
||||||
townVisitsThisWeek[h].push_back(h->visitedTown);
|
townVisitsThisWeek[h].push_back(h->visitedTown);
|
||||||
break;
|
break;
|
||||||
@ -1429,7 +1429,7 @@ std::vector<const CGObjectInstance *> VCAI::getPossibleDestinations(HeroPtr h)
|
|||||||
const CGObjectInstance *topObj = cb->getVisitableObjs(pos).back(); //it may be hero visiting this obj
|
const CGObjectInstance *topObj = cb->getVisitableObjs(pos).back(); //it may be hero visiting this obj
|
||||||
//we don't try visiting object on which allied or owned hero stands
|
//we don't try visiting object on which allied or owned hero stands
|
||||||
// -> it will just trigger exchange windows and AI will be confused that obj behind doesn't get visited
|
// -> it will just trigger exchange windows and AI will be confused that obj behind doesn't get visited
|
||||||
if(topObj->ID == GameConstants::HEROI_TYPE && cb->getPlayerRelations(h->tempOwner, topObj->tempOwner) != 0)
|
if(topObj->ID == Obj::HERO && cb->getPlayerRelations(h->tempOwner, topObj->tempOwner) != 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1699,7 +1699,7 @@ bool VCAI::isAccessibleForHero(const int3 & pos, HeroPtr h, bool includeAllies /
|
|||||||
{ //don't visit tile occupied by allied hero
|
{ //don't visit tile occupied by allied hero
|
||||||
BOOST_FOREACH (auto obj, cb->getVisitableObjs(pos))
|
BOOST_FOREACH (auto obj, cb->getVisitableObjs(pos))
|
||||||
{
|
{
|
||||||
if (obj->ID == GameConstants::HEROI_TYPE && obj->tempOwner == h->tempOwner && obj != h)
|
if (obj->ID == Obj::HERO && obj->tempOwner == h->tempOwner && obj != h)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2883,7 +2883,7 @@ TSubgoal CGoal::whatToDoToAchieve()
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto topObj = backOrNull(cb->getVisitableObjs(tileToHit));
|
auto topObj = backOrNull(cb->getVisitableObjs(tileToHit));
|
||||||
if(topObj && topObj->ID == GameConstants::HEROI_TYPE && cb->getPlayerRelations(h->tempOwner, topObj->tempOwner) != 0)
|
if(topObj && topObj->ID == Obj::HERO && cb->getPlayerRelations(h->tempOwner, topObj->tempOwner) != 0)
|
||||||
{
|
{
|
||||||
std::string problem = boost::str(boost::format("%s stands in the way of %s.\n") % topObj->getHoverText() % h->getHoverText());
|
std::string problem = boost::str(boost::format("%s stands in the way of %s.\n") % topObj->getHoverText() % h->getHoverText());
|
||||||
throw cannotFulfillGoalException(problem);
|
throw cannotFulfillGoalException(problem);
|
||||||
@ -2996,7 +2996,7 @@ TSubgoal CGoal::whatToDoToAchieve()
|
|||||||
case DIG_AT_TILE:
|
case DIG_AT_TILE:
|
||||||
{
|
{
|
||||||
const CGObjectInstance *firstObj = frontOrNull(cb->getVisitableObjs(tile));
|
const CGObjectInstance *firstObj = frontOrNull(cb->getVisitableObjs(tile));
|
||||||
if(firstObj && firstObj->ID == GameConstants::HEROI_TYPE && firstObj->tempOwner == ai->playerID) //we have hero at dest
|
if(firstObj && firstObj->ID == Obj::HERO && firstObj->tempOwner == ai->playerID) //we have hero at dest
|
||||||
{
|
{
|
||||||
const CGHeroInstance *h = dynamic_cast<const CGHeroInstance *>(firstObj);
|
const CGHeroInstance *h = dynamic_cast<const CGHeroInstance *>(firstObj);
|
||||||
return CGoal(*this).sethero(h).setisElementar(true);
|
return CGoal(*this).sethero(h).setisElementar(true);
|
||||||
@ -3022,7 +3022,7 @@ TSubgoal CGoal::whatToDoToAchieve()
|
|||||||
{
|
{
|
||||||
if(const IMarket *m = IMarket::castFrom(obj, false))
|
if(const IMarket *m = IMarket::castFrom(obj, false))
|
||||||
{
|
{
|
||||||
if(obj->ID == GameConstants::TOWNI_TYPE && obj->tempOwner == ai->playerID && m->allowsTrade(EMarketMode::RESOURCE_RESOURCE))
|
if(obj->ID == Obj::TOWN && obj->tempOwner == ai->playerID && m->allowsTrade(EMarketMode::RESOURCE_RESOURCE))
|
||||||
markets.push_back(m);
|
markets.push_back(m);
|
||||||
else if(obj->ID == Obj::TRADING_POST) //TODO a moze po prostu test na pozwalanie handlu?
|
else if(obj->ID == Obj::TRADING_POST) //TODO a moze po prostu test na pozwalanie handlu?
|
||||||
markets.push_back(m);
|
markets.push_back(m);
|
||||||
@ -3036,7 +3036,7 @@ TSubgoal CGoal::whatToDoToAchieve()
|
|||||||
|
|
||||||
markets.erase(boost::remove_if(markets, [](const IMarket *market) -> bool
|
markets.erase(boost::remove_if(markets, [](const IMarket *market) -> bool
|
||||||
{
|
{
|
||||||
return !(market->o->ID == GameConstants::TOWNI_TYPE && market->o->tempOwner == ai->playerID)
|
return !(market->o->ID == Obj::TOWN && market->o->tempOwner == ai->playerID)
|
||||||
&& !ai->isAccessible(market->o->visitablePos());
|
&& !ai->isAccessible(market->o->visitablePos());
|
||||||
}),markets.end());
|
}),markets.end());
|
||||||
|
|
||||||
@ -3160,7 +3160,7 @@ TSubgoal CGoal::whatToDoToAchieve()
|
|||||||
ai->retreiveVisitableObjs(objs);
|
ai->retreiveVisitableObjs(objs);
|
||||||
erase_if(objs, [&](const CGObjectInstance *obj)
|
erase_if(objs, [&](const CGObjectInstance *obj)
|
||||||
{
|
{
|
||||||
return (obj->ID != GameConstants::TOWNI_TYPE && obj->ID != GameConstants::HEROI_TYPE) //not town/hero
|
return (obj->ID != Obj::TOWN && obj->ID != Obj::HERO) //not town/hero
|
||||||
|| cb->getPlayerRelations(ai->playerID, obj->tempOwner) != 0; //not enemy
|
|| cb->getPlayerRelations(ai->playerID, obj->tempOwner) != 0; //not enemy
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -3180,7 +3180,7 @@ TSubgoal CGoal::whatToDoToAchieve()
|
|||||||
{
|
{
|
||||||
if(ai->isAccessibleForHero(obj->visitablePos(), h))
|
if(ai->isAccessibleForHero(obj->visitablePos(), h))
|
||||||
{
|
{
|
||||||
if (obj->ID == GameConstants::HEROI_TYPE)
|
if (obj->ID == Obj::HERO)
|
||||||
return CGoal(VISIT_HERO).sethero(h).setobjid(obj->id).setisAbstract(true); //track enemy hero
|
return CGoal(VISIT_HERO).sethero(h).setobjid(obj->id).setisAbstract(true); //track enemy hero
|
||||||
else
|
else
|
||||||
return CGoal(VISIT_TILE).sethero(h).settile(obj->visitablePos());
|
return CGoal(VISIT_TILE).sethero(h).settile(obj->visitablePos());
|
||||||
@ -3619,7 +3619,7 @@ int3 SectorMap::firstTileToGet(HeroPtr h, crint3 dst)
|
|||||||
ai->retreiveVisitableObjs(visObjs, true);
|
ai->retreiveVisitableObjs(visObjs, true);
|
||||||
BOOST_FOREACH(const CGObjectInstance *obj, visObjs)
|
BOOST_FOREACH(const CGObjectInstance *obj, visObjs)
|
||||||
{
|
{
|
||||||
if(obj->ID != GameConstants::TOWNI_TYPE) //towns were handled in the previous loop
|
if(obj->ID != Obj::TOWN) //towns were handled in the previous loop
|
||||||
if(const IShipyard *shipyard = IShipyard::castFrom(obj))
|
if(const IShipyard *shipyard = IShipyard::castFrom(obj))
|
||||||
shipyards.push_back(shipyard);
|
shipyards.push_back(shipyard);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ int CCallback::selectionMade(int selection, int queryID)
|
|||||||
|
|
||||||
void CCallback::recruitCreatures(const CGObjectInstance *obj, ui32 ID, ui32 amount, si32 level/*=-1*/)
|
void CCallback::recruitCreatures(const CGObjectInstance *obj, ui32 ID, ui32 amount, si32 level/*=-1*/)
|
||||||
{
|
{
|
||||||
if(player!=obj->tempOwner && obj->ID != 106)
|
if(player!=obj->tempOwner && obj->ID != Obj::WAR_MACHINE_FACTORY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RecruitCreatures pack(obj->id,ID,amount,level);
|
RecruitCreatures pack(obj->id,ID,amount,level);
|
||||||
@ -239,7 +239,7 @@ void CCallback::setSelection(const CArmedInstance * obj)
|
|||||||
ss.id = obj->id;
|
ss.id = obj->id;
|
||||||
sendRequest(&(CPackForClient&)ss);
|
sendRequest(&(CPackForClient&)ss);
|
||||||
|
|
||||||
if(obj->ID == GameConstants::HEROI_TYPE)
|
if(obj->ID == Obj::HERO)
|
||||||
{
|
{
|
||||||
if(cl->pathInfo->hero != obj) //calculate new paths only if we selected a different hero
|
if(cl->pathInfo->hero != obj) //calculate new paths only if we selected a different hero
|
||||||
cl->calculatePaths(static_cast<const CGHeroInstance *>(obj));
|
cl->calculatePaths(static_cast<const CGHeroInstance *>(obj));
|
||||||
|
@ -357,7 +357,7 @@ const SDL_Color & CMinimapInstance::getTileColor(const int3 & pos)
|
|||||||
BOOST_FOREACH(const CGObjectInstance *obj, tile->blockingObjects)
|
BOOST_FOREACH(const CGObjectInstance *obj, tile->blockingObjects)
|
||||||
{
|
{
|
||||||
//heroes will be blitted later
|
//heroes will be blitted later
|
||||||
if (obj->ID == GameConstants::HEROI_TYPE)
|
if (obj->ID == Obj::HERO)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int player = obj->getOwner();
|
int player = obj->getOwner();
|
||||||
|
@ -994,7 +994,7 @@ void CAdvMapInt::select(const CArmedInstance *sel, bool centerView /*= true*/)
|
|||||||
centerOn(sel);
|
centerOn(sel);
|
||||||
|
|
||||||
terrain.currentPath = NULL;
|
terrain.currentPath = NULL;
|
||||||
if(sel->ID==GameConstants::TOWNI_TYPE)
|
if(sel->ID==Obj::TOWN)
|
||||||
{
|
{
|
||||||
auto town = dynamic_cast<const CGTownInstance*>(sel);
|
auto town = dynamic_cast<const CGTownInstance*>(sel);
|
||||||
|
|
||||||
@ -1118,7 +1118,7 @@ const CGObjectInstance* CAdvMapInt::getBlockingObject(const int3 &mapPos)
|
|||||||
if (bobjs.empty())
|
if (bobjs.empty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (bobjs.back()->ID == GameConstants::HEROI_TYPE)
|
if (bobjs.back()->ID == Obj::HERO)
|
||||||
return bobjs.back();
|
return bobjs.back();
|
||||||
else
|
else
|
||||||
return bobjs.front();
|
return bobjs.front();
|
||||||
@ -1153,10 +1153,10 @@ void CAdvMapInt::tileLClicked(const int3 &mapPos)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//check if we can select this object
|
//check if we can select this object
|
||||||
bool canSelect = topBlocking && topBlocking->ID == GameConstants::HEROI_TYPE && topBlocking->tempOwner == LOCPLINT->playerID;
|
bool canSelect = topBlocking && topBlocking->ID == Obj::HERO && topBlocking->tempOwner == LOCPLINT->playerID;
|
||||||
canSelect |= topBlocking && topBlocking->ID == GameConstants::TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, topBlocking->tempOwner);
|
canSelect |= topBlocking && topBlocking->ID == Obj::TOWN && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, topBlocking->tempOwner);
|
||||||
|
|
||||||
if (selection->ID != GameConstants::HEROI_TYPE) //hero is not selected (presumably town)
|
if (selection->ID != Obj::HERO) //hero is not selected (presumably town)
|
||||||
{
|
{
|
||||||
assert(!terrain.currentPath); //path can be active only when hero is selected
|
assert(!terrain.currentPath); //path can be active only when hero is selected
|
||||||
if(selection == topBlocking) //selected town clicked
|
if(selection == topBlocking) //selected town clicked
|
||||||
@ -1246,7 +1246,7 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
|||||||
switch(spellBeingCasted->id)
|
switch(spellBeingCasted->id)
|
||||||
{
|
{
|
||||||
case Spells::SCUTTLE_BOAT:
|
case Spells::SCUTTLE_BOAT:
|
||||||
if(objAtTile && objAtTile->ID == 8)
|
if(objAtTile && objAtTile->ID == Obj::BOAT)
|
||||||
CCS->curh->changeGraphic(0, 42);
|
CCS->curh->changeGraphic(0, 42);
|
||||||
else
|
else
|
||||||
CCS->curh->changeGraphic(0, 0);
|
CCS->curh->changeGraphic(0, 0);
|
||||||
@ -1266,13 +1266,13 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
|||||||
|
|
||||||
const bool guardingCreature = CGI->mh->map->isInTheMap(LOCPLINT->cb->guardingCreaturePosition(mapPos));
|
const bool guardingCreature = CGI->mh->map->isInTheMap(LOCPLINT->cb->guardingCreaturePosition(mapPos));
|
||||||
|
|
||||||
if(selection->ID == GameConstants::TOWNI_TYPE)
|
if(selection->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
if(objAtTile)
|
if(objAtTile)
|
||||||
{
|
{
|
||||||
if(objAtTile->ID == GameConstants::TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, objAtTile->tempOwner))
|
if(objAtTile->ID == Obj::TOWN && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, objAtTile->tempOwner))
|
||||||
CCS->curh->changeGraphic(0, 3);
|
CCS->curh->changeGraphic(0, 3);
|
||||||
else if(objAtTile->ID == GameConstants::HEROI_TYPE && objAtTile->tempOwner == LOCPLINT->playerID)
|
else if(objAtTile->ID == Obj::HERO && objAtTile->tempOwner == LOCPLINT->playerID)
|
||||||
CCS->curh->changeGraphic(0, 2);
|
CCS->curh->changeGraphic(0, 2);
|
||||||
else
|
else
|
||||||
CCS->curh->changeGraphic(0, 0);
|
CCS->curh->changeGraphic(0, 0);
|
||||||
@ -1286,7 +1286,7 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
|||||||
|
|
||||||
if(objAtTile)
|
if(objAtTile)
|
||||||
{
|
{
|
||||||
if(objAtTile->ID == GameConstants::HEROI_TYPE)
|
if(objAtTile->ID == Obj::HERO)
|
||||||
{
|
{
|
||||||
if(!LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, objAtTile->tempOwner)) //enemy hero
|
if(!LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, objAtTile->tempOwner)) //enemy hero
|
||||||
{
|
{
|
||||||
@ -1305,7 +1305,7 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
|||||||
CCS->curh->changeGraphic(0, 2);
|
CCS->curh->changeGraphic(0, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(objAtTile->ID == GameConstants::TOWNI_TYPE)
|
else if(objAtTile->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
if(!LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, objAtTile->tempOwner)) //enemy town
|
if(!LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, objAtTile->tempOwner)) //enemy town
|
||||||
{
|
{
|
||||||
@ -1333,14 +1333,14 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
|||||||
CCS->curh->changeGraphic(0, 3);
|
CCS->curh->changeGraphic(0, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(objAtTile->ID == 8) //boat
|
else if(objAtTile->ID == Obj::BOAT)
|
||||||
{
|
{
|
||||||
if(accessible)
|
if(accessible)
|
||||||
CCS->curh->changeGraphic(0, 6 + turns*6);
|
CCS->curh->changeGraphic(0, 6 + turns*6);
|
||||||
else
|
else
|
||||||
CCS->curh->changeGraphic(0, 0);
|
CCS->curh->changeGraphic(0, 0);
|
||||||
}
|
}
|
||||||
else if (objAtTile->ID == 33 || objAtTile->ID == 219) // Garrison
|
else if (objAtTile->ID == Obj::GARRISON || objAtTile->ID == Obj::GARRISON2)
|
||||||
{
|
{
|
||||||
if (accessible)
|
if (accessible)
|
||||||
{
|
{
|
||||||
@ -1461,7 +1461,7 @@ void CAdvMapInt::leaveCastingMode(bool cast /*= false*/, int3 dest /*= int3(-1,
|
|||||||
|
|
||||||
const CGHeroInstance * CAdvMapInt::curHero() const
|
const CGHeroInstance * CAdvMapInt::curHero() const
|
||||||
{
|
{
|
||||||
if(selection && selection->ID == GameConstants::HEROI_TYPE)
|
if(selection && selection->ID == Obj::HERO)
|
||||||
return static_cast<const CGHeroInstance *>(selection);
|
return static_cast<const CGHeroInstance *>(selection);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1469,7 +1469,7 @@ const CGHeroInstance * CAdvMapInt::curHero() const
|
|||||||
|
|
||||||
const CGTownInstance * CAdvMapInt::curTown() const
|
const CGTownInstance * CAdvMapInt::curTown() const
|
||||||
{
|
{
|
||||||
if(selection && selection->ID == GameConstants::TOWNI_TYPE)
|
if(selection && selection->ID == Obj::TOWN)
|
||||||
return static_cast<const CGTownInstance *>(selection);
|
return static_cast<const CGTownInstance *>(selection);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -467,7 +467,7 @@ void CCastleBuildings::recreate()
|
|||||||
{
|
{
|
||||||
std::vector <const CGObjectInstance *> vobjs = LOCPLINT->cb->getVisitableObjs(town->bestLocation());
|
std::vector <const CGObjectInstance *> vobjs = LOCPLINT->cb->getVisitableObjs(town->bestLocation());
|
||||||
//there is visitable obj at shipyard output tile and it's a boat or hero (on boat)
|
//there is visitable obj at shipyard output tile and it's a boat or hero (on boat)
|
||||||
if(!vobjs.empty() && (vobjs.front()->ID == 8 || vobjs.front()->ID == GameConstants::HEROI_TYPE))
|
if(!vobjs.empty() && (vobjs.front()->ID == Obj::BOAT || vobjs.front()->ID == Obj::HERO))
|
||||||
{
|
{
|
||||||
buildingsCopy.insert(EBuilding::SHIP);
|
buildingsCopy.insert(EBuilding::SHIP);
|
||||||
}
|
}
|
||||||
|
@ -502,7 +502,7 @@ void CKingdomInterface::generateObjectsList(const std::vector<const CGObjectInst
|
|||||||
BOOST_FOREACH(const CGObjectInstance * object, ownedObjects)
|
BOOST_FOREACH(const CGObjectInstance * object, ownedObjects)
|
||||||
{
|
{
|
||||||
//Dwellings
|
//Dwellings
|
||||||
if ( object->ID == 17 )
|
if ( object->ID == Obj::CREATURE_GENERATOR1 )
|
||||||
{
|
{
|
||||||
OwnedObjectInfo &info = visibleObjects[object->subID];
|
OwnedObjectInfo &info = visibleObjects[object->subID];
|
||||||
if (info.count++ == 0)
|
if (info.count++ == 0)
|
||||||
@ -566,7 +566,7 @@ void CKingdomInterface::generateMinesList(const std::vector<const CGObjectInstan
|
|||||||
BOOST_FOREACH(const CGObjectInstance * object, ownedObjects)
|
BOOST_FOREACH(const CGObjectInstance * object, ownedObjects)
|
||||||
{
|
{
|
||||||
//Mines
|
//Mines
|
||||||
if ( object->ID == 53 )
|
if ( object->ID == Obj::MINE )
|
||||||
{
|
{
|
||||||
const CGMine *mine = dynamic_cast<const CGMine*>(object);
|
const CGMine *mine = dynamic_cast<const CGMine*>(object);
|
||||||
assert(mine);
|
assert(mine);
|
||||||
|
@ -1095,7 +1095,8 @@ void CPlayerInterface::availableCreaturesChanged( const CGDwelling *town )
|
|||||||
ki->townChanged(townObj);
|
ki->townChanged(townObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(GH.listInt.size() && (town->ID == 17 || town->ID == 20 || town->ID == 106)) //external dwelling
|
else if(GH.listInt.size() && (town->ID == Obj::CREATURE_GENERATOR1
|
||||||
|
|| town->ID == Obj::CREATURE_GENERATOR4 || town->ID == Obj::WAR_MACHINE_FACTORY))
|
||||||
{
|
{
|
||||||
CRecruitmentWindow *crw = dynamic_cast<CRecruitmentWindow*>(GH.topInt());
|
CRecruitmentWindow *crw = dynamic_cast<CRecruitmentWindow*>(GH.topInt());
|
||||||
if(crw && crw->dwelling == town)
|
if(crw && crw->dwelling == town)
|
||||||
@ -1370,7 +1371,7 @@ void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop)
|
|||||||
adventureInt->minimap.showTile(*it);
|
adventureInt->minimap.showTile(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(obj->ID == GameConstants::TOWNI_TYPE)
|
if(obj->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
if(obj->tempOwner == playerID)
|
if(obj->tempOwner == playerID)
|
||||||
towns.push_back(static_cast<const CGTownInstance *>(obj));
|
towns.push_back(static_cast<const CGTownInstance *>(obj));
|
||||||
@ -1453,7 +1454,7 @@ void CPlayerInterface::waitWhileDialog(bool unlockPim /*= true*/)
|
|||||||
void CPlayerInterface::showShipyardDialog(const IShipyard *obj)
|
void CPlayerInterface::showShipyardDialog(const IShipyard *obj)
|
||||||
{
|
{
|
||||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||||
int state = obj->state();
|
auto state = obj->state();
|
||||||
std::vector<si32> cost;
|
std::vector<si32> cost;
|
||||||
obj->getBoatCost(cost);
|
obj->getBoatCost(cost);
|
||||||
CShipyardWindow *csw = new CShipyardWindow(cost, state, obj->getBoatType(), boost::bind(&CCallback::buildBoat, cb, obj));
|
CShipyardWindow *csw = new CShipyardWindow(cost, state, obj->getBoatType(), boost::bind(&CCallback::buildBoat, cb, obj));
|
||||||
@ -1464,12 +1465,12 @@ void CPlayerInterface::newObject( const CGObjectInstance * obj )
|
|||||||
{
|
{
|
||||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||||
//we might have built a boat in shipyard in opened town screen
|
//we might have built a boat in shipyard in opened town screen
|
||||||
if(obj->ID == 8
|
if(obj->ID == Obj::BOAT
|
||||||
&& LOCPLINT->castleInt
|
&& LOCPLINT->castleInt
|
||||||
&& obj->pos-obj->getVisitableOffset() == LOCPLINT->castleInt->town->bestLocation())
|
&& obj->pos-obj->getVisitableOffset() == LOCPLINT->castleInt->town->bestLocation())
|
||||||
{
|
{
|
||||||
CCS->soundh->playSound(soundBase::newBuilding);
|
CCS->soundh->playSound(soundBase::newBuilding);
|
||||||
LOCPLINT->castleInt->addBuilding(20);
|
LOCPLINT->castleInt->addBuilding(EBuilding::SHIP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1494,7 +1495,7 @@ void CPlayerInterface::centerView (int3 pos, int focusTime)
|
|||||||
void CPlayerInterface::objectRemoved( const CGObjectInstance *obj )
|
void CPlayerInterface::objectRemoved( const CGObjectInstance *obj )
|
||||||
{
|
{
|
||||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||||
if(obj->ID == GameConstants::HEROI_TYPE && obj->tempOwner == playerID)
|
if(obj->ID == Obj::HERO && obj->tempOwner == playerID)
|
||||||
{
|
{
|
||||||
const CGHeroInstance *h = static_cast<const CGHeroInstance*>(obj);
|
const CGHeroInstance *h = static_cast<const CGHeroInstance*>(obj);
|
||||||
heroKilled(h);
|
heroKilled(h);
|
||||||
@ -2215,7 +2216,7 @@ void CPlayerInterface::stopMovement()
|
|||||||
void CPlayerInterface::showMarketWindow(const IMarket *market, const CGHeroInstance *visitor)
|
void CPlayerInterface::showMarketWindow(const IMarket *market, const CGHeroInstance *visitor)
|
||||||
{
|
{
|
||||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||||
if(market->o->ID == 2) //Altar
|
if(market->o->ID == Obj::ALTAR_OF_SACRIFICE)
|
||||||
{
|
{
|
||||||
//EEMarketMode mode = market->availableModes().front();
|
//EEMarketMode mode = market->availableModes().front();
|
||||||
if(market->allowsTrade(EMarketMode::ARTIFACT_EXP) && visitor->getAlignment() != EAlignment::EVIL)
|
if(market->allowsTrade(EMarketMode::ARTIFACT_EXP) && visitor->getAlignment() != EAlignment::EVIL)
|
||||||
@ -2271,7 +2272,7 @@ void CPlayerInterface::showQuestLog()
|
|||||||
|
|
||||||
void CPlayerInterface::showShipyardDialogOrProblemPopup(const IShipyard *obj)
|
void CPlayerInterface::showShipyardDialogOrProblemPopup(const IShipyard *obj)
|
||||||
{
|
{
|
||||||
if(obj->state())
|
if(obj->state() != IBoatGenerator::GOOD)
|
||||||
{
|
{
|
||||||
MetaString txt;
|
MetaString txt;
|
||||||
obj->getProblemText(txt);
|
obj->getProblemText(txt);
|
||||||
|
@ -240,7 +240,7 @@ void CGarrisonSlot::hover (bool on)
|
|||||||
{
|
{
|
||||||
temp = CGI->generaltexth->tcommands[32]; //Select %s (visiting)
|
temp = CGI->generaltexth->tcommands[32]; //Select %s (visiting)
|
||||||
}
|
}
|
||||||
else if(owner->armedObjs[0] && owner->armedObjs[0]->ID == GameConstants::TOWNI_TYPE)
|
else if(owner->armedObjs[0] && owner->armedObjs[0]->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
temp = CGI->generaltexth->tcommands[12]; //Select %s (in garrison)
|
temp = CGI->generaltexth->tcommands[12]; //Select %s (in garrison)
|
||||||
}
|
}
|
||||||
@ -1405,7 +1405,7 @@ void CRecruitmentWindow::buy()
|
|||||||
if(dstslot < 0 && !vstd::contains(CGI->arth->bigArtifacts,CGI->arth->convertMachineID(crid, true))) //no available slot
|
if(dstslot < 0 && !vstd::contains(CGI->arth->bigArtifacts,CGI->arth->convertMachineID(crid, true))) //no available slot
|
||||||
{
|
{
|
||||||
std::string txt;
|
std::string txt;
|
||||||
if(dst->ID == GameConstants::HEROI_TYPE)
|
if(dst->ID == Obj::HERO)
|
||||||
{
|
{
|
||||||
txt = CGI->generaltexth->allTexts[425]; //The %s would join your hero, but there aren't enough provisions to support them.
|
txt = CGI->generaltexth->allTexts[425]; //The %s would join your hero, but there aren't enough provisions to support them.
|
||||||
boost::algorithm::replace_first(txt, "%s", slider->value > 1 ? CGI->creh->creatures[crid]->namePl : CGI->creh->creatures[crid]->nameSing);
|
boost::algorithm::replace_first(txt, "%s", slider->value > 1 ? CGI->creh->creatures[crid]->namePl : CGI->creh->creatures[crid]->nameSing);
|
||||||
@ -2433,7 +2433,7 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
|
|||||||
|
|
||||||
std::string title;
|
std::string title;
|
||||||
|
|
||||||
if (market->o->ID == GameConstants::TOWNI_TYPE)
|
if (market->o->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
@ -5257,7 +5257,7 @@ CUniversityWindow::CUniversityWindow(const CGHeroInstance * _hero, const IMarket
|
|||||||
if ( market->o->ID == Obj::UNIVERSITY ) // this is adventure map university
|
if ( market->o->ID == Obj::UNIVERSITY ) // this is adventure map university
|
||||||
titlePic = new CPicture("UNIVBLDG");
|
titlePic = new CPicture("UNIVBLDG");
|
||||||
else
|
else
|
||||||
if (market->o->ID == GameConstants::TOWNI_TYPE)
|
if (market->o->ID == Obj::TOWN)
|
||||||
titlePic = new CAnimImage(CGI->townh->towns[ETownType::CONFLUX].clientInfo.buildingsIcons, EBuilding::MAGIC_UNIVERSITY);
|
titlePic = new CAnimImage(CGI->townh->towns[ETownType::CONFLUX].clientInfo.buildingsIcons, EBuilding::MAGIC_UNIVERSITY);
|
||||||
else
|
else
|
||||||
tlog0<<"Error: Image for university was not found!\n";//This should not happen
|
tlog0<<"Error: Image for university was not found!\n";//This should not happen
|
||||||
@ -5835,9 +5835,9 @@ CIntObject * CRClickPopup::createInfoWin(Point position, const CGObjectInstance
|
|||||||
|
|
||||||
switch(specific->ID)
|
switch(specific->ID)
|
||||||
{
|
{
|
||||||
case GameConstants::HEROI_TYPE:
|
case Obj::HERO:
|
||||||
return new CInfoBoxPopup(position, dynamic_cast<const CGHeroInstance *>(specific));
|
return new CInfoBoxPopup(position, dynamic_cast<const CGHeroInstance *>(specific));
|
||||||
case GameConstants::TOWNI_TYPE:
|
case Obj::TOWN:
|
||||||
return new CInfoBoxPopup(position, dynamic_cast<const CGTownInstance *>(specific));
|
return new CInfoBoxPopup(position, dynamic_cast<const CGTownInstance *>(specific));
|
||||||
case Obj::GARRISON:
|
case Obj::GARRISON:
|
||||||
case Obj::GARRISON2:
|
case Obj::GARRISON2:
|
||||||
|
@ -434,7 +434,7 @@ void SetAvailableCreatures::applyCl( CClient *cl )
|
|||||||
//inform order about the change
|
//inform order about the change
|
||||||
|
|
||||||
int p = -1;
|
int p = -1;
|
||||||
if(dw->ID == 106) //War Machines Factory is not flaggable, it's "owned" by visitor
|
if(dw->ID == Obj::WAR_MACHINE_FACTORY) //War Machines Factory is not flaggable, it's "owned" by visitor
|
||||||
p = cl->getTile(dw->visitablePos())->visitableObjects.back()->tempOwner;
|
p = cl->getTile(dw->visitablePos())->visitableObjects.back()->tempOwner;
|
||||||
else
|
else
|
||||||
p = dw->tempOwner;
|
p = dw->tempOwner;
|
||||||
@ -923,13 +923,13 @@ void TradeComponents::applyCl(CClient *cl)
|
|||||||
{///Shop handler
|
{///Shop handler
|
||||||
switch (CGI->mh->map->objects[objectid]->ID)
|
switch (CGI->mh->map->objects[objectid]->ID)
|
||||||
{
|
{
|
||||||
case 7: //Black Market
|
case Obj::BLACK_MARKET:
|
||||||
break;
|
break;
|
||||||
case 95: //Tavern
|
case Obj::TAVERN:
|
||||||
break;
|
break;
|
||||||
case 97: //Den of Thieves
|
case Obj::DEN_OF_THIEVES:
|
||||||
break;
|
break;
|
||||||
case 221: //Trading Post
|
case Obj::TRADING_POST_SNOW:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tlog2 << "Shop type not supported! \n";
|
tlog2 << "Shop type not supported! \n";
|
||||||
|
@ -247,8 +247,8 @@ void CMapHandler::initObjectRects()
|
|||||||
{
|
{
|
||||||
const CGObjectInstance *obj = map->objects[f];
|
const CGObjectInstance *obj = map->objects[f];
|
||||||
if( !obj
|
if( !obj
|
||||||
|| (obj->ID==GameConstants::HEROI_TYPE && static_cast<const CGHeroInstance*>(obj)->inTownGarrison) //garrisoned hero
|
|| (obj->ID==Obj::HERO && static_cast<const CGHeroInstance*>(obj)->inTownGarrison) //garrisoned hero
|
||||||
|| (obj->ID==8 && static_cast<const CGBoat*>(obj)->hero) //boat with hero (hero graphics is used)
|
|| (obj->ID==Obj::BOAT && static_cast<const CGBoat*>(obj)->hero) //boat with hero (hero graphics is used)
|
||||||
|| !obj->defInfo
|
|| !obj->defInfo
|
||||||
|| !graphics->getDef(obj)) //no graphic...
|
|| !graphics->getDef(obj)) //no graphic...
|
||||||
{
|
{
|
||||||
@ -296,7 +296,7 @@ void CMapHandler::initObjectRects()
|
|||||||
}
|
}
|
||||||
static void processDef (const CGDefInfo* def)
|
static void processDef (const CGDefInfo* def)
|
||||||
{
|
{
|
||||||
if(def->id == GameConstants::EVENTI_TYPE)
|
if(def->id == Obj::EVENT)
|
||||||
{
|
{
|
||||||
graphics->advmapobjGraphics[def->id][def->subid][def->name] = NULL;
|
graphics->advmapobjGraphics[def->id][def->subid][def->name] = NULL;
|
||||||
return;
|
return;
|
||||||
@ -538,7 +538,7 @@ void CMapHandler::terrainRect( int3 top_tile, ui8 anim, const std::vector< std::
|
|||||||
ui8 color = obj->tempOwner;
|
ui8 color = obj->tempOwner;
|
||||||
|
|
||||||
//checking if object has non-empty graphic on this tile
|
//checking if object has non-empty graphic on this tile
|
||||||
if(obj->ID != GameConstants::HEROI_TYPE && !obj->coveringAt(top_tile.x + bx - obj->pos.x, top_tile.y + by - obj->pos.y))
|
if(obj->ID != Obj::HERO && !obj->coveringAt(top_tile.x + bx - obj->pos.x, top_tile.y + by - obj->pos.y))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
static const int notBlittedInPuzzleMode[] = {124};
|
static const int notBlittedInPuzzleMode[] = {124};
|
||||||
@ -553,7 +553,7 @@ void CMapHandler::terrainRect( int3 top_tile, ui8 anim, const std::vector< std::
|
|||||||
pp.h = sr.h;
|
pp.h = sr.h;
|
||||||
pp.w = sr.w;
|
pp.w = sr.w;
|
||||||
|
|
||||||
const CGHeroInstance * themp = (obj->ID != GameConstants::HEROI_TYPE
|
const CGHeroInstance * themp = (obj->ID != Obj::HERO
|
||||||
? NULL
|
? NULL
|
||||||
: static_cast<const CGHeroInstance*>(obj));
|
: static_cast<const CGHeroInstance*>(obj));
|
||||||
|
|
||||||
@ -1090,7 +1090,7 @@ void CMapHandler::getTerrainDescr( const int3 &pos, std::string & out, bool terN
|
|||||||
const TerrainTile &t = map->terrain[pos.x][pos.y][pos.z];
|
const TerrainTile &t = map->terrain[pos.x][pos.y][pos.z];
|
||||||
for(std::vector < std::pair<const CGObjectInstance*,SDL_Rect> >::const_iterator i = tt.objects.begin(); i != tt.objects.end(); i++)
|
for(std::vector < std::pair<const CGObjectInstance*,SDL_Rect> >::const_iterator i = tt.objects.begin(); i != tt.objects.end(); i++)
|
||||||
{
|
{
|
||||||
if(i->first->ID == 124) //Hole
|
if(i->first->ID == Obj::HOLE) //Hole
|
||||||
{
|
{
|
||||||
out = i->first->hoverName;
|
out = i->first->hoverName;
|
||||||
return;
|
return;
|
||||||
@ -1098,7 +1098,7 @@ void CMapHandler::getTerrainDescr( const int3 &pos, std::string & out, bool terN
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(t.hasFavourableWinds())
|
if(t.hasFavourableWinds())
|
||||||
out = CGI->generaltexth->names[225]; //Favourable Winds
|
out = CGI->generaltexth->names[Obj::FAVORABLE_WINDS];
|
||||||
else if(terName)
|
else if(terName)
|
||||||
out = CGI->generaltexth->terrainNames[t.tertype];
|
out = CGI->generaltexth->terrainNames[t.tertype];
|
||||||
}
|
}
|
||||||
|
@ -448,7 +448,7 @@ void CArtHandler::sortArts()
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
void CArtHandler::erasePickedArt (si32 id)
|
void CArtHandler::erasePickedArt (TArtifactID id)
|
||||||
{
|
{
|
||||||
std::vector<CArtifact*>* ptr;
|
std::vector<CArtifact*>* ptr;
|
||||||
CArtifact *art = artifacts[id];
|
CArtifact *art = artifacts[id];
|
||||||
@ -545,17 +545,17 @@ Bonus *createBonus(Bonus::BonusType type, int val, int subtype, shared_ptr<IProp
|
|||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CArtHandler::giveArtBonus( int aid, Bonus::BonusType type, int val, int subtype, int valType, shared_ptr<ILimiter> limiter, int additionalInfo)
|
void CArtHandler::giveArtBonus( TArtifactID aid, Bonus::BonusType type, int val, int subtype, int valType, shared_ptr<ILimiter> limiter, int additionalInfo)
|
||||||
{
|
{
|
||||||
giveArtBonus(aid, createBonus(type, val, subtype, valType, limiter, additionalInfo));
|
giveArtBonus(aid, createBonus(type, val, subtype, valType, limiter, additionalInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CArtHandler::giveArtBonus(int aid, Bonus::BonusType type, int val, int subtype, shared_ptr<IPropagator> propagator /*= NULL*/, int additionalInfo)
|
void CArtHandler::giveArtBonus(TArtifactID aid, Bonus::BonusType type, int val, int subtype, shared_ptr<IPropagator> propagator /*= NULL*/, int additionalInfo)
|
||||||
{
|
{
|
||||||
giveArtBonus(aid, createBonus(type, val, subtype, propagator, additionalInfo));
|
giveArtBonus(aid, createBonus(type, val, subtype, propagator, additionalInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CArtHandler::giveArtBonus(int aid, Bonus *bonus)
|
void CArtHandler::giveArtBonus(TArtifactID aid, Bonus *bonus)
|
||||||
{
|
{
|
||||||
bonus->sid = aid;
|
bonus->sid = aid;
|
||||||
if(bonus->subtype == Bonus::MORALE || bonus->type == Bonus::LUCK)
|
if(bonus->subtype == Bonus::MORALE || bonus->type == Bonus::LUCK)
|
||||||
@ -566,7 +566,7 @@ void CArtHandler::giveArtBonus(int aid, Bonus *bonus)
|
|||||||
artifacts[aid]->addNewBonus(bonus);
|
artifacts[aid]->addNewBonus(bonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CArtHandler::makeItCreatureArt (int aid, bool onlyCreature /*=true*/)
|
void CArtHandler::makeItCreatureArt (TArtifactID aid, bool onlyCreature /*=true*/)
|
||||||
{
|
{
|
||||||
CArtifact *a = artifacts[aid];
|
CArtifact *a = artifacts[aid];
|
||||||
if (onlyCreature)
|
if (onlyCreature)
|
||||||
@ -577,7 +577,7 @@ void CArtHandler::makeItCreatureArt (int aid, bool onlyCreature /*=true*/)
|
|||||||
a->possibleSlots[ArtBearer::CREATURE].push_back(ArtifactPosition::CREATURE_SLOT);
|
a->possibleSlots[ArtBearer::CREATURE].push_back(ArtifactPosition::CREATURE_SLOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CArtHandler::makeItCommanderArt (int aid, bool onlyCommander /*=true*/)
|
void CArtHandler::makeItCommanderArt (TArtifactID aid, bool onlyCommander /*=true*/)
|
||||||
{
|
{
|
||||||
CArtifact *a = artifacts[aid];
|
CArtifact *a = artifacts[aid];
|
||||||
if (onlyCommander)
|
if (onlyCommander)
|
||||||
@ -1456,7 +1456,7 @@ si32 CArtifactSet::getArtPos(const CArtifactInstance *art) const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CArtifactInstance * CArtifactSet::getArtByInstanceId(int artInstId) const
|
const CArtifactInstance * CArtifactSet::getArtByInstanceId( TArtifactID artInstId ) const
|
||||||
{
|
{
|
||||||
for(std::map<ui16, ArtSlotInfo>::const_iterator i = artifactsWorn.begin(); i != artifactsWorn.end(); i++)
|
for(std::map<ui16, ArtSlotInfo>::const_iterator i = artifactsWorn.begin(); i != artifactsWorn.end(); i++)
|
||||||
if(i->second.artifact->id == artInstId)
|
if(i->second.artifact->id == artInstId)
|
||||||
|
@ -34,9 +34,9 @@ namespace ArtifactPosition
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ArtifactId
|
namespace ArtifactPos
|
||||||
{
|
{
|
||||||
enum ArtifactId
|
enum ArtifactPos
|
||||||
{
|
{
|
||||||
SPELLBOOK = 17
|
SPELLBOOK = 17
|
||||||
};
|
};
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
CArtifactInstance();
|
CArtifactInstance();
|
||||||
|
|
||||||
ConstTransitivePtr<CArtifact> artType;
|
ConstTransitivePtr<CArtifact> artType;
|
||||||
si32 id; //id of the instance
|
TArtifactID id; //id of the instance
|
||||||
|
|
||||||
//CArtifactInstance(int aid);
|
//CArtifactInstance(int aid);
|
||||||
|
|
||||||
@ -189,9 +189,9 @@ public:
|
|||||||
|
|
||||||
class DLL_LINKAGE CArtHandler //handles artifacts
|
class DLL_LINKAGE CArtHandler //handles artifacts
|
||||||
{
|
{
|
||||||
void giveArtBonus(int aid, Bonus::BonusType type, int val, int subtype = -1, int valType = Bonus::BASE_NUMBER, shared_ptr<ILimiter> limiter = NULL, int additionalinfo = 0);
|
void giveArtBonus(TArtifactID aid, Bonus::BonusType type, int val, int subtype = -1, int valType = Bonus::BASE_NUMBER, shared_ptr<ILimiter> limiter = NULL, int additionalinfo = 0);
|
||||||
void giveArtBonus(int aid, Bonus::BonusType type, int val, int subtype, shared_ptr<IPropagator> propagator, int additionalinfo = 0);
|
void giveArtBonus(TArtifactID aid, Bonus::BonusType type, int val, int subtype, shared_ptr<IPropagator> propagator, int additionalinfo = 0);
|
||||||
void giveArtBonus(int aid, Bonus *bonus);
|
void giveArtBonus(TArtifactID aid, Bonus *bonus);
|
||||||
public:
|
public:
|
||||||
std::vector<CArtifact*> treasures, minors, majors, relics;
|
std::vector<CArtifact*> treasures, minors, majors, relics;
|
||||||
std::vector< ConstTransitivePtr<CArtifact> > artifacts;
|
std::vector< ConstTransitivePtr<CArtifact> > artifacts;
|
||||||
@ -208,14 +208,14 @@ public:
|
|||||||
ui16 getArtSync (ui32 rand, int flags);
|
ui16 getArtSync (ui32 rand, int flags);
|
||||||
void getAllowedArts(std::vector<ConstTransitivePtr<CArtifact> > &out, std::vector<CArtifact*> *arts, int flag);
|
void getAllowedArts(std::vector<ConstTransitivePtr<CArtifact> > &out, std::vector<CArtifact*> *arts, int flag);
|
||||||
void getAllowed(std::vector<ConstTransitivePtr<CArtifact> > &out, int flags);
|
void getAllowed(std::vector<ConstTransitivePtr<CArtifact> > &out, int flags);
|
||||||
void erasePickedArt (si32 id);
|
void erasePickedArt (TArtifactID id);
|
||||||
bool isBigArtifact (ui32 artID) const {return bigArtifacts.find(artID) != bigArtifacts.end();}
|
bool isBigArtifact (TArtifactID artID) const {return bigArtifacts.find(artID) != bigArtifacts.end();}
|
||||||
// void equipArtifact (std::map<ui16, const CArtifact*> &artifWorn, ui16 slotID, const CArtifact* art) const;
|
// void equipArtifact (std::map<ui16, const CArtifact*> &artifWorn, ui16 slotID, const CArtifact* art) const;
|
||||||
// void unequipArtifact (std::map<ui16, const CArtifact*> &artifWorn, ui16 slotID) const;
|
// void unequipArtifact (std::map<ui16, const CArtifact*> &artifWorn, ui16 slotID) const;
|
||||||
void initAllowedArtifactsList(const std::vector<ui8> &allowed); //allowed[art_id] -> 0 if not allowed, 1 if allowed
|
void initAllowedArtifactsList(const std::vector<ui8> &allowed); //allowed[art_id] -> 0 if not allowed, 1 if allowed
|
||||||
static int convertMachineID(int id, bool creToArt);
|
static int convertMachineID(int id, bool creToArt);
|
||||||
void makeItCreatureArt (int aid, bool onlyCreature = true);
|
void makeItCreatureArt (TArtifactID aid, bool onlyCreature = true);
|
||||||
void makeItCommanderArt (int aid, bool onlyCommander = true);
|
void makeItCommanderArt (TArtifactID aid, bool onlyCommander = true);
|
||||||
CArtHandler();
|
CArtHandler();
|
||||||
~CArtHandler();
|
~CArtHandler();
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ public:
|
|||||||
CArtifactInstance* getArt(ui16 pos, bool excludeLocked = true); //NULL - no artifact
|
CArtifactInstance* getArt(ui16 pos, bool excludeLocked = true); //NULL - no artifact
|
||||||
si32 getArtPos(int aid, bool onlyWorn = true) const; //looks for equipped artifact with given ID and returns its slot ID or -1 if none(if more than one such artifact lower ID is returned)
|
si32 getArtPos(int aid, bool onlyWorn = true) const; //looks for equipped artifact with given ID and returns its slot ID or -1 if none(if more than one such artifact lower ID is returned)
|
||||||
si32 getArtPos(const CArtifactInstance *art) const;
|
si32 getArtPos(const CArtifactInstance *art) const;
|
||||||
const CArtifactInstance *getArtByInstanceId(int artInstId) const;
|
const CArtifactInstance *getArtByInstanceId(TArtifactID artInstId) const;
|
||||||
bool hasArt(ui32 aid, bool onlyWorn = false) const; //checks if hero possess artifact of given id (either in backack or worn)
|
bool hasArt(ui32 aid, bool onlyWorn = false) const; //checks if hero possess artifact of given id (either in backack or worn)
|
||||||
bool isPositionFree(ui16 pos, bool onlyLockCheck = false) const;
|
bool isPositionFree(ui16 pos, bool onlyLockCheck = false) const;
|
||||||
si32 getArtTypeId(ui16 pos) const;
|
si32 getArtTypeId(ui16 pos) const;
|
||||||
|
@ -337,16 +337,12 @@ void CCampaignScenario::prepareCrossoverHeroes( std::vector<CGHeroInstance *> he
|
|||||||
//trimming prim skills
|
//trimming prim skills
|
||||||
BOOST_FOREACH(CGHeroInstance * cgh, crossoverHeroes)
|
BOOST_FOREACH(CGHeroInstance * cgh, crossoverHeroes)
|
||||||
{
|
{
|
||||||
#define RESET_PRIM_SKILL(NAME, VALNAME) \
|
for(int g=0; g<GameConstants::PRIMARY_SKILLS; ++g)
|
||||||
cgh->getBonusLocalFirst(Selector::type(Bonus::PRIMARY_SKILL) && \
|
{
|
||||||
Selector::subtype(PrimarySkill::NAME) && \
|
cgh->getBonusLocalFirst(Selector::type(Bonus::PRIMARY_SKILL) &&
|
||||||
Selector::sourceType(Bonus::HERO_BASE_SKILL) )->val = cgh->type->heroClass->VALNAME;
|
Selector::subtype(g) && Selector::sourceType(Bonus::HERO_BASE_SKILL) )->val
|
||||||
|
= cgh->type->heroClass->initialPrimSkills[g];
|
||||||
RESET_PRIM_SKILL(ATTACK, initialAttack);
|
}
|
||||||
RESET_PRIM_SKILL(DEFENSE, initialDefence);
|
|
||||||
RESET_PRIM_SKILL(SPELL_POWER, initialPower);
|
|
||||||
RESET_PRIM_SKILL(KNOWLEDGE, initialKnowledge);
|
|
||||||
#undef RESET_PRIM_SKILL
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(travelOptions.whatHeroKeeps & 4))
|
if (!(travelOptions.whatHeroKeeps & 4))
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
std::string advMapDef; //for new creatures only
|
std::string advMapDef; //for new creatures only
|
||||||
si32 idNumber;
|
si32 idNumber;
|
||||||
si32 iconIndex; // index of icon in files like twcrport
|
si32 iconIndex; // index of icon in files like twcrport
|
||||||
si8 faction; //-1 = neutral
|
TFaction faction; //-1 = neutral
|
||||||
ui8 doubleWide;
|
ui8 doubleWide;
|
||||||
|
|
||||||
///animation info
|
///animation info
|
||||||
|
@ -97,7 +97,7 @@ int CCreatureSet::getStackCount(TSlot slot) const
|
|||||||
return 0; //TODO? consider issuing a warning
|
return 0; //TODO? consider issuing a warning
|
||||||
}
|
}
|
||||||
|
|
||||||
expType CCreatureSet::getStackExperience(TSlot slot) const
|
TExpType CCreatureSet::getStackExperience(TSlot slot) const
|
||||||
{
|
{
|
||||||
TSlots::const_iterator i = stacks.find(slot);
|
TSlots::const_iterator i = stacks.find(slot);
|
||||||
if (i != stacks.end())
|
if (i != stacks.end())
|
||||||
@ -248,12 +248,12 @@ void CCreatureSet::setStackCount(TSlot slot, TQuantity count)
|
|||||||
armyChanged();
|
armyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCreatureSet::giveStackExp(expType exp)
|
void CCreatureSet::giveStackExp(TExpType exp)
|
||||||
{
|
{
|
||||||
for(TSlots::const_iterator i = stacks.begin(); i != stacks.end(); i++)
|
for(TSlots::const_iterator i = stacks.begin(); i != stacks.end(); i++)
|
||||||
i->second->giveStackExp(exp);
|
i->second->giveStackExp(exp);
|
||||||
}
|
}
|
||||||
void CCreatureSet::setStackExp(TSlot slot, expType exp)
|
void CCreatureSet::setStackExp(TSlot slot, TExpType exp)
|
||||||
{
|
{
|
||||||
assert(hasStackAtSlot(slot));
|
assert(hasStackAtSlot(slot));
|
||||||
stacks[slot]->experience = exp;
|
stacks[slot]->experience = exp;
|
||||||
@ -519,7 +519,7 @@ si32 CStackInstance::magicResistance() const
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStackInstance::giveStackExp(expType exp)
|
void CStackInstance::giveStackExp(TExpType exp)
|
||||||
{
|
{
|
||||||
int level = type->level;
|
int level = type->level;
|
||||||
if (!vstd::iswithin(level, 1, 7))
|
if (!vstd::iswithin(level, 1, 7))
|
||||||
@ -528,7 +528,7 @@ void CStackInstance::giveStackExp(expType exp)
|
|||||||
CCreatureHandler * creh = VLC->creh;
|
CCreatureHandler * creh = VLC->creh;
|
||||||
ui32 maxExp = creh->expRanks[level].back();
|
ui32 maxExp = creh->expRanks[level].back();
|
||||||
|
|
||||||
vstd::amin(exp, (expType)maxExp); //prevent exp overflow due to different types
|
vstd::amin(exp, (TExpType)maxExp); //prevent exp overflow due to different types
|
||||||
vstd::amin(exp, (maxExp * creh->maxExpPerBattle[level])/100);
|
vstd::amin(exp, (maxExp * creh->maxExpPerBattle[level])/100);
|
||||||
vstd::amin(experience += exp, maxExp); //can't get more exp than this limit
|
vstd::amin(experience += exp, maxExp); //can't get more exp than this limit
|
||||||
}
|
}
|
||||||
@ -1020,7 +1020,7 @@ void CCommanderInstance::setAlive (bool Alive)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommanderInstance::giveStackExp (expType exp)
|
void CCommanderInstance::giveStackExp (TExpType exp)
|
||||||
{
|
{
|
||||||
if (alive)
|
if (alive)
|
||||||
experience += exp;
|
experience += exp;
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
int idRand; //hlp variable used during loading game -> "id" placeholder for randomization
|
int idRand; //hlp variable used during loading game -> "id" placeholder for randomization
|
||||||
|
|
||||||
const CArmedInstance * const & armyObj; //stack must be part of some army, army must be part of some object
|
const CArmedInstance * const & armyObj; //stack must be part of some army, army must be part of some object
|
||||||
expType experience;//commander needs same amount of exp as hero
|
TExpType experience;//commander needs same amount of exp as hero
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
void setType(int creID);
|
void setType(int creID);
|
||||||
void setType(const CCreature *c);
|
void setType(const CCreature *c);
|
||||||
void setArmyObj(const CArmedInstance *ArmyObj);
|
void setArmyObj(const CArmedInstance *ArmyObj);
|
||||||
virtual void giveStackExp(expType exp);
|
virtual void giveStackExp(TExpType exp);
|
||||||
bool valid(bool allowUnrandomized) const;
|
bool valid(bool allowUnrandomized) const;
|
||||||
ui8 bearerType() const OVERRIDE; //from CArtifactSet
|
ui8 bearerType() const OVERRIDE; //from CArtifactSet
|
||||||
virtual std::string nodeName() const OVERRIDE; //from CBonusSystemnode
|
virtual std::string nodeName() const OVERRIDE; //from CBonusSystemnode
|
||||||
@ -90,7 +90,7 @@ public:
|
|||||||
CCommanderInstance (TCreature id);
|
CCommanderInstance (TCreature id);
|
||||||
~CCommanderInstance();
|
~CCommanderInstance();
|
||||||
void setAlive (bool alive);
|
void setAlive (bool alive);
|
||||||
void giveStackExp (expType exp);
|
void giveStackExp (TExpType exp);
|
||||||
void levelUp ();
|
void levelUp ();
|
||||||
|
|
||||||
ui64 getPower() const {return 0;};
|
ui64 getPower() const {return 0;};
|
||||||
@ -158,8 +158,8 @@ public:
|
|||||||
void setStackCount(TSlot slot, TQuantity count); //stack must exist!
|
void setStackCount(TSlot slot, TQuantity count); //stack must exist!
|
||||||
CStackInstance *detachStack(TSlot slot); //removes stack from army but doesn't destroy it (so it can be moved somewhere else or safely deleted)
|
CStackInstance *detachStack(TSlot slot); //removes stack from army but doesn't destroy it (so it can be moved somewhere else or safely deleted)
|
||||||
void setStackType(TSlot slot, const CCreature *type);
|
void setStackType(TSlot slot, const CCreature *type);
|
||||||
void giveStackExp(expType exp);
|
void giveStackExp(TExpType exp);
|
||||||
void setStackExp(TSlot slot, expType exp);
|
void setStackExp(TSlot slot, TExpType exp);
|
||||||
|
|
||||||
//derivative
|
//derivative
|
||||||
void eraseStack(TSlot slot); //slot must be occupied
|
void eraseStack(TSlot slot); //slot must be occupied
|
||||||
@ -172,7 +172,7 @@ public:
|
|||||||
const CStackInstance* getStackPtr(TSlot slot) const; //if stack doesn't exist, returns NULL
|
const CStackInstance* getStackPtr(TSlot slot) const; //if stack doesn't exist, returns NULL
|
||||||
const CCreature* getCreature(TSlot slot) const; //workaround of map issue;
|
const CCreature* getCreature(TSlot slot) const; //workaround of map issue;
|
||||||
int getStackCount (TSlot slot) const;
|
int getStackCount (TSlot slot) const;
|
||||||
expType getStackExperience(TSlot slot) const;
|
TExpType getStackExperience(TSlot slot) const;
|
||||||
TSlot findStack(const CStackInstance *stack) const; //-1 if none
|
TSlot findStack(const CStackInstance *stack) const; //-1 if none
|
||||||
TSlot getSlotFor(TCreature creature, ui32 slotsAmount = GameConstants::ARMY_SIZE) const; //returns -1 if no slot available
|
TSlot getSlotFor(TCreature creature, ui32 slotsAmount = GameConstants::ARMY_SIZE) const; //returns -1 if no slot available
|
||||||
TSlot getSlotFor(const CCreature *c, ui32 slotsAmount = GameConstants::ARMY_SIZE) const; //returns -1 if no slot available
|
TSlot getSlotFor(const CCreature *c, ui32 slotsAmount = GameConstants::ARMY_SIZE) const; //returns -1 if no slot available
|
||||||
|
@ -120,7 +120,7 @@ void CDefObjInfoHandler::load()
|
|||||||
|
|
||||||
|
|
||||||
gobjs[nobj->id][nobj->subid] = nobj;
|
gobjs[nobj->id][nobj->subid] = nobj;
|
||||||
if(nobj->id==GameConstants::TOWNI_TYPE)
|
if(nobj->id==Obj::TOWN)
|
||||||
castles[nobj->subid]=nobj;
|
castles[nobj->subid]=nobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ static CGObjectInstance * createObject(int id, int subid, int3 pos, int owner)
|
|||||||
CGObjectInstance * nobj;
|
CGObjectInstance * nobj;
|
||||||
switch(id)
|
switch(id)
|
||||||
{
|
{
|
||||||
case GameConstants::HEROI_TYPE: //hero
|
case Obj::HERO:
|
||||||
{
|
{
|
||||||
CGHeroInstance * nobj = new CGHeroInstance();
|
CGHeroInstance * nobj = new CGHeroInstance();
|
||||||
nobj->pos = pos;
|
nobj->pos = pos;
|
||||||
@ -358,7 +358,7 @@ static CGObjectInstance * createObject(int id, int subid, int3 pos, int owner)
|
|||||||
//nobj->initHero(ran);
|
//nobj->initHero(ran);
|
||||||
return nobj;
|
return nobj;
|
||||||
}
|
}
|
||||||
case GameConstants::TOWNI_TYPE: //town
|
case Obj::TOWN:
|
||||||
nobj = new CGTownInstance;
|
nobj = new CGTownInstance;
|
||||||
break;
|
break;
|
||||||
default: //rest of objects
|
default: //rest of objects
|
||||||
@ -377,7 +377,7 @@ static CGObjectInstance * createObject(int id, int subid, int3 pos, int owner)
|
|||||||
nobj->defInfo->subid = subid;
|
nobj->defInfo->subid = subid;
|
||||||
|
|
||||||
//assigning defhandler
|
//assigning defhandler
|
||||||
if(nobj->ID==GameConstants::HEROI_TYPE || nobj->ID==GameConstants::TOWNI_TYPE)
|
if(nobj->ID==Obj::HERO || nobj->ID==Obj::TOWN)
|
||||||
return nobj;
|
return nobj;
|
||||||
nobj->defInfo = VLC->dobjinfo->gobjs[id][subid];
|
nobj->defInfo = VLC->dobjinfo->gobjs[id][subid];
|
||||||
return nobj;
|
return nobj;
|
||||||
@ -486,11 +486,11 @@ int CGameState::pickHero(int owner)
|
|||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
h = ps.castle*GameConstants::HEROES_PER_TYPE*2+(ran()%(GameConstants::HEROES_PER_TYPE*2));//->scenarioOps->playerInfos[pru].hero = VLC->
|
h = ps.castle*GameConstants::HEROES_PER_TYPE*2+(ran()%(GameConstants::HEROES_PER_TYPE*2));//->scenarioOps->playerInfos[pru].hero = VLC->
|
||||||
} while( map->getHero(h) && i<(GameConstants::NUMBER_OF_HEROES+1));
|
} while( map->getHero(h) && i<(GameConstants::HEROES_QUANTITY+18+1));
|
||||||
if(i>GameConstants::NUMBER_OF_HEROES) //probably no free heroes - there's no point in further search, we'll take first free
|
if(i>GameConstants::HEROES_QUANTITY+18) //probably no free heroes - there's no point in further search, we'll take first free
|
||||||
{
|
{
|
||||||
tlog3 << "Warning: cannot find free hero - trying to get first available..."<<std::endl;
|
tlog3 << "Warning: cannot find free hero - trying to get first available..."<<std::endl;
|
||||||
for(int j=0; j<GameConstants::NUMBER_OF_HEROES; j++)
|
for(int j=0; j<GameConstants::HEROES_QUANTITY; j++)
|
||||||
if(!map->getHero(j))
|
if(!map->getHero(j))
|
||||||
h=j;
|
h=j;
|
||||||
}
|
}
|
||||||
@ -513,7 +513,7 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
|
|||||||
case 69: //random relic artifact
|
case 69: //random relic artifact
|
||||||
return std::pair<int,int>(5, VLC->arth->getRandomArt (CArtifact::ART_RELIC));
|
return std::pair<int,int>(5, VLC->arth->getRandomArt (CArtifact::ART_RELIC));
|
||||||
case 70: //random hero
|
case 70: //random hero
|
||||||
return std::pair<int,int>(GameConstants::HEROI_TYPE,pickHero(obj->tempOwner));
|
return std::pair<int,int>(Obj::HERO,pickHero(obj->tempOwner));
|
||||||
case 71: //random monster
|
case 71: //random monster
|
||||||
return std::pair<int,int>(54,VLC->creh->pickRandomMonster(boost::ref(ran)));
|
return std::pair<int,int>(54,VLC->creh->pickRandomMonster(boost::ref(ran)));
|
||||||
case 72: //random monster lvl1
|
case 72: //random monster lvl1
|
||||||
@ -547,7 +547,7 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
|
|||||||
std::advance(iter, ran()%VLC->townh->towns.size());
|
std::advance(iter, ran()%VLC->townh->towns.size());
|
||||||
f = iter->first;
|
f = iter->first;
|
||||||
}
|
}
|
||||||
return std::pair<int,int>(GameConstants::TOWNI_TYPE,f);
|
return std::pair<int,int>(Obj::TOWN,f);
|
||||||
}
|
}
|
||||||
case 162: //random monster lvl5
|
case 162: //random monster lvl5
|
||||||
return std::pair<int,int>(54, VLC->creh->pickRandomMonster(boost::ref(ran), 5));
|
return std::pair<int,int>(54, VLC->creh->pickRandomMonster(boost::ref(ran), 5));
|
||||||
@ -570,13 +570,15 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
|
|||||||
{
|
{
|
||||||
for(ui32 i=0;i<map->objects.size();i++)
|
for(ui32 i=0;i<map->objects.size();i++)
|
||||||
{
|
{
|
||||||
if(map->objects[i]->ID==77 && dynamic_cast<CGTownInstance*>(map->objects[i].get())->identifier == info->identifier)
|
if(map->objects[i]->ID==Obj::RANDOM_TOWN
|
||||||
|
&& dynamic_cast<CGTownInstance*>(map->objects[i].get())->identifier == info->identifier)
|
||||||
{
|
{
|
||||||
randomizeObject(map->objects[i]); //we have to randomize the castle first
|
randomizeObject(map->objects[i]); //we have to randomize the castle first
|
||||||
faction = map->objects[i]->subID;
|
faction = map->objects[i]->subID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(map->objects[i]->ID==GameConstants::TOWNI_TYPE && dynamic_cast<CGTownInstance*>(map->objects[i].get())->identifier == info->identifier)
|
else if(map->objects[i]->ID==Obj::TOWN
|
||||||
|
&& dynamic_cast<CGTownInstance*>(map->objects[i].get())->identifier == info->identifier)
|
||||||
{
|
{
|
||||||
faction = map->objects[i]->subID;
|
faction = map->objects[i]->subID;
|
||||||
break;
|
break;
|
||||||
@ -636,7 +638,7 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
|
|||||||
std::pair<int,int> ran = pickObject(cur);
|
std::pair<int,int> ran = pickObject(cur);
|
||||||
if(ran.first<0 || ran.second<0) //this is not a random object, or we couldn't find anything
|
if(ran.first<0 || ran.second<0) //this is not a random object, or we couldn't find anything
|
||||||
{
|
{
|
||||||
if(cur->ID==GameConstants::TOWNI_TYPE) //town - set def
|
if(cur->ID==Obj::TOWN) //town - set def
|
||||||
{
|
{
|
||||||
CGTownInstance *t = dynamic_cast<CGTownInstance*>(cur);
|
CGTownInstance *t = dynamic_cast<CGTownInstance*>(cur);
|
||||||
t->town = &VLC->townh->towns[t->subID];
|
t->town = &VLC->townh->towns[t->subID];
|
||||||
@ -649,7 +651,7 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(ran.first==GameConstants::HEROI_TYPE)//special code for hero
|
else if(ran.first==Obj::HERO)//special code for hero
|
||||||
{
|
{
|
||||||
CGHeroInstance *h = dynamic_cast<CGHeroInstance *>(cur);
|
CGHeroInstance *h = dynamic_cast<CGHeroInstance *>(cur);
|
||||||
if(!h) {tlog2<<"Wrong random hero at "<<cur->pos<<std::endl; return;}
|
if(!h) {tlog2<<"Wrong random hero at "<<cur->pos<<std::endl; return;}
|
||||||
@ -660,7 +662,7 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
|
|||||||
map->heroes.push_back(h);
|
map->heroes.push_back(h);
|
||||||
return; //TODO: maybe we should do something with definfo?
|
return; //TODO: maybe we should do something with definfo?
|
||||||
}
|
}
|
||||||
else if(ran.first==GameConstants::TOWNI_TYPE)//special code for town
|
else if(ran.first==Obj::TOWN)//special code for town
|
||||||
{
|
{
|
||||||
CGTownInstance *t = dynamic_cast<CGTownInstance*>(cur);
|
CGTownInstance *t = dynamic_cast<CGTownInstance*>(cur);
|
||||||
if(!t) {tlog2<<"Wrong random town at "<<cur->pos<<std::endl; return;}
|
if(!t) {tlog2<<"Wrong random town at "<<cur->pos<<std::endl; return;}
|
||||||
@ -915,7 +917,7 @@ void CGameState::init(StartInfo * si)
|
|||||||
|
|
||||||
//remove tiles with holes
|
//remove tiles with holes
|
||||||
for(ui32 no=0; no<map->objects.size(); ++no)
|
for(ui32 no=0; no<map->objects.size(); ++no)
|
||||||
if(map->objects[no]->ID == 124)
|
if(map->objects[no]->ID == Obj::HOLE)
|
||||||
allowedPos -= map->objects[no]->pos;
|
allowedPos -= map->objects[no]->pos;
|
||||||
|
|
||||||
if(allowedPos.size())
|
if(allowedPos.size())
|
||||||
@ -947,7 +949,7 @@ void CGameState::init(StartInfo * si)
|
|||||||
obj->hoverName = VLC->generaltexth->names[obj->ID];
|
obj->hoverName = VLC->generaltexth->names[obj->ID];
|
||||||
|
|
||||||
//handle Favouring Winds - mark tiles under it
|
//handle Favouring Winds - mark tiles under it
|
||||||
if(obj->ID == 225)
|
if(obj->ID == Obj::FAVORABLE_WINDS)
|
||||||
for (int i = 0; i < obj->getWidth() ; i++)
|
for (int i = 0; i < obj->getWidth() ; i++)
|
||||||
for (int j = 0; j < obj->getHeight() ; j++)
|
for (int j = 0; j < obj->getHeight() ; j++)
|
||||||
{
|
{
|
||||||
@ -989,7 +991,7 @@ void CGameState::init(StartInfo * si)
|
|||||||
if(scenarioOps->playerInfos[i].hero == -1)
|
if(scenarioOps->playerInfos[i].hero == -1)
|
||||||
scenarioOps->playerInfos[i].hero = h;
|
scenarioOps->playerInfos[i].hero = h;
|
||||||
|
|
||||||
CGHeroInstance * nnn = static_cast<CGHeroInstance*>(createObject(GameConstants::HEROI_TYPE,h,hpos,i));
|
CGHeroInstance * nnn = static_cast<CGHeroInstance*>(createObject(Obj::HERO,h,hpos,i));
|
||||||
nnn->id = map->objects.size();
|
nnn->id = map->objects.size();
|
||||||
nnn->initHero();
|
nnn->initHero();
|
||||||
map->heroes.push_back(nnn);
|
map->heroes.push_back(nnn);
|
||||||
@ -1007,7 +1009,7 @@ void CGameState::init(StartInfo * si)
|
|||||||
|
|
||||||
|
|
||||||
std::vector<CGHeroInstance *> Xheroes;
|
std::vector<CGHeroInstance *> Xheroes;
|
||||||
if (bonus.type == CScenarioTravel::STravelBonus::PLAYER_PREV_SCENARIO) //hero crossover
|
if (bonus.type == CScenarioTravel::STravelBonus::PLAYER_PREV_SCENARIO)
|
||||||
{
|
{
|
||||||
Xheroes = campaign->camp->scenarios[bonus.info2].crossoverHeroes;
|
Xheroes = campaign->camp->scenarios[bonus.info2].crossoverHeroes;
|
||||||
}
|
}
|
||||||
@ -1016,7 +1018,7 @@ void CGameState::init(StartInfo * si)
|
|||||||
for(int g=0; g<map->objects.size(); ++g)
|
for(int g=0; g<map->objects.size(); ++g)
|
||||||
{
|
{
|
||||||
CGObjectInstance * obj = map->objects[g];
|
CGObjectInstance * obj = map->objects[g];
|
||||||
if (obj->ID != 214) //not a placeholder
|
if (obj->ID != Obj::HERO_PLACEHOLDER)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1051,7 +1053,7 @@ void CGameState::init(StartInfo * si)
|
|||||||
for(int g=0; g<map->objects.size(); ++g)
|
for(int g=0; g<map->objects.size(); ++g)
|
||||||
{
|
{
|
||||||
CGObjectInstance * obj = map->objects[g];
|
CGObjectInstance * obj = map->objects[g];
|
||||||
if (obj->ID != 214) //not a placeholder
|
if (obj->ID != Obj::HERO_PLACEHOLDER)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1145,7 +1147,7 @@ void CGameState::init(StartInfo * si)
|
|||||||
|
|
||||||
for (ui32 i=0; i<map->objects.size();i++) //prisons
|
for (ui32 i=0; i<map->objects.size();i++) //prisons
|
||||||
{
|
{
|
||||||
if (map->objects[i]->ID == 62)
|
if (map->objects[i]->ID == Obj::PRISON)
|
||||||
hids.erase(map->objects[i]->subID);
|
hids.erase(map->objects[i]->subID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1316,7 +1318,7 @@ void CGameState::init(StartInfo * si)
|
|||||||
vti->builtBuildings.insert(EBuilding::DWELL_FIRST+1);
|
vti->builtBuildings.insert(EBuilding::DWELL_FIRST+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vstd::contains(vti->builtBuildings, EBuilding::SHIPYARD) && vti->state()==2)
|
if (vstd::contains(vti->builtBuildings, EBuilding::SHIPYARD) && vti->state()==IBoatGenerator::TILE_BLOCKED)
|
||||||
vti->builtBuildings.erase(EBuilding::SHIPYARD);//if we have harbor without water - erase it (this is H3 behaviour)
|
vti->builtBuildings.erase(EBuilding::SHIPYARD);//if we have harbor without water - erase it (this is H3 behaviour)
|
||||||
|
|
||||||
//init hordes
|
//init hordes
|
||||||
@ -1419,7 +1421,7 @@ void CGameState::init(StartInfo * si)
|
|||||||
BOOST_FOREACH(CGObjectInstance *obj, map->objects)
|
BOOST_FOREACH(CGObjectInstance *obj, map->objects)
|
||||||
{
|
{
|
||||||
obj->initObj();
|
obj->initObj();
|
||||||
if(obj->ID == 62) //prison also needs to initialize hero
|
if(obj->ID == Obj::PRISON) //prison also needs to initialize hero
|
||||||
static_cast<CGHeroInstance*>(obj)->initHero();
|
static_cast<CGHeroInstance*>(obj)->initHero();
|
||||||
}
|
}
|
||||||
BOOST_FOREACH(CGObjectInstance *obj, map->objects)
|
BOOST_FOREACH(CGObjectInstance *obj, map->objects)
|
||||||
@ -1663,10 +1665,10 @@ UpgradeInfo CGameState::getUpgradeInfo(const CStackInstance &stack)
|
|||||||
UpgradeInfo ret;
|
UpgradeInfo ret;
|
||||||
const CCreature *base = stack.type;
|
const CCreature *base = stack.type;
|
||||||
|
|
||||||
const CGHeroInstance *h = stack.armyObj->ID == GameConstants::HEROI_TYPE ? static_cast<const CGHeroInstance*>(stack.armyObj) : NULL;
|
const CGHeroInstance *h = stack.armyObj->ID == Obj::HERO ? static_cast<const CGHeroInstance*>(stack.armyObj) : NULL;
|
||||||
const CGTownInstance *t = NULL;
|
const CGTownInstance *t = NULL;
|
||||||
|
|
||||||
if(stack.armyObj->ID == GameConstants::TOWNI_TYPE)
|
if(stack.armyObj->ID == Obj::TOWN)
|
||||||
t = static_cast<const CGTownInstance *>(stack.armyObj);
|
t = static_cast<const CGTownInstance *>(stack.armyObj);
|
||||||
else if(h)
|
else if(h)
|
||||||
{ //hero speciality
|
{ //hero speciality
|
||||||
@ -2939,7 +2941,7 @@ void CPathfinder::calculatePaths(int3 src /*= int3(-1,-1,-1)*/, int movement /*=
|
|||||||
neighbours.clear();
|
neighbours.clear();
|
||||||
|
|
||||||
//handling subterranean gate => it's exit is the only neighbour
|
//handling subterranean gate => it's exit is the only neighbour
|
||||||
bool subterraneanEntry = (ct->topVisitableID() == GameConstants::SUBTERRANEAN_GATE_TYPE && useSubterraneanGates);
|
bool subterraneanEntry = (ct->topVisitableID() == Obj::SUBTERRANEAN_GATE && useSubterraneanGates);
|
||||||
if(subterraneanEntry)
|
if(subterraneanEntry)
|
||||||
{
|
{
|
||||||
//try finding the exit gate
|
//try finding the exit gate
|
||||||
@ -2979,13 +2981,13 @@ void CPathfinder::calculatePaths(int3 src /*= int3(-1,-1,-1)*/, int movement /*=
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//special case -> hero embarked a boat standing on a guarded tile -> we must allow to move away from that tile
|
//special case -> hero embarked a boat standing on a guarded tile -> we must allow to move away from that tile
|
||||||
if(cp->accessible == CGPathNode::VISITABLE && guardedSource && cp->theNodeBefore->land && ct->topVisitableID() == GameConstants::BOATI_TYPE)
|
if(cp->accessible == CGPathNode::VISITABLE && guardedSource && cp->theNodeBefore->land && ct->topVisitableID() == Obj::BOAT)
|
||||||
guardedSource = false;
|
guardedSource = false;
|
||||||
|
|
||||||
int cost = gs->getMovementCost(hero, cp->coord, dp->coord, movement);
|
int cost = gs->getMovementCost(hero, cp->coord, dp->coord, movement);
|
||||||
|
|
||||||
//special case -> moving from src Subterranean gate to dest gate -> it's free
|
//special case -> moving from src Subterranean gate to dest gate -> it's free
|
||||||
if(subterraneanEntry && destTopVisObjID == GameConstants::SUBTERRANEAN_GATE_TYPE && cp->coord.z != dp->coord.z)
|
if(subterraneanEntry && destTopVisObjID == Obj::SUBTERRANEAN_GATE && cp->coord.z != dp->coord.z)
|
||||||
cost = 0;
|
cost = 0;
|
||||||
|
|
||||||
int remains = movement - cost;
|
int remains = movement - cost;
|
||||||
@ -3021,7 +3023,7 @@ void CPathfinder::calculatePaths(int3 src /*= int3(-1,-1,-1)*/, int movement /*=
|
|||||||
|
|
||||||
if (dp->accessible == CGPathNode::ACCESSIBLE
|
if (dp->accessible == CGPathNode::ACCESSIBLE
|
||||||
|| (useEmbarkCost && allowEmbarkAndDisembark)
|
|| (useEmbarkCost && allowEmbarkAndDisembark)
|
||||||
|| destTopVisObjID == GameConstants::SUBTERRANEAN_GATE_TYPE
|
|| destTopVisObjID == Obj::SUBTERRANEAN_GATE
|
||||||
|| (guardedDst && !guardedSource)) // Can step into a hostile tile once.
|
|| (guardedDst && !guardedSource)) // Can step into a hostile tile once.
|
||||||
{
|
{
|
||||||
mq.push_back(dp);
|
mq.push_back(dp);
|
||||||
@ -3060,7 +3062,7 @@ CGPathNode::EAccessibility CPathfinder::evaluateAccessibility(const TerrainTile
|
|||||||
|
|
||||||
if(tinfo->visitable)
|
if(tinfo->visitable)
|
||||||
{
|
{
|
||||||
if(tinfo->visitableObjects.front()->ID == 80 && tinfo->visitableObjects.back()->ID == GameConstants::HEROI_TYPE && tinfo->visitableObjects.back()->tempOwner != hero->tempOwner) //non-owned hero stands on Sanctuary
|
if(tinfo->visitableObjects.front()->ID == 80 && tinfo->visitableObjects.back()->ID == Obj::HERO && tinfo->visitableObjects.back()->tempOwner != hero->tempOwner) //non-owned hero stands on Sanctuary
|
||||||
{
|
{
|
||||||
return CGPathNode::BLOCKED;
|
return CGPathNode::BLOCKED;
|
||||||
}
|
}
|
||||||
@ -3076,7 +3078,7 @@ CGPathNode::EAccessibility CPathfinder::evaluateAccessibility(const TerrainTile
|
|||||||
{
|
{
|
||||||
return CGPathNode::BLOCKVIS;
|
return CGPathNode::BLOCKVIS;
|
||||||
}
|
}
|
||||||
else if(obj->ID != GameConstants::EVENTI_TYPE) //pathfinder should ignore placed events
|
else if(obj->ID != Obj::EVENT) //pathfinder should ignore placed events
|
||||||
{
|
{
|
||||||
ret = CGPathNode::VISITABLE;
|
ret = CGPathNode::VISITABLE;
|
||||||
}
|
}
|
||||||
@ -3101,9 +3103,9 @@ bool CPathfinder::goodForLandSeaTransition()
|
|||||||
{
|
{
|
||||||
if(dp->accessible == CGPathNode::ACCESSIBLE || destTopVisObjID < 0) //cannot enter empty water tile from land -> it has to be visitable
|
if(dp->accessible == CGPathNode::ACCESSIBLE || destTopVisObjID < 0) //cannot enter empty water tile from land -> it has to be visitable
|
||||||
return false;
|
return false;
|
||||||
if(destTopVisObjID != GameConstants::HEROI_TYPE && destTopVisObjID != GameConstants::BOATI_TYPE) //only boat or hero can be accessed from land
|
if(destTopVisObjID != Obj::HERO && destTopVisObjID != Obj::BOAT) //only boat or hero can be accessed from land
|
||||||
return false;
|
return false;
|
||||||
if(destTopVisObjID == GameConstants::BOATI_TYPE)
|
if(destTopVisObjID == Obj::BOAT)
|
||||||
useEmbarkCost = 1;
|
useEmbarkCost = 1;
|
||||||
}
|
}
|
||||||
else //disembark
|
else //disembark
|
||||||
|
@ -44,7 +44,7 @@ int CHeroClass::chooseSecSkill(const std::set<int> & possibles) const //picks se
|
|||||||
throw std::runtime_error("Cannot pick secondary skill!");
|
throw std::runtime_error("Cannot pick secondary skill!");
|
||||||
}
|
}
|
||||||
|
|
||||||
EAlignment::EAlignment CHeroClass::getAlignment()
|
EAlignment::EAlignment CHeroClass::getAlignment() const
|
||||||
{
|
{
|
||||||
return (EAlignment::EAlignment)alignment;
|
return (EAlignment::EAlignment)alignment;
|
||||||
}
|
}
|
||||||
@ -240,10 +240,10 @@ void CHeroHandler::loadHeroClasses()
|
|||||||
|
|
||||||
hc->name = parser.readString();
|
hc->name = parser.readString();
|
||||||
hc->aggression = parser.readNumber();
|
hc->aggression = parser.readNumber();
|
||||||
hc->initialAttack = parser.readNumber();
|
for(int g=0; g<GameConstants::PRIMARY_SKILLS; ++g)
|
||||||
hc->initialDefence = parser.readNumber();
|
{
|
||||||
hc->initialPower = parser.readNumber();
|
hc->initialPrimSkills[g] = parser.readNumber();
|
||||||
hc->initialKnowledge = parser.readNumber();
|
}
|
||||||
|
|
||||||
hc->primChance.resize(GameConstants::PRIMARY_SKILLS);
|
hc->primChance.resize(GameConstants::PRIMARY_SKILLS);
|
||||||
for(int x=0; x<GameConstants::PRIMARY_SKILLS; ++x)
|
for(int x=0; x<GameConstants::PRIMARY_SKILLS; ++x)
|
||||||
|
@ -65,10 +65,10 @@ public:
|
|||||||
ui32 skillLimit; //how many secondary skills can hero learn
|
ui32 skillLimit; //how many secondary skills can hero learn
|
||||||
std::string name;
|
std::string name;
|
||||||
double aggression;
|
double aggression;
|
||||||
int initialAttack, initialDefence, initialPower, initialKnowledge; //initial values of primary skills
|
int initialPrimSkills[GameConstants::PRIMARY_SKILLS]; //initial values of primary skills, uses PrimarySkill enum
|
||||||
std::vector<std::pair<int,int> > primChance;//primChance[PRIMARY_SKILL_ID] - first is for levels 2 - 9, second for 10+;;; probability (%) of getting point of primary skill when getting new level
|
std::vector<std::pair<int,int> > primChance;//primChance[PRIMARY_SKILL_ID] - first is for levels 2 - 9, second for 10+;;; probability (%) of getting point of primary skill when getting new level
|
||||||
std::vector<int> proSec; //probabilities of gaining secondary skills (out of 112), in id order
|
std::vector<int> proSec; //probabilities of gaining secondary skills (out of 112), in id order
|
||||||
int selectionProbability[9]; //probability of selection in towns
|
int selectionProbability[GameConstants::F_NUMBER]; //probability of selection in towns
|
||||||
|
|
||||||
int chooseSecSkill(const std::set<int> & possibles) const; //picks secondary skill out from given possibilities
|
int chooseSecSkill(const std::set<int> & possibles) const; //picks secondary skill out from given possibilities
|
||||||
CHeroClass(); //c-tor
|
CHeroClass(); //c-tor
|
||||||
@ -76,10 +76,10 @@ public:
|
|||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & skillLimit & name & aggression & initialAttack & initialDefence & initialPower & initialKnowledge & primChance
|
h & skillLimit & name & aggression & initialPrimSkills & primChance
|
||||||
& proSec & selectionProbability & alignment;
|
& proSec & selectionProbability & alignment;
|
||||||
}
|
}
|
||||||
EAlignment::EAlignment getAlignment();
|
EAlignment::EAlignment getAlignment() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DLL_LINKAGE CObstacleInfo
|
struct DLL_LINKAGE CObstacleInfo
|
||||||
|
@ -213,9 +213,9 @@ void CModHandler::recreateAdvMapDefs()
|
|||||||
BOOST_FOREACH (auto creature, creatures)
|
BOOST_FOREACH (auto creature, creatures)
|
||||||
{
|
{
|
||||||
//generate adventure map object info & graphics
|
//generate adventure map object info & graphics
|
||||||
CGDefInfo* nobj = new CGDefInfo (*VLC->dobjinfo->gobjs[GameConstants::CREI_TYPE][0]);//copy all typical properties
|
CGDefInfo* nobj = new CGDefInfo (*VLC->dobjinfo->gobjs[Obj::MONSTER][0]);//copy all typical properties
|
||||||
nobj->name = creature->advMapDef; //change only def name (?)
|
nobj->name = creature->advMapDef; //change only def name (?)
|
||||||
VLC->dobjinfo->gobjs[GameConstants::CREI_TYPE][creature->idNumber] = nobj;
|
VLC->dobjinfo->gobjs[Obj::MONSTER][creature->idNumber] = nobj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CModHandler::recreateHandlers()
|
void CModHandler::recreateHandlers()
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -121,7 +121,9 @@ public:
|
|||||||
virtual int getBoatType() const; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
virtual int getBoatType() const; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||||
virtual void getOutOffsets(std::vector<int3> &offsets) const =0; //offsets to obj pos when we boat can be placed
|
virtual void getOutOffsets(std::vector<int3> &offsets) const =0; //offsets to obj pos when we boat can be placed
|
||||||
int3 bestLocation() const; //returns location when the boat should be placed
|
int3 bestLocation() const; //returns location when the boat should be placed
|
||||||
int state() const; //0 - can buid, 1 - there is already a boat at dest tile, 2 - dest tile is blocked, 3 - no water
|
|
||||||
|
enum EGeneratorState {GOOD, BOAT_ALREADY_BUILT, TILE_BLOCKED, NO_WATER};
|
||||||
|
EGeneratorState state() const; //0 - can buid, 1 - there is already a boat at dest tile, 2 - dest tile is blocked, 3 - no water
|
||||||
void getProblemText(MetaString &out, const CGHeroInstance *visitor = NULL) const;
|
void getProblemText(MetaString &out, const CGHeroInstance *visitor = NULL) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -285,7 +287,7 @@ public:
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ConstTransitivePtr<CHero> type;
|
ConstTransitivePtr<CHero> type;
|
||||||
ui64 exp; //experience points
|
TExpType exp; //experience points
|
||||||
ui32 level; //current level of hero
|
ui32 level; //current level of hero
|
||||||
std::string name; //may be custom
|
std::string name; //may be custom
|
||||||
std::string biography; //if custom
|
std::string biography; //if custom
|
||||||
@ -381,7 +383,7 @@ public:
|
|||||||
static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest
|
static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest
|
||||||
double getHeroStrength() const;
|
double getHeroStrength() const;
|
||||||
ui64 getTotalStrength() const;
|
ui64 getTotalStrength() const;
|
||||||
expType calculateXp(expType exp) const; //apply learning skill
|
TExpType calculateXp(TExpType exp) const; //apply learning skill
|
||||||
ui8 getSpellSchoolLevel(const CSpell * spell, int *outSelectedSchool = NULL) const; //returns level on which given spell would be cast by this hero (0 - none, 1 - basic etc); optionally returns number of selected school by arg - 0 - air magic, 1 - fire magic, 2 - water magic, 3 - earth magic,
|
ui8 getSpellSchoolLevel(const CSpell * spell, int *outSelectedSchool = NULL) const; //returns level on which given spell would be cast by this hero (0 - none, 1 - basic etc); optionally returns number of selected school by arg - 0 - air magic, 1 - fire magic, 2 - water magic, 3 - earth magic,
|
||||||
bool canCastThisSpell(const CSpell * spell) const; //determines if this hero can cast given spell; takes into account existing spell in spellbook, existing spellbook and artifact bonuses
|
bool canCastThisSpell(const CSpell * spell) const; //determines if this hero can cast given spell; takes into account existing spell in spellbook, existing spellbook and artifact bonuses
|
||||||
CStackBasicDescriptor calculateNecromancy (const BattleResult &battleResult) const;
|
CStackBasicDescriptor calculateNecromancy (const BattleResult &battleResult) const;
|
||||||
@ -478,7 +480,7 @@ public:
|
|||||||
void onNAHeroVisit(int heroID, bool alreadyVisited) const;
|
void onNAHeroVisit(int heroID, bool alreadyVisited) const;
|
||||||
void initObj();
|
void initObj();
|
||||||
bool wasVisited (const CGHeroInstance * h) const;
|
bool wasVisited (const CGHeroInstance * h) const;
|
||||||
void treeSelected(int heroID, int resType, int resVal, expType expVal, ui32 result) const; //handle player's anwer to the Tree of Knowledge dialog
|
void treeSelected(int heroID, int resType, int resVal, TExpType expVal, ui32 result) const; //handle player's anwer to the Tree of Knowledge dialog
|
||||||
void schoolSelected(int heroID, ui32 which) const;
|
void schoolSelected(int heroID, ui32 which) const;
|
||||||
void arenaSelected(int heroID, int primSkill) const;
|
void arenaSelected(int heroID, int primSkill) const;
|
||||||
|
|
||||||
|
@ -53,13 +53,6 @@ namespace GameConstants
|
|||||||
|
|
||||||
const int ARMY_SIZE = 7;
|
const int ARMY_SIZE = 7;
|
||||||
|
|
||||||
const int BOATI_TYPE = 8;
|
|
||||||
const int HEROI_TYPE = 34;
|
|
||||||
const int TOWNI_TYPE = 98;
|
|
||||||
const int SUBTERRANEAN_GATE_TYPE = 103;
|
|
||||||
const int CREI_TYPE = 54;
|
|
||||||
const int EVENTI_TYPE = 26;
|
|
||||||
|
|
||||||
const int CREATURES_COUNT = 197;
|
const int CREATURES_COUNT = 197;
|
||||||
const int CRE_LEVELS = 10;
|
const int CRE_LEVELS = 10;
|
||||||
const int F_NUMBER = 9; //factions (town types) quantity
|
const int F_NUMBER = 9; //factions (town types) quantity
|
||||||
@ -67,7 +60,6 @@ namespace GameConstants
|
|||||||
const int MAX_HEROES_PER_PLAYER = 8;
|
const int MAX_HEROES_PER_PLAYER = 8;
|
||||||
const int ALL_PLAYERS = 255; //bitfield
|
const int ALL_PLAYERS = 255; //bitfield
|
||||||
const int HEROES_PER_TYPE=8; //amount of heroes of each type
|
const int HEROES_PER_TYPE=8; //amount of heroes of each type
|
||||||
const int NUMBER_OF_HEROES = 174;
|
|
||||||
const int SKILL_QUANTITY=28;
|
const int SKILL_QUANTITY=28;
|
||||||
const int SKILL_PER_HERO=8;
|
const int SKILL_PER_HERO=8;
|
||||||
const int ARTIFACTS_QUANTITY=171;
|
const int ARTIFACTS_QUANTITY=171;
|
||||||
@ -101,7 +93,7 @@ namespace GameConstants
|
|||||||
// Enum declarations
|
// Enum declarations
|
||||||
namespace PrimarySkill
|
namespace PrimarySkill
|
||||||
{
|
{
|
||||||
enum { ATTACK, DEFENSE, SPELL_POWER, KNOWLEDGE};
|
enum PrimarySkill { ATTACK, DEFENSE, SPELL_POWER, KNOWLEDGE};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace EVictoryConditionType
|
namespace EVictoryConditionType
|
||||||
@ -260,17 +252,43 @@ namespace Obj
|
|||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
ALTAR_OF_SACRIFICE = 2,
|
||||||
|
ANCHOR_POINT = 3,
|
||||||
|
ARENA = 4,
|
||||||
ARTIFACT = 5,
|
ARTIFACT = 5,
|
||||||
|
PANDORAS_BOX = 6,
|
||||||
|
BLACK_MARKET = 7,
|
||||||
BOAT = 8,
|
BOAT = 8,
|
||||||
BORDERGUARD = 9,
|
BORDERGUARD = 9,
|
||||||
KEYMASTER = 10,
|
KEYMASTER = 10,
|
||||||
|
BUOY = 11,
|
||||||
|
CAMPFIRE = 12,
|
||||||
|
CARTOGRAPHER = 13,
|
||||||
|
SWAN_POND = 14,
|
||||||
|
COVER_OF_DARKNESS = 15,
|
||||||
CREATURE_BANK = 16,
|
CREATURE_BANK = 16,
|
||||||
CREATURE_GENERATOR1 = 17,
|
CREATURE_GENERATOR1 = 17,
|
||||||
|
CREATURE_GENERATOR2 = 18,
|
||||||
|
CREATURE_GENERATOR3 = 19,
|
||||||
|
CREATURE_GENERATOR4 = 20,
|
||||||
CURSED_GROUND1 = 21,
|
CURSED_GROUND1 = 21,
|
||||||
|
CORPSE = 22,
|
||||||
|
MARLETTO_TOWER = 23,
|
||||||
DERELICT_SHIP = 24,
|
DERELICT_SHIP = 24,
|
||||||
DRAGON_UTOPIA = 25,
|
DRAGON_UTOPIA = 25,
|
||||||
|
EVENT = 26,
|
||||||
|
EYE_OF_MAGI = 27,
|
||||||
|
FAERIE_RING = 28,
|
||||||
|
FLOTSAM = 29,
|
||||||
|
FOUNTAIN_OF_FORTUNE = 30,
|
||||||
|
FOUNTAIN_OF_YOUTH = 31,
|
||||||
|
GARDEN_OF_REVELATION = 32,
|
||||||
GARRISON = 33,
|
GARRISON = 33,
|
||||||
|
HERO = 34,
|
||||||
HILL_FORT = 35,
|
HILL_FORT = 35,
|
||||||
|
HUT_OF_MAGI = 37,
|
||||||
|
IDOL_OF_FORTUNE = 38,
|
||||||
|
LEAN_TO = 39,
|
||||||
LIBRARY_OF_ENLIGHTENMENT = 41,
|
LIBRARY_OF_ENLIGHTENMENT = 41,
|
||||||
MONOLITH1 = 43,
|
MONOLITH1 = 43,
|
||||||
MONOLITH2 = 44,
|
MONOLITH2 = 44,
|
||||||
@ -278,25 +296,60 @@ namespace Obj
|
|||||||
MAGIC_PLAINS1 = 46,
|
MAGIC_PLAINS1 = 46,
|
||||||
SCHOOL_OF_MAGIC = 47,
|
SCHOOL_OF_MAGIC = 47,
|
||||||
MAGIC_WELL = 49,
|
MAGIC_WELL = 49,
|
||||||
|
MERCENARY_CAMP = 51,
|
||||||
|
MERMAID = 52,
|
||||||
MINE = 53,
|
MINE = 53,
|
||||||
MONSTER = 54,
|
MONSTER = 54,
|
||||||
|
MYSTICAL_GARDEN = 55,
|
||||||
|
OASIS = 56,
|
||||||
OBELISK = 57,
|
OBELISK = 57,
|
||||||
|
REDWOOD_OBSERVATORY = 58,
|
||||||
|
OCEAN_BOTTLE = 59,
|
||||||
|
PILLAR_OF_FIRE = 60,
|
||||||
|
STAR_AXIS = 61,
|
||||||
PRISON = 62,
|
PRISON = 62,
|
||||||
PYRAMID = 63,
|
PYRAMID = 63,
|
||||||
|
RALLY_FLAG = 64,
|
||||||
|
RANDOM_TOWN = 77,
|
||||||
|
REFUGEE_CAMP = 78,
|
||||||
|
RESOURCE = 79,
|
||||||
|
SANCTUARY = 80,
|
||||||
|
SCHOLAR = 81,
|
||||||
|
SEA_CHEST = 82,
|
||||||
SEER_HUT = 83,
|
SEER_HUT = 83,
|
||||||
CRYPT = 84,
|
CRYPT = 84,
|
||||||
SHIPWRECK = 85,
|
SHIPWRECK = 85,
|
||||||
|
SHIPWRECK_SURVIVOR = 86,
|
||||||
|
SHIPYARD = 87,
|
||||||
|
SHRINE_OF_MAGIC_THOUGHT = 90,
|
||||||
|
SPELL_SCROLL = 93,
|
||||||
STABLES = 94,
|
STABLES = 94,
|
||||||
|
TAVERN = 95,
|
||||||
|
TEMPLE = 96,
|
||||||
|
DEN_OF_THIEVES = 97,
|
||||||
|
TOWN = 98,
|
||||||
TRADING_POST = 99,
|
TRADING_POST = 99,
|
||||||
|
LEARNING_STONE = 100,
|
||||||
|
TREASURE_CHEST = 101,
|
||||||
TREE_OF_KNOWLEDGE = 102,
|
TREE_OF_KNOWLEDGE = 102,
|
||||||
SUBTERRANEAN_GATE = 103,
|
SUBTERRANEAN_GATE = 103,
|
||||||
UNIVERSITY = 104,
|
UNIVERSITY = 104,
|
||||||
|
WAGON = 105,
|
||||||
|
WAR_MACHINE_FACTORY = 106,
|
||||||
SCHOOL_OF_WAR = 107,
|
SCHOOL_OF_WAR = 107,
|
||||||
|
WARRIORS_TOMB = 108,
|
||||||
|
WATER_WHEEL = 109,
|
||||||
|
WATERING_HOLE = 110,
|
||||||
WHIRLPOOL = 111,
|
WHIRLPOOL = 111,
|
||||||
|
WINDMILL = 112,
|
||||||
|
HOLE = 124,
|
||||||
BORDER_GATE = 212,
|
BORDER_GATE = 212,
|
||||||
|
FREELANCERS_GUILD = 213,
|
||||||
|
HERO_PLACEHOLDER = 214,
|
||||||
QUEST_GUARD = 215,
|
QUEST_GUARD = 215,
|
||||||
GARRISON2 = 219,
|
GARRISON2 = 219,
|
||||||
ABANDONED_MINE = 220,
|
ABANDONED_MINE = 220,
|
||||||
|
TRADING_POST_SNOW = 221,
|
||||||
CLOVER_FIELD = 222,
|
CLOVER_FIELD = 222,
|
||||||
CURSED_GROUND2 = 223,
|
CURSED_GROUND2 = 223,
|
||||||
EVIL_FOG = 224,
|
EVIL_FOG = 224,
|
||||||
@ -343,11 +396,13 @@ namespace BattlefieldBI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Typedef declarations
|
// Typedef declarations
|
||||||
typedef si64 expType;
|
typedef si8 TFaction;
|
||||||
|
typedef si64 TExpType;
|
||||||
typedef ui32 TSpell;
|
typedef ui32 TSpell;
|
||||||
typedef std::pair<ui32, ui32> TDmgRange;
|
typedef std::pair<ui32, ui32> TDmgRange;
|
||||||
typedef ui8 TBonusType;
|
typedef ui8 TBonusType;
|
||||||
typedef si32 TBonusSubtype;
|
typedef si32 TBonusSubtype;
|
||||||
typedef si32 TSlot;
|
typedef si32 TSlot;
|
||||||
typedef si32 TQuantity;
|
typedef si32 TQuantity;
|
||||||
|
typedef si32 TArtifactID;
|
||||||
typedef ui32 TCreature; //creature id
|
typedef ui32 TCreature; //creature id
|
||||||
|
@ -346,14 +346,14 @@ void CGameInfoCallback::getThievesGuildInfo(SThievesGuildInfo & thi, const CGObj
|
|||||||
{
|
{
|
||||||
//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
||||||
ERROR_RET_IF(!obj, "No guild object!");
|
ERROR_RET_IF(!obj, "No guild object!");
|
||||||
ERROR_RET_IF(obj->ID == GameConstants::TOWNI_TYPE && !canGetFullInfo(obj), "Cannot get info about town guild object!");
|
ERROR_RET_IF(obj->ID == Obj::TOWN && !canGetFullInfo(obj), "Cannot get info about town guild object!");
|
||||||
//TODO: advmap object -> check if they're visited by our hero
|
//TODO: advmap object -> check if they're visited by our hero
|
||||||
|
|
||||||
if(obj->ID == GameConstants::TOWNI_TYPE || obj->ID == 95) //it is a town or adv map tavern
|
if(obj->ID == Obj::TOWN || obj->ID == Obj::TAVERN)
|
||||||
{
|
{
|
||||||
gs->obtainPlayersStats(thi, gs->players[obj->tempOwner].towns.size());
|
gs->obtainPlayersStats(thi, gs->players[obj->tempOwner].towns.size());
|
||||||
}
|
}
|
||||||
else if(obj->ID == 97) //Den of Thieves
|
else if(obj->ID == Obj::DEN_OF_THIEVES)
|
||||||
{
|
{
|
||||||
gs->obtainPlayersStats(thi, 20);
|
gs->obtainPlayersStats(thi, 20);
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ bool CGameInfoCallback::getTownInfo( const CGObjectInstance *town, InfoAboutTown
|
|||||||
bool detailed = hasAccess(town->tempOwner);
|
bool detailed = hasAccess(town->tempOwner);
|
||||||
|
|
||||||
//TODO vision support
|
//TODO vision support
|
||||||
if(town->ID == GameConstants::TOWNI_TYPE)
|
if(town->ID == Obj::TOWN)
|
||||||
dest.initFromTown(static_cast<const CGTownInstance *>(town), detailed);
|
dest.initFromTown(static_cast<const CGTownInstance *>(town), detailed);
|
||||||
else if(town->ID == Obj::GARRISON || town->ID == Obj::GARRISON2)
|
else if(town->ID == Obj::GARRISON || town->ID == Obj::GARRISON2)
|
||||||
dest.initFromArmy(static_cast<const CArmedInstance *>(town), detailed);
|
dest.initFromArmy(static_cast<const CArmedInstance *>(town), detailed);
|
||||||
@ -492,7 +492,7 @@ std::vector <const CGObjectInstance * > CGameInfoCallback::getVisitableObjs(int3
|
|||||||
|
|
||||||
BOOST_FOREACH(const CGObjectInstance * obj, t->visitableObjects)
|
BOOST_FOREACH(const CGObjectInstance * obj, t->visitableObjects)
|
||||||
{
|
{
|
||||||
if(player < 0 || obj->ID != GameConstants::EVENTI_TYPE) //hide events from players
|
if(player < 0 || obj->ID != Obj::EVENT) //hide events from players
|
||||||
ret.push_back(obj);
|
ret.push_back(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,7 +690,7 @@ bool CGameInfoCallback::isOwnedOrVisited(const CGObjectInstance *obj) const
|
|||||||
|
|
||||||
const TerrainTile *t = getTile(obj->visitablePos()); //get entrance tile
|
const TerrainTile *t = getTile(obj->visitablePos()); //get entrance tile
|
||||||
const CGObjectInstance *visitor = t->visitableObjects.back(); //visitong hero if present or the obejct itself at last
|
const CGObjectInstance *visitor = t->visitableObjects.back(); //visitong hero if present or the obejct itself at last
|
||||||
return visitor->ID == GameConstants::HEROI_TYPE && canGetFullInfo(visitor); //owned or allied hero is a visitor
|
return visitor->ID == Obj::HERO && canGetFullInfo(visitor); //owned or allied hero is a visitor
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameInfoCallback::getCurrentPlayer() const
|
int CGameInfoCallback::getCurrentPlayer() const
|
||||||
|
@ -546,7 +546,7 @@ struct SetCommanderProperty : public CPackForClient //120
|
|||||||
StackLocation sl; //for commander not on the hero?
|
StackLocation sl; //for commander not on the hero?
|
||||||
|
|
||||||
ui8 which; // use ECommanderProperty
|
ui8 which; // use ECommanderProperty
|
||||||
expType amount; //0 for dead, >0 for alive
|
TExpType amount; //0 for dead, >0 for alive
|
||||||
si32 additionalInfo; //for secondary skills choice
|
si32 additionalInfo; //for secondary skills choice
|
||||||
Bonus accumulatedBonus;
|
Bonus accumulatedBonus;
|
||||||
|
|
||||||
@ -1322,8 +1322,8 @@ struct BattleResult : public CPackForClient//3003
|
|||||||
ui8 result; //EResult values
|
ui8 result; //EResult values
|
||||||
ui8 winner; //0 - attacker, 1 - defender, [2 - draw (should be possible?)]
|
ui8 winner; //0 - attacker, 1 - defender, [2 - draw (should be possible?)]
|
||||||
std::map<ui32,si32> casualties[2]; //first => casualties of attackers - map crid => number
|
std::map<ui32,si32> casualties[2]; //first => casualties of attackers - map crid => number
|
||||||
expType exp[2]; //exp for attacker and defender
|
TExpType exp[2]; //exp for attacker and defender
|
||||||
std::set<ui32> artifacts; //artifacts taken from loser to winner - currently unused
|
std::set<TArtifactID> artifacts; //artifacts taken from loser to winner - currently unused
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ DLL_LINKAGE void GiveBonus::applyGs( CGameState *gs )
|
|||||||
if(!bdescr.message.size()
|
if(!bdescr.message.size()
|
||||||
&& bonus.source == Bonus::OBJECT
|
&& bonus.source == Bonus::OBJECT
|
||||||
&& (bonus.type == Bonus::LUCK || bonus.type == Bonus::MORALE)
|
&& (bonus.type == Bonus::LUCK || bonus.type == Bonus::MORALE)
|
||||||
&& gs->map->objects[bonus.sid]->ID == GameConstants::EVENTI_TYPE) //it's morale/luck bonus from an event without description
|
&& gs->map->objects[bonus.sid]->ID == Obj::EVENT) //it's morale/luck bonus from an event without description
|
||||||
{
|
{
|
||||||
descr = VLC->generaltexth->arraytxt[bonus.val > 0 ? 110 : 109]; //+/-%d Temporary until next battle"
|
descr = VLC->generaltexth->arraytxt[bonus.val > 0 ? 110 : 109]; //+/-%d Temporary until next battle"
|
||||||
boost::replace_first(descr,"%d",boost::lexical_cast<std::string>(std::abs(bonus.val)));
|
boost::replace_first(descr,"%d",boost::lexical_cast<std::string>(std::abs(bonus.val)));
|
||||||
@ -281,7 +281,7 @@ DLL_LINKAGE void RemoveObject::applyGs( CGameState *gs )
|
|||||||
gs->map->removeBlockVisTiles(obj);
|
gs->map->removeBlockVisTiles(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(obj->ID==GameConstants::HEROI_TYPE)
|
if(obj->ID==Obj::HERO)
|
||||||
{
|
{
|
||||||
CGHeroInstance *h = static_cast<CGHeroInstance*>(obj);
|
CGHeroInstance *h = static_cast<CGHeroInstance*>(obj);
|
||||||
PlayerState *p = gs->getPlayer(h->tempOwner);
|
PlayerState *p = gs->getPlayer(h->tempOwner);
|
||||||
@ -381,7 +381,7 @@ void TryMoveHero::applyGs( CGameState *gs )
|
|||||||
if(result == EMBARK) //hero enters boat at dest tile
|
if(result == EMBARK) //hero enters boat at dest tile
|
||||||
{
|
{
|
||||||
const TerrainTile &tt = gs->map->getTile(CGHeroInstance::convertPosition(end, false));
|
const TerrainTile &tt = gs->map->getTile(CGHeroInstance::convertPosition(end, false));
|
||||||
assert(tt.visitableObjects.size() >= 1 && tt.visitableObjects.back()->ID == 8); //the only vis obj at dest is Boat
|
assert(tt.visitableObjects.size() >= 1 && tt.visitableObjects.back()->ID == Obj::BOAT); //the only vis obj at dest is Boat
|
||||||
CGBoat *boat = static_cast<CGBoat*>(tt.visitableObjects.back());
|
CGBoat *boat = static_cast<CGBoat*>(tt.visitableObjects.back());
|
||||||
|
|
||||||
gs->map->removeBlockVisTiles(boat); //hero blockvis mask will be used, we don't need to duplicate it with boat
|
gs->map->removeBlockVisTiles(boat); //hero blockvis mask will be used, we don't need to duplicate it with boat
|
||||||
@ -921,7 +921,7 @@ DLL_LINKAGE void SetObjectProperty::applyGs( CGameState *gs )
|
|||||||
CArmedInstance *cai = dynamic_cast<CArmedInstance *>(obj);
|
CArmedInstance *cai = dynamic_cast<CArmedInstance *>(obj);
|
||||||
if(what == ObjProperty::OWNER && cai)
|
if(what == ObjProperty::OWNER && cai)
|
||||||
{
|
{
|
||||||
if(obj->ID == GameConstants::TOWNI_TYPE)
|
if(obj->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
CGTownInstance *t = static_cast<CGTownInstance*>(obj);
|
CGTownInstance *t = static_cast<CGTownInstance*>(obj);
|
||||||
if(t->tempOwner < GameConstants::PLAYER_LIMIT)
|
if(t->tempOwner < GameConstants::PLAYER_LIMIT)
|
||||||
|
22
lib/map.cpp
22
lib/map.cpp
@ -933,7 +933,7 @@ CGObjectInstance * Mapa::loadHero(const ui8 * bufor, int &i, int idToBeGiven)
|
|||||||
{
|
{
|
||||||
if(readChar(bufor,i))//customPrimSkills
|
if(readChar(bufor,i))//customPrimSkills
|
||||||
{
|
{
|
||||||
for(int xx=0;xx<4;xx++)
|
for(int xx=0; xx<GameConstants::PRIMARY_SKILLS; xx++)
|
||||||
nhi->pushPrimSkill(xx, bufor[i++]);
|
nhi->pushPrimSkill(xx, bufor[i++]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1066,7 +1066,7 @@ void Mapa::readPredefinedHeroes( const ui8 * bufor, int &i)
|
|||||||
if(!custom)
|
if(!custom)
|
||||||
continue;
|
continue;
|
||||||
CGHeroInstance * cgh = new CGHeroInstance;
|
CGHeroInstance * cgh = new CGHeroInstance;
|
||||||
cgh->ID = GameConstants::HEROI_TYPE;
|
cgh->ID = Obj::HERO;
|
||||||
cgh->subID = z;
|
cgh->subID = z;
|
||||||
if(readChar(bufor,i))//true if hore's experience is greater than 0
|
if(readChar(bufor,i))//true if hore's experience is greater than 0
|
||||||
{ cgh->exp = read_le_u32(bufor + i); i+=4; }
|
{ cgh->exp = read_le_u32(bufor + i); i+=4; }
|
||||||
@ -1106,7 +1106,7 @@ void Mapa::readPredefinedHeroes( const ui8 * bufor, int &i)
|
|||||||
}
|
}
|
||||||
if(readChar(bufor,i))//customPrimSkills
|
if(readChar(bufor,i))//customPrimSkills
|
||||||
{
|
{
|
||||||
for(int xx=0;xx<4;xx++)
|
for(int xx=0; xx<GameConstants::PRIMARY_SKILLS; xx++)
|
||||||
cgh->pushPrimSkill(xx, bufor[i++]);
|
cgh->pushPrimSkill(xx, bufor[i++]);
|
||||||
}
|
}
|
||||||
predefinedHeroes.push_back(cgh);
|
predefinedHeroes.push_back(cgh);
|
||||||
@ -1202,7 +1202,7 @@ void Mapa::readDefInfo( const ui8 * bufor, int &i)
|
|||||||
vinya->visitMap[zi] = reverse(bytes[6+zi]);
|
vinya->visitMap[zi] = reverse(bytes[6+zi]);
|
||||||
}
|
}
|
||||||
i+=16;
|
i+=16;
|
||||||
if(vinya->id!=GameConstants::HEROI_TYPE && vinya->id!=70)
|
if(vinya->id!=Obj::HERO && vinya->id!=70)
|
||||||
{
|
{
|
||||||
CGDefInfo *h = VLC->dobjinfo->gobjs[vinya->id][vinya->subid];
|
CGDefInfo *h = VLC->dobjinfo->gobjs[vinya->id][vinya->subid];
|
||||||
if(!h)
|
if(!h)
|
||||||
@ -1223,7 +1223,7 @@ void Mapa::readDefInfo( const ui8 * bufor, int &i)
|
|||||||
vinya->visitDir = 0xff;
|
vinya->visitDir = 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vinya->id == GameConstants::EVENTI_TYPE)
|
if(vinya->id == Obj::EVENT)
|
||||||
std::memset(vinya->blockMap,255,6);
|
std::memset(vinya->blockMap,255,6);
|
||||||
|
|
||||||
//calculating coverageMap
|
//calculating coverageMap
|
||||||
@ -1268,7 +1268,7 @@ void Mapa::readObjects( const ui8 * bufor, int &i)
|
|||||||
|
|
||||||
switch(defInfo->id)
|
switch(defInfo->id)
|
||||||
{
|
{
|
||||||
case GameConstants::EVENTI_TYPE: //for event objects
|
case Obj::EVENT: //for event objects
|
||||||
{
|
{
|
||||||
CGEvent *evnt = new CGEvent();
|
CGEvent *evnt = new CGEvent();
|
||||||
nobj = evnt;
|
nobj = evnt;
|
||||||
@ -1886,14 +1886,14 @@ void Mapa::readObjects( const ui8 * bufor, int &i)
|
|||||||
nobj->pos = pos;
|
nobj->pos = pos;
|
||||||
nobj->ID = defInfo->id;
|
nobj->ID = defInfo->id;
|
||||||
nobj->id = idToBeGiven;
|
nobj->id = idToBeGiven;
|
||||||
if(nobj->ID != GameConstants::HEROI_TYPE && nobj->ID != 214 && nobj->ID != 62)
|
if(nobj->ID != Obj::HERO && nobj->ID != Obj::HERO_PLACEHOLDER && nobj->ID != Obj::PRISON)
|
||||||
nobj->subID = defInfo->subid;
|
nobj->subID = defInfo->subid;
|
||||||
nobj->defInfo = defInfo;
|
nobj->defInfo = defInfo;
|
||||||
assert(idToBeGiven == objects.size());
|
assert(idToBeGiven == objects.size());
|
||||||
objects.push_back(nobj);
|
objects.push_back(nobj);
|
||||||
if(nobj->ID==GameConstants::TOWNI_TYPE)
|
if(nobj->ID==Obj::TOWN)
|
||||||
towns.push_back(static_cast<CGTownInstance*>(nobj));
|
towns.push_back(static_cast<CGTownInstance*>(nobj));
|
||||||
if(nobj->ID==GameConstants::HEROI_TYPE)
|
if(nobj->ID==Obj::HERO)
|
||||||
heroes.push_back(static_cast<CGHeroInstance*>(nobj));
|
heroes.push_back(static_cast<CGHeroInstance*>(nobj));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2049,9 +2049,9 @@ const CGObjectInstance *Mapa::getObjectiveObjectFrom(int3 pos, bool lookForHero)
|
|||||||
{
|
{
|
||||||
const std::vector <CGObjectInstance*> &objs = getTile(pos).visitableObjects;
|
const std::vector <CGObjectInstance*> &objs = getTile(pos).visitableObjects;
|
||||||
assert(objs.size());
|
assert(objs.size());
|
||||||
if(objs.size() > 1 && lookForHero && objs.front()->ID != GameConstants::HEROI_TYPE)
|
if(objs.size() > 1 && lookForHero && objs.front()->ID != Obj::HERO)
|
||||||
{
|
{
|
||||||
assert(objs.back()->ID == GameConstants::HEROI_TYPE);
|
assert(objs.back()->ID == Obj::HERO);
|
||||||
return objs.back();
|
return objs.back();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -451,10 +451,10 @@ struct DLL_LINKAGE Mapa : public CMapHeader
|
|||||||
|
|
||||||
switch (objects[i]->ID)
|
switch (objects[i]->ID)
|
||||||
{
|
{
|
||||||
case GameConstants::HEROI_TYPE:
|
case Obj::HERO:
|
||||||
heroes.push_back (static_cast<CGHeroInstance*>(+objects[i]));
|
heroes.push_back (static_cast<CGHeroInstance*>(+objects[i]));
|
||||||
break;
|
break;
|
||||||
case GameConstants::TOWNI_TYPE:
|
case Obj::TOWN:
|
||||||
towns.push_back (static_cast<CGTownInstance*>(+objects[i]));
|
towns.push_back (static_cast<CGTownInstance*>(+objects[i]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -488,7 +488,7 @@ struct DLL_LINKAGE Mapa : public CMapHeader
|
|||||||
//hero stands on the water - he must be in the boat
|
//hero stands on the water - he must be in the boat
|
||||||
for(ui32 j = 0; j < t.visitableObjects.size(); j++)
|
for(ui32 j = 0; j < t.visitableObjects.size(); j++)
|
||||||
{
|
{
|
||||||
if(t.visitableObjects[j]->ID == 8)
|
if(t.visitableObjects[j]->ID == Obj::BOAT)
|
||||||
{
|
{
|
||||||
CGBoat *b = static_cast<CGBoat *>(t.visitableObjects[j]);
|
CGBoat *b = static_cast<CGBoat *>(t.visitableObjects[j]);
|
||||||
heroes[i]->boat = b;
|
heroes[i]->boat = b;
|
||||||
|
@ -541,7 +541,7 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
|
|||||||
MoveArtifact ma;
|
MoveArtifact ma;
|
||||||
ma.src = ArtifactLocation (loserHero, artSlot.first);
|
ma.src = ArtifactLocation (loserHero, artSlot.first);
|
||||||
const CArtifactInstance * art = ma.src.getArt();
|
const CArtifactInstance * art = ma.src.getArt();
|
||||||
if (art && !art->artType->isBig() && art->id != ArtifactId::SPELLBOOK) // don't move war machines or locked arts (spellbook)
|
if (art && !art->artType->isBig() && art->id != 0) // don't move war machines or locked arts (spellbook)
|
||||||
{
|
{
|
||||||
arts.push_back (art->artType->id);
|
arts.push_back (art->artType->id);
|
||||||
ma.dst = ArtifactLocation (winnerHero, art->firstAvailableSlot(winnerHero));
|
ma.dst = ArtifactLocation (winnerHero, art->firstAvailableSlot(winnerHero));
|
||||||
@ -1667,7 +1667,7 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
|
|||||||
//OR hero is on land and dest is water and (there is not present only one object - boat)
|
//OR hero is on land and dest is water and (there is not present only one object - boat)
|
||||||
if(((t.tertype == TerrainTile::rock || (t.blocked && !t.visitable && !h->hasBonusOfType(Bonus::FLYING_MOVEMENT) ))
|
if(((t.tertype == TerrainTile::rock || (t.blocked && !t.visitable && !h->hasBonusOfType(Bonus::FLYING_MOVEMENT) ))
|
||||||
&& complain("Cannot move hero, destination tile is blocked!"))
|
&& complain("Cannot move hero, destination tile is blocked!"))
|
||||||
|| ((!h->boat && !h->canWalkOnSea() && t.tertype == TerrainTile::water && (t.visitableObjects.size() < 1 || (t.visitableObjects.back()->ID != 8 && t.visitableObjects.back()->ID != GameConstants::HEROI_TYPE))) //hero is not on boat/water walking and dst water tile doesn't contain boat/hero (objs visitable from land) -> we test back cause boat may be on top of another object (#276)
|
|| ((!h->boat && !h->canWalkOnSea() && t.tertype == TerrainTile::water && (t.visitableObjects.size() < 1 || (t.visitableObjects.back()->ID != 8 && t.visitableObjects.back()->ID != Obj::HERO))) //hero is not on boat/water walking and dst water tile doesn't contain boat/hero (objs visitable from land) -> we test back cause boat may be on top of another object (#276)
|
||||||
&& complain("Cannot move hero, destination tile is on water!"))
|
&& complain("Cannot move hero, destination tile is on water!"))
|
||||||
|| ((h->boat && t.tertype != TerrainTile::water && t.blocked)
|
|| ((h->boat && t.tertype != TerrainTile::water && t.blocked)
|
||||||
&& complain("Cannot disembark hero, tile is blocked!"))
|
&& complain("Cannot disembark hero, tile is blocked!"))
|
||||||
@ -1682,7 +1682,7 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
|
|||||||
}
|
}
|
||||||
|
|
||||||
//hero enters the boat
|
//hero enters the boat
|
||||||
if(!h->boat && t.visitableObjects.size() && t.visitableObjects.back()->ID == 8)
|
if(!h->boat && t.visitableObjects.size() && t.visitableObjects.back()->ID == Obj::BOAT)
|
||||||
{
|
{
|
||||||
tmh.result = TryMoveHero::EMBARK;
|
tmh.result = TryMoveHero::EMBARK;
|
||||||
tmh.movePoints = h->movementPointsAfterEmbark(h->movement, cost, false);
|
tmh.movePoints = h->movementPointsAfterEmbark(h->movement, cost, false);
|
||||||
@ -1764,7 +1764,7 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
|
|||||||
{
|
{
|
||||||
BOOST_FOREACH(CGObjectInstance* obj, t.blockingObjects)
|
BOOST_FOREACH(CGObjectInstance* obj, t.blockingObjects)
|
||||||
{
|
{
|
||||||
if(obj->ID==GameConstants::HEROI_TYPE)
|
if(obj->ID==Obj::HERO)
|
||||||
{
|
{
|
||||||
CGHeroInstance *dh = static_cast<CGHeroInstance *>(obj);
|
CGHeroInstance *dh = static_cast<CGHeroInstance *>(obj);
|
||||||
|
|
||||||
@ -1833,7 +1833,7 @@ void CGameHandler::setOwner(int objid, ui8 owner)
|
|||||||
const CGObjectInstance * obj = getObj(objid);
|
const CGObjectInstance * obj = getObj(objid);
|
||||||
const PlayerState * p = gs->getPlayer(owner);
|
const PlayerState * p = gs->getPlayer(owner);
|
||||||
|
|
||||||
if((obj->ID == 17 || obj->ID == 20 ) && p && p->dwellings.size()==1)//first dwelling captured
|
if((obj->ID == Obj::CREATURE_GENERATOR1 || obj->ID == Obj::CREATURE_GENERATOR4 ) && p && p->dwellings.size()==1)//first dwelling captured
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const CGTownInstance *t, gs->getPlayer(owner)->towns)
|
BOOST_FOREACH(const CGTownInstance *t, gs->getPlayer(owner)->towns)
|
||||||
{
|
{
|
||||||
@ -1994,8 +1994,8 @@ void CGameHandler::startBattleI(const CArmedInstance *army1, const CArmedInstanc
|
|||||||
void CGameHandler::startBattleI( const CArmedInstance *army1, const CArmedInstance *army2, int3 tile, boost::function<void(BattleResult*)> cb, bool creatureBank )
|
void CGameHandler::startBattleI( const CArmedInstance *army1, const CArmedInstance *army2, int3 tile, boost::function<void(BattleResult*)> cb, bool creatureBank )
|
||||||
{
|
{
|
||||||
startBattleI(army1, army2, tile,
|
startBattleI(army1, army2, tile,
|
||||||
army1->ID == GameConstants::HEROI_TYPE ? static_cast<const CGHeroInstance*>(army1) : NULL,
|
army1->ID == Obj::HERO ? static_cast<const CGHeroInstance*>(army1) : NULL,
|
||||||
army2->ID == GameConstants::HEROI_TYPE ? static_cast<const CGHeroInstance*>(army2) : NULL,
|
army2->ID == Obj::HERO ? static_cast<const CGHeroInstance*>(army2) : NULL,
|
||||||
creatureBank, cb);
|
creatureBank, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2565,11 +2565,12 @@ bool CGameHandler::recruitCreatures( si32 objid, ui32 crid, ui32 cram, si32 from
|
|||||||
|
|
||||||
//TODO: test for owning
|
//TODO: test for owning
|
||||||
|
|
||||||
if(dw->ID == GameConstants::TOWNI_TYPE)
|
if(dw->ID == Obj::TOWN)
|
||||||
dst = (static_cast<const CGTownInstance *>(dw))->getUpperArmy();
|
dst = (static_cast<const CGTownInstance *>(dw))->getUpperArmy();
|
||||||
else if(dw->ID == 17 || dw->ID == 20 || dw->ID == 78) //advmap dwelling
|
else if(dw->ID == Obj::CREATURE_GENERATOR1 || dw->ID == Obj::CREATURE_GENERATOR4
|
||||||
|
|| dw->ID == Obj::REFUGEE_CAMP) //advmap dwelling
|
||||||
dst = getHero(gs->getPlayer(dw->tempOwner)->currentSelection); //TODO: check if current hero is really visiting dwelling
|
dst = getHero(gs->getPlayer(dw->tempOwner)->currentSelection); //TODO: check if current hero is really visiting dwelling
|
||||||
else if(dw->ID == 106)
|
else if(dw->ID == Obj::WAR_MACHINE_FACTORY)
|
||||||
dst = dynamic_cast<const CGHeroInstance *>(getTile(dw->visitablePos())->visitableObjects.back());
|
dst = dynamic_cast<const CGHeroInstance *>(getTile(dw->visitablePos())->visitableObjects.back());
|
||||||
|
|
||||||
assert(dw && dst);
|
assert(dw && dst);
|
||||||
@ -2874,7 +2875,7 @@ bool CGameHandler::assembleArtifacts (si32 heroID, ui16 artifactSlot, bool assem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameHandler::buyArtifact( ui32 hid, si32 aid )
|
bool CGameHandler::buyArtifact( ui32 hid, TArtifactID aid )
|
||||||
{
|
{
|
||||||
CGHeroInstance *hero = gs->getHero(hid);
|
CGHeroInstance *hero = gs->getHero(hid);
|
||||||
CGTownInstance *town = hero->visitedTown;
|
CGTownInstance *town = hero->visitedTown;
|
||||||
@ -2933,7 +2934,7 @@ bool CGameHandler::buyArtifact(const IMarket *m, const CGHeroInstance *h, int ri
|
|||||||
|
|
||||||
|
|
||||||
SetAvailableArtifacts saa;
|
SetAvailableArtifacts saa;
|
||||||
if(m->o->ID == GameConstants::TOWNI_TYPE)
|
if(m->o->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
saa.id = -1;
|
saa.id = -1;
|
||||||
saa.arts = CGTownInstance::merchantArtifacts;
|
saa.arts = CGTownInstance::merchantArtifacts;
|
||||||
@ -2966,7 +2967,7 @@ bool CGameHandler::buyArtifact(const IMarket *m, const CGHeroInstance *h, int ri
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameHandler::sellArtifact(const IMarket *m, const CGHeroInstance *h, int aid, int rid)
|
bool CGameHandler::sellArtifact(const IMarket *m, const CGHeroInstance *h, TArtifactID aid, int rid)
|
||||||
{
|
{
|
||||||
const CArtifactInstance *art = h->getArtByInstanceId(aid);
|
const CArtifactInstance *art = h->getArtByInstanceId(aid);
|
||||||
if(!art)
|
if(!art)
|
||||||
@ -3157,7 +3158,7 @@ bool CGameHandler::hireHero(const CGObjectInstance *obj, ui8 hid, ui8 player)
|
|||||||
|| (t->visitingHero && complain("There is visiting hero - no place!")))
|
|| (t->visitingHero && complain("There is visiting hero - no place!")))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(obj->ID == 95) //Tavern on adv map
|
else if(obj->ID == Obj::TAVERN)
|
||||||
{
|
{
|
||||||
if(getTile(obj->visitablePos())->visitableObjects.back() != obj && complain("Tavern entry must be unoccupied!"))
|
if(getTile(obj->visitablePos())->visitableObjects.back() != obj && complain("Tavern entry must be unoccupied!"))
|
||||||
return false;
|
return false;
|
||||||
@ -4865,19 +4866,19 @@ bool CGameHandler::isAllowedExchange( int id1, int id2 )
|
|||||||
const CGObjectInstance *o1 = getObj(id1), *o2 = getObj(id2);
|
const CGObjectInstance *o1 = getObj(id1), *o2 = getObj(id2);
|
||||||
if (o1 && o2)
|
if (o1 && o2)
|
||||||
{
|
{
|
||||||
if(o1->ID == GameConstants::TOWNI_TYPE)
|
if(o1->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
const CGTownInstance *t = static_cast<const CGTownInstance*>(o1);
|
const CGTownInstance *t = static_cast<const CGTownInstance*>(o1);
|
||||||
if(t->visitingHero == o2 || t->garrisonHero == o2)
|
if(t->visitingHero == o2 || t->garrisonHero == o2)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(o2->ID == GameConstants::TOWNI_TYPE)
|
if(o2->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
const CGTownInstance *t = static_cast<const CGTownInstance*>(o2);
|
const CGTownInstance *t = static_cast<const CGTownInstance*>(o2);
|
||||||
if(t->visitingHero == o1 || t->garrisonHero == o1)
|
if(t->visitingHero == o1 || t->garrisonHero == o1)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(o1->ID == GameConstants::HEROI_TYPE && o2->ID == GameConstants::HEROI_TYPE
|
if(o1->ID == Obj::HERO && o2->ID == Obj::HERO
|
||||||
&& distance(o1->pos, o2->pos) < 2) //hero stands on the same tile or on the neighbouring tiles
|
&& distance(o1->pos, o2->pos) < 2) //hero stands on the same tile or on the neighbouring tiles
|
||||||
{
|
{
|
||||||
//TODO: it's workaround, we should check if first hero visited second and player hasn't closed exchange window
|
//TODO: it's workaround, we should check if first hero visited second and player hasn't closed exchange window
|
||||||
@ -4911,12 +4912,12 @@ bool CGameHandler::buildBoat( ui32 objid )
|
|||||||
{
|
{
|
||||||
const IShipyard *obj = IShipyard::castFrom(getObj(objid));
|
const IShipyard *obj = IShipyard::castFrom(getObj(objid));
|
||||||
|
|
||||||
if(obj->state())
|
if(obj->state() != IBoatGenerator::GOOD)
|
||||||
{
|
{
|
||||||
complain("Cannot build boat in this shipyard!");
|
complain("Cannot build boat in this shipyard!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(obj->o->ID == GameConstants::TOWNI_TYPE
|
else if(obj->o->ID == Obj::TOWN
|
||||||
&& !static_cast<const CGTownInstance*>(obj)->hasBuilt(EBuilding::SHIPYARD))
|
&& !static_cast<const CGTownInstance*>(obj)->hasBuilt(EBuilding::SHIPYARD))
|
||||||
{
|
{
|
||||||
complain("Cannot build boat in the town - no shipyard!");
|
complain("Cannot build boat in the town - no shipyard!");
|
||||||
@ -5169,7 +5170,7 @@ bool CGameHandler::dig( const CGHeroInstance *h )
|
|||||||
{
|
{
|
||||||
for (std::vector<ConstTransitivePtr<CGObjectInstance> >::const_iterator i = gs->map->objects.begin(); i != gs->map->objects.end(); i++) //unflag objs
|
for (std::vector<ConstTransitivePtr<CGObjectInstance> >::const_iterator i = gs->map->objects.begin(); i != gs->map->objects.end(); i++) //unflag objs
|
||||||
{
|
{
|
||||||
if(*i && (*i)->ID == 124 && (*i)->pos == h->getPosition())
|
if(*i && (*i)->ID == Obj::HOLE && (*i)->pos == h->getPosition())
|
||||||
{
|
{
|
||||||
complain("Cannot dig - there is already a hole under the hero!");
|
complain("Cannot dig - there is already a hole under the hero!");
|
||||||
return false;
|
return false;
|
||||||
@ -5181,7 +5182,7 @@ bool CGameHandler::dig( const CGHeroInstance *h )
|
|||||||
|
|
||||||
//create a hole
|
//create a hole
|
||||||
NewObject no;
|
NewObject no;
|
||||||
no.ID = 124;
|
no.ID = Obj::HOLE;
|
||||||
no.pos = h->getPosition();
|
no.pos = h->getPosition();
|
||||||
no.subID = getTile(no.pos)->tertype;
|
no.subID = getTile(no.pos)->tertype;
|
||||||
sendAndApply(&no);
|
sendAndApply(&no);
|
||||||
@ -5373,7 +5374,7 @@ bool CGameHandler::castSpell(const CGHeroInstance *h, int spellID, const int3 &p
|
|||||||
|
|
||||||
BOOST_FOREACH(const CGObjectInstance *obj, gs->map->objects)
|
BOOST_FOREACH(const CGObjectInstance *obj, gs->map->objects)
|
||||||
{
|
{
|
||||||
if(obj && obj->ID == 8)
|
if(obj && obj->ID == Obj::BOAT)
|
||||||
{
|
{
|
||||||
const CGBoat *b = static_cast<const CGBoat*>(obj);
|
const CGBoat *b = static_cast<const CGBoat*>(obj);
|
||||||
if(b->hero) continue; //we're looking for unoccupied boat
|
if(b->hero) continue; //we're looking for unoccupied boat
|
||||||
@ -5430,7 +5431,7 @@ bool CGameHandler::castSpell(const CGHeroInstance *h, int spellID, const int3 &p
|
|||||||
|
|
||||||
//TODO: test range, visibility
|
//TODO: test range, visibility
|
||||||
const TerrainTile *t = &gs->map->getTile(pos);
|
const TerrainTile *t = &gs->map->getTile(pos);
|
||||||
if(!t->visitableObjects.size() || t->visitableObjects.back()->ID != 8)
|
if(!t->visitableObjects.size() || t->visitableObjects.back()->ID != Obj::BOAT)
|
||||||
COMPLAIN_RET("There is no boat to scuttle!");
|
COMPLAIN_RET("There is no boat to scuttle!");
|
||||||
|
|
||||||
RemoveObject ro;
|
RemoveObject ro;
|
||||||
@ -5512,7 +5513,7 @@ bool CGameHandler::castSpell(const CGHeroInstance *h, int spellID, const int3 &p
|
|||||||
if (!gs->map->isInTheMap(pos))
|
if (!gs->map->isInTheMap(pos))
|
||||||
COMPLAIN_RET("Destination tile not present!")
|
COMPLAIN_RET("Destination tile not present!")
|
||||||
TerrainTile tile = gs->map->getTile(pos);
|
TerrainTile tile = gs->map->getTile(pos);
|
||||||
if (tile.visitableObjects.empty() || tile.visitableObjects.back()->ID != GameConstants::TOWNI_TYPE )
|
if (tile.visitableObjects.empty() || tile.visitableObjects.back()->ID != Obj::TOWN )
|
||||||
COMPLAIN_RET("Town not found for Town Portal!");
|
COMPLAIN_RET("Town not found for Town Portal!");
|
||||||
|
|
||||||
CGTownInstance * town = static_cast<CGTownInstance*>(tile.visitableObjects.back());
|
CGTownInstance * town = static_cast<CGTownInstance*>(tile.visitableObjects.back());
|
||||||
|
@ -214,9 +214,9 @@ public:
|
|||||||
bool sellCreatures(ui32 count, const IMarket *market, const CGHeroInstance * hero, ui32 slot, ui32 resourceID);
|
bool sellCreatures(ui32 count, const IMarket *market, const CGHeroInstance * hero, ui32 slot, ui32 resourceID);
|
||||||
bool transformInUndead(const IMarket *market, const CGHeroInstance * hero, ui32 slot);
|
bool transformInUndead(const IMarket *market, const CGHeroInstance * hero, ui32 slot);
|
||||||
bool assembleArtifacts (si32 heroID, ui16 artifactSlot, bool assemble, ui32 assembleTo);
|
bool assembleArtifacts (si32 heroID, ui16 artifactSlot, bool assemble, ui32 assembleTo);
|
||||||
bool buyArtifact( ui32 hid, si32 aid ); //for blacksmith and mage guild only -> buying for gold in common buildings
|
bool buyArtifact( ui32 hid, TArtifactID aid ); //for blacksmith and mage guild only -> buying for gold in common buildings
|
||||||
bool buyArtifact( const IMarket *m, const CGHeroInstance *h, int rid, int aid); //for artifact merchant and black market -> buying for any resource in special building / advobject
|
bool buyArtifact( const IMarket *m, const CGHeroInstance *h, TArtifactID rid, TArtifactID aid); //for artifact merchant and black market -> buying for any resource in special building / advobject
|
||||||
bool sellArtifact( const IMarket *m, const CGHeroInstance *h, int aid, int rid); //for artifact merchant selling
|
bool sellArtifact( const IMarket *m, const CGHeroInstance *h, TArtifactID aid, TArtifactID rid); //for artifact merchant selling
|
||||||
//void lootArtifacts (TArtHolder source, TArtHolder dest, std::vector<ui32> &arts); //after battle - move al arts to winer
|
//void lootArtifacts (TArtHolder source, TArtHolder dest, std::vector<ui32> &arts); //after battle - move al arts to winer
|
||||||
bool buySecSkill( const IMarket *m, const CGHeroInstance *h, int skill);
|
bool buySecSkill( const IMarket *m, const CGHeroInstance *h, int skill);
|
||||||
bool garrisonSwap(si32 tid);
|
bool garrisonSwap(si32 tid);
|
||||||
|
@ -211,7 +211,7 @@ bool HireHero::applyGh( CGameHandler *gh )
|
|||||||
{
|
{
|
||||||
const CGObjectInstance *obj = gh->getObj(tid);
|
const CGObjectInstance *obj = gh->getObj(tid);
|
||||||
|
|
||||||
if(obj->ID == GameConstants::TOWNI_TYPE)
|
if(obj->ID == Obj::TOWN)
|
||||||
ERROR_IF_NOT_OWNS(tid);
|
ERROR_IF_NOT_OWNS(tid);
|
||||||
//TODO check for visiting hero
|
//TODO check for visiting hero
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user