mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Prepare transport enum
This commit is contained in:
parent
2babb5add5
commit
ed798b06da
@ -228,7 +228,7 @@ bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater)
|
||||
}
|
||||
else if(!fromWater) // do not try to board when in water sector
|
||||
{
|
||||
if(t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::BOAT)
|
||||
if(t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::TRANSPORT)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -450,7 +450,7 @@ bool shouldVisit(const Nullkiller * ai, const CGHeroInstance * h, const CGObject
|
||||
return ai->cb->getHeroesInfo().size() < VLC->settings()->getInteger(EGameSettings::HEROES_PER_PLAYER_ON_MAP_CAP);
|
||||
case Obj::TAVERN:
|
||||
case Obj::EYE_OF_MAGI:
|
||||
case Obj::BOAT:
|
||||
case Obj::TRANSPORT:
|
||||
case Obj::SIGN:
|
||||
return false;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ void ObjectClusterizer::clusterize()
|
||||
blockedObjects.clear();
|
||||
|
||||
Obj ignoreObjects[] = {
|
||||
Obj::BOAT,
|
||||
Obj::TRANSPORT,
|
||||
Obj::EYE_OF_MAGI,
|
||||
Obj::MONOLITH_ONE_WAY_ENTRANCE,
|
||||
Obj::MONOLITH_ONE_WAY_EXIT,
|
||||
|
@ -198,7 +198,7 @@ bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater)
|
||||
}
|
||||
else if(!fromWater) // do not try to board when in water sector
|
||||
{
|
||||
if(t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::BOAT)
|
||||
if(t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::TRANSPORT)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -2868,7 +2868,7 @@ bool shouldVisit(HeroPtr h, const CGObjectInstance * obj)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case Obj::BOAT:
|
||||
case Obj::TRANSPORT:
|
||||
return false;
|
||||
//Boats are handled by pathfinder
|
||||
case Obj::EYE_OF_MAGI:
|
||||
|
@ -1490,14 +1490,14 @@ void CPlayerInterface::showShipyardDialog(const IShipyard *obj)
|
||||
auto state = obj->shipyardStatus();
|
||||
TResources cost;
|
||||
obj->getBoatCost(cost);
|
||||
GH.pushIntT<CShipyardWindow>(cost, state, obj->getBoatType(), [=](){ cb->buildBoat(obj); });
|
||||
GH.pushIntT<CShipyardWindow>(cost, state, obj->getTransportType(), [=](){ cb->buildBoat(obj); });
|
||||
}
|
||||
|
||||
void CPlayerInterface::newObject( const CGObjectInstance * obj )
|
||||
{
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
//we might have built a boat in shipyard in opened town screen
|
||||
if (obj->ID == Obj::BOAT
|
||||
if (obj->ID == Obj::TRANSPORT
|
||||
&& LOCPLINT->castleInt
|
||||
&& obj->visitablePos() == LOCPLINT->castleInt->town->bestLocation())
|
||||
{
|
||||
|
@ -1083,7 +1083,7 @@ void CAdvMapInt::onTileLeftClicked(const int3 &mapPos)
|
||||
switch(spellBeingCasted->id)
|
||||
{
|
||||
case SpellID::SCUTTLE_BOAT: //Scuttle Boat
|
||||
if(topBlocking && topBlocking->ID == Obj::BOAT)
|
||||
if(topBlocking && topBlocking->ID == Obj::TRANSPORT)
|
||||
leaveCastingMode(true, mapPos);
|
||||
break;
|
||||
case SpellID::DIMENSION_DOOR:
|
||||
@ -1179,7 +1179,7 @@ void CAdvMapInt::onTileHovered(const int3 &mapPos)
|
||||
switch(spellBeingCasted->id)
|
||||
{
|
||||
case SpellID::SCUTTLE_BOAT:
|
||||
if(objAtTile && objAtTile->ID == Obj::BOAT)
|
||||
if(objAtTile && objAtTile->ID == Obj::TRANSPORT)
|
||||
CCS->curh->set(Cursor::Map::SCUTTLE_BOAT);
|
||||
else
|
||||
CCS->curh->set(Cursor::Map::POINTER);
|
||||
|
@ -392,7 +392,7 @@ std::shared_ptr<CAnimation> MapRendererObjects::getBaseAnimation(const CGObjectI
|
||||
return std::shared_ptr<CAnimation>();
|
||||
}
|
||||
|
||||
bool generateMovementGroups = (info->id == Obj::BOAT) || (info->id == Obj::HERO);
|
||||
bool generateMovementGroups = (info->id == Obj::TRANSPORT) || (info->id == Obj::HERO);
|
||||
|
||||
//TODO: relocate to config file?
|
||||
// Boat appearance files only contain single, unanimated image
|
||||
@ -401,7 +401,7 @@ std::shared_ptr<CAnimation> MapRendererObjects::getBaseAnimation(const CGObjectI
|
||||
"AB01_.def", "AB02_.def", "AB03_.def"
|
||||
};
|
||||
|
||||
if (info->id == Obj::BOAT)
|
||||
if (info->id == Obj::TRANSPORT && info->subid < boatAnimations.size())
|
||||
return getAnimation(boatAnimations[info->subid], generateMovementGroups);
|
||||
|
||||
return getAnimation(info->animationFile, generateMovementGroups);
|
||||
@ -452,11 +452,10 @@ std::shared_ptr<CAnimation> MapRendererObjects::getFlagAnimation(const CGObjectI
|
||||
return getAnimation(heroFlags[obj->tempOwner.getNum()], true);
|
||||
}
|
||||
|
||||
if(obj->ID == Obj::BOAT)
|
||||
if(obj->ID == Obj::TRANSPORT)
|
||||
{
|
||||
const auto * boat = dynamic_cast<const CGBoat *>(obj);
|
||||
assert(boat->subID < boatFlags.size());
|
||||
if (boat->hero)
|
||||
if(boat->hero && boat->subID < boatFlags.size())
|
||||
{
|
||||
assert(boat->hero->tempOwner.isValidPlayer());
|
||||
return getAnimation(boatFlags[boat->subID][boat->hero->tempOwner.getNum()], true);
|
||||
@ -468,7 +467,7 @@ std::shared_ptr<CAnimation> MapRendererObjects::getFlagAnimation(const CGObjectI
|
||||
|
||||
std::shared_ptr<CAnimation> MapRendererObjects::getOverlayAnimation(const CGObjectInstance * obj)
|
||||
{
|
||||
if(obj->ID == Obj::BOAT)
|
||||
if(obj->ID == Obj::TRANSPORT)
|
||||
{
|
||||
//TODO: relocate to config file?
|
||||
// Boats have additional animation with waves around boat
|
||||
|
@ -39,7 +39,7 @@ uint32_t MapRendererBaseContext::getObjectRotation(ObjectInstanceID objectID) co
|
||||
return hero->moveDir;
|
||||
}
|
||||
|
||||
if(obj->ID == Obj::BOAT)
|
||||
if(obj->ID == Obj::TRANSPORT)
|
||||
{
|
||||
const auto * boat = dynamic_cast<const CGBoat *>(obj);
|
||||
|
||||
|
@ -276,7 +276,7 @@ void MapViewController::fadeInObject(const CGObjectInstance * obj)
|
||||
|
||||
void MapViewController::removeObject(const CGObjectInstance * obj)
|
||||
{
|
||||
if (obj->ID == Obj::BOAT)
|
||||
if (obj->ID == Obj::TRANSPORT)
|
||||
{
|
||||
auto * boat = dynamic_cast<const CGBoat*>(obj);
|
||||
if (boat->hero)
|
||||
|
@ -595,7 +595,7 @@ void CCastleBuildings::recreate()
|
||||
logGlobal->warn("Shipyard in non-coastal town!");
|
||||
std::vector <const CGObjectInstance *> vobjs = LOCPLINT->cb->getVisitableObjs(bayPos, false);
|
||||
//there is visitable obj at shipyard output tile and it's a boat or hero (on boat)
|
||||
if(!vobjs.empty() && (vobjs.front()->ID == Obj::BOAT || vobjs.front()->ID == Obj::HERO))
|
||||
if(!vobjs.empty() && (vobjs.front()->ID == Obj::TRANSPORT || vobjs.front()->ID == Obj::HERO))
|
||||
{
|
||||
buildingsCopy.insert(BuildingID::SHIP);
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ void CExchangeWindow::updateWidgets()
|
||||
}
|
||||
}
|
||||
|
||||
CShipyardWindow::CShipyardWindow(const TResources & cost, int state, int boatType, const std::function<void()> & onBuy)
|
||||
CShipyardWindow::CShipyardWindow(const TResources & cost, int state, TransportId boatType, const std::function<void()> & onBuy)
|
||||
: CStatusbarWindow(PLAYER_COLORED, "TPSHIP")
|
||||
{
|
||||
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
|
||||
@ -1089,7 +1089,7 @@ CShipyardWindow::CShipyardWindow(const TResources & cost, int state, int boatTyp
|
||||
std::string boatFilenames[3] = {"AB01_", "AB02_", "AB03_"};
|
||||
|
||||
Point waterCenter = Point(bgWater->pos.x+bgWater->pos.w/2, bgWater->pos.y+bgWater->pos.h/2);
|
||||
bgShip = std::make_shared<CAnimImage>(boatFilenames[boatType], 0, 7, 120, 96, 0);
|
||||
bgShip = std::make_shared<CAnimImage>(boatFilenames[boatType.getNum()], 0, 7, 120, 96, 0);
|
||||
bgShip->center(waterCenter);
|
||||
|
||||
// Create resource icons and costs.
|
||||
|
@ -358,7 +358,7 @@ class CShipyardWindow : public CStatusbarWindow
|
||||
std::shared_ptr<CButton> quit;
|
||||
|
||||
public:
|
||||
CShipyardWindow(const TResources & cost, int state, int boatType, const std::function<void()> & onBuy);
|
||||
CShipyardWindow(const TResources & cost, int state, TransportId boatType, const std::function<void()> & onBuy);
|
||||
};
|
||||
|
||||
/// Creature transformer window
|
||||
|
@ -668,10 +668,10 @@ PathfinderBlockingRule::BlockingReason MovementToDestinationRule::getBlockingRea
|
||||
if(!destination.isNodeObjectVisitable())
|
||||
return BlockingReason::DESTINATION_BLOCKED;
|
||||
|
||||
if(destination.nodeObject->ID != Obj::BOAT && !destination.nodeHero)
|
||||
if(destination.nodeObject->ID != Obj::TRANSPORT && !destination.nodeHero)
|
||||
return BlockingReason::DESTINATION_BLOCKED;
|
||||
}
|
||||
else if(destination.isNodeObjectVisitable() && destination.nodeObject->ID == Obj::BOAT)
|
||||
else if(destination.isNodeObjectVisitable() && destination.nodeObject->ID == Obj::TRANSPORT)
|
||||
{
|
||||
/// Hero in boat can't visit empty boats
|
||||
return BlockingReason::DESTINATION_BLOCKED;
|
||||
@ -810,7 +810,7 @@ void DestinationActionRule::process(
|
||||
{
|
||||
auto objRel = destination.objectRelations;
|
||||
|
||||
if(destination.nodeObject->ID == Obj::BOAT)
|
||||
if(destination.nodeObject->ID == Obj::TRANSPORT)
|
||||
action = CGPathNode::EMBARK;
|
||||
else if(destination.nodeHero)
|
||||
{
|
||||
|
@ -756,7 +756,7 @@ public:
|
||||
ARTIFACT = 5,
|
||||
PANDORAS_BOX = 6,
|
||||
BLACK_MARKET = 7,
|
||||
BOAT = 8,
|
||||
TRANSPORT = 8,
|
||||
BORDERGUARD = 9,
|
||||
KEYMASTER = 10,
|
||||
BUOY = 11,
|
||||
@ -1241,6 +1241,27 @@ class BattleField : public BaseForID<BattleField, si32>
|
||||
DLL_LINKAGE static BattleField fromString(const std::string & identifier);
|
||||
};
|
||||
|
||||
class TransportId
|
||||
{
|
||||
public:
|
||||
enum ETransportId
|
||||
{
|
||||
NONE = -1,
|
||||
BOAT_EVIL = 0,
|
||||
BOAT_GOOD,
|
||||
BOAT_NEUTRAL
|
||||
};
|
||||
|
||||
TransportId(ETransportId _num = NONE) : num(_num)
|
||||
{}
|
||||
|
||||
ID_LIKE_CLASS_COMMON(TransportId, ETransportId)
|
||||
|
||||
ETransportId num;
|
||||
};
|
||||
|
||||
ID_LIKE_OPERATORS(TransportId, TransportId::ETransportId)
|
||||
|
||||
enum class ETerrainId {
|
||||
NATIVE_TERRAIN = -4,
|
||||
ANY_TERRAIN = -3,
|
||||
|
@ -1285,7 +1285,7 @@ void TryMoveHero::applyGs(CGameState *gs)
|
||||
if(result == EMBARK) //hero enters boat at destination tile
|
||||
{
|
||||
const TerrainTile &tt = gs->map->getTile(h->convertToVisitablePos(end));
|
||||
assert(tt.visitableObjects.size() >= 1 && tt.visitableObjects.back()->ID == Obj::BOAT); //the only visitable object at destination is Boat
|
||||
assert(tt.visitableObjects.size() >= 1 && tt.visitableObjects.back()->ID == Obj::TRANSPORT); //the only visitable object at destination is Boat
|
||||
auto * boat = dynamic_cast<CGBoat *>(tt.visitableObjects.back());
|
||||
assert(boat);
|
||||
|
||||
@ -1457,7 +1457,7 @@ void NewObject::applyGs(CGameState *gs)
|
||||
{
|
||||
TerrainId terrainType = ETerrainId::NONE;
|
||||
|
||||
if(ID == Obj::BOAT && !gs->isInTheMap(pos)) //special handling for bug #3060 - pos outside map but visitablePos is not
|
||||
if(ID == Obj::TRANSPORT && !gs->isInTheMap(pos)) //special handling for bug #3060 - pos outside map but visitablePos is not
|
||||
{
|
||||
CGObjectInstance testObject = CGObjectInstance();
|
||||
testObject.pos = pos;
|
||||
@ -1475,7 +1475,7 @@ void NewObject::applyGs(CGameState *gs)
|
||||
CGObjectInstance *o = nullptr;
|
||||
switch(ID)
|
||||
{
|
||||
case Obj::BOAT:
|
||||
case Obj::TRANSPORT:
|
||||
o = new CGBoat();
|
||||
terrainType = ETerrainId::WATER; //TODO: either boat should only spawn on water, or all water objects should be handled this way
|
||||
break;
|
||||
|
@ -935,18 +935,14 @@ si32 CGHeroInstance::getManaNewTurn() const
|
||||
// ai->putAt(this, ai->firstAvailableSlot(this));
|
||||
// }
|
||||
|
||||
int CGHeroInstance::getBoatType() const
|
||||
TransportId CGHeroInstance::getTransportType() const
|
||||
{
|
||||
switch(type->heroClass->getAlignment())
|
||||
{
|
||||
case EAlignment::GOOD:
|
||||
return 1;
|
||||
case EAlignment::EVIL:
|
||||
return 0;
|
||||
case EAlignment::NEUTRAL:
|
||||
return 2;
|
||||
default:
|
||||
throw std::runtime_error("Wrong alignment!");
|
||||
case EAlignment::EVIL : return TransportId::ETransportId::BOAT_EVIL;
|
||||
case EAlignment::GOOD : return TransportId::ETransportId::BOAT_GOOD;
|
||||
case EAlignment::NEUTRAL : return TransportId::ETransportId::BOAT_NEUTRAL;
|
||||
default: return TransportId::ETransportId::NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
int getSightRadius() const override; //sight distance (should be used if player-owned structure)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int getBoatType() const override; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
TransportId getTransportType() const override; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
void getOutOffsets(std::vector<int3> &offsets) const override; //offsets to obj pos when we boat can be placed
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1085,16 +1085,15 @@ void CGTownInstance::clearArmy() const
|
||||
}
|
||||
}
|
||||
|
||||
int CGTownInstance::getBoatType() const
|
||||
TransportId CGTownInstance::getTransportType() const
|
||||
{
|
||||
switch (town->faction->alignment)
|
||||
{
|
||||
case EAlignment::EVIL : return 0;
|
||||
case EAlignment::GOOD : return 1;
|
||||
case EAlignment::NEUTRAL : return 2;
|
||||
case EAlignment::EVIL : return TransportId::ETransportId::BOAT_EVIL;
|
||||
case EAlignment::GOOD : return TransportId::ETransportId::BOAT_GOOD;
|
||||
case EAlignment::NEUTRAL : return TransportId::ETransportId::BOAT_NEUTRAL;
|
||||
default: return TransportId::ETransportId::NONE;
|
||||
}
|
||||
assert(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CGTownInstance::getMarketEfficiency() const
|
||||
|
@ -293,7 +293,7 @@ public:
|
||||
bool passableFor(PlayerColor color) const override;
|
||||
//int3 getSightCenter() const override; //"center" tile from which the sight distance is calculated
|
||||
int getSightRadius() const override; //returns sight distance
|
||||
int getBoatType() const override; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
TransportId getTransportType() const override; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
void getOutOffsets(std::vector<int3> &offsets) const override; //offsets to obj pos when we boat can be placed. Parameter will be cleared
|
||||
int getMarketEfficiency() const override; //=market count
|
||||
bool allowsTrade(EMarketMode::EMarketMode mode) const override;
|
||||
|
@ -442,7 +442,7 @@ int3 IBoatGenerator::bestLocation() const
|
||||
{
|
||||
if(const TerrainTile *tile = IObjectInterface::cb->getTile(o->pos + offset, false)) //tile is in the map
|
||||
{
|
||||
if(tile->terType->isWater() && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::BOAT)) //and is water and is not blocked or is blocked by boat
|
||||
if(tile->terType->isWater() && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::TRANSPORT)) //and is water and is not blocked or is blocked by boat
|
||||
return o->pos + offset;
|
||||
}
|
||||
}
|
||||
@ -457,16 +457,16 @@ IBoatGenerator::EGeneratorState IBoatGenerator::shipyardStatus() const
|
||||
return TILE_BLOCKED; //no available water
|
||||
else if(t->blockingObjects.empty())
|
||||
return GOOD; //OK
|
||||
else if(t->blockingObjects.front()->ID == Obj::BOAT)
|
||||
else if(t->blockingObjects.front()->ID == Obj::TRANSPORT)
|
||||
return BOAT_ALREADY_BUILT; //blocked with boat
|
||||
else
|
||||
return TILE_BLOCKED; //blocked
|
||||
}
|
||||
|
||||
int IBoatGenerator::getBoatType() const
|
||||
TransportId IBoatGenerator::getTransportType() const
|
||||
{
|
||||
//We make good ships by default
|
||||
return 1;
|
||||
return TransportId::ETransportId::BOAT_GOOD;
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
IBoatGenerator(const CGObjectInstance *O);
|
||||
virtual ~IBoatGenerator() = default;
|
||||
|
||||
virtual int getBoatType() const; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
virtual TransportId getTransportType() 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
|
||||
int3 bestLocation() const; //returns location when the boat should be placed
|
||||
|
||||
|
@ -36,7 +36,7 @@ static bool isOnVisitableFromTopList(int identifier, int type)
|
||||
Obj::SHIPWRECK_SURVIVOR,
|
||||
Obj::BUOY,
|
||||
Obj::OCEAN_BOTTLE,
|
||||
Obj::BOAT,
|
||||
Obj::TRANSPORT,
|
||||
Obj::WHIRLPOOL,
|
||||
Obj::GARRISON,
|
||||
Obj::GARRISON2,
|
||||
|
@ -209,8 +209,8 @@ bool WaterProxy::placeBoat(Zone & land, const Lake & lake, RouteInfo & info)
|
||||
if(!manager)
|
||||
return false;
|
||||
|
||||
auto subObjects = VLC->objtypeh->knownSubObjects(Obj::BOAT);
|
||||
auto * boat = dynamic_cast<CGBoat *>(VLC->objtypeh->getHandlerFor(Obj::BOAT, *RandomGeneratorUtil::nextItem(subObjects, generator.rand))->create());
|
||||
auto subObjects = VLC->objtypeh->knownSubObjects(Obj::TRANSPORT);
|
||||
auto * boat = dynamic_cast<CGBoat *>(VLC->objtypeh->getHandlerFor(Obj::TRANSPORT, *RandomGeneratorUtil::nextItem(subObjects, generator.rand))->create());
|
||||
|
||||
rmg::Object rmgObject(*boat);
|
||||
rmgObject.setTemplate(zone.getTerrainType());
|
||||
|
@ -182,7 +182,7 @@ ESpellCastResult SummonBoatMechanics::applyAdventureEffects(SpellCastEnvironment
|
||||
double dist = 0;
|
||||
for(const CGObjectInstance * obj : env->getMap()->objects)
|
||||
{
|
||||
if(obj && obj->ID == Obj::BOAT)
|
||||
if(obj && obj->ID == Obj::TRANSPORT)
|
||||
{
|
||||
const auto * b = dynamic_cast<const CGBoat *>(obj);
|
||||
if(b->hero)
|
||||
@ -214,8 +214,8 @@ ESpellCastResult SummonBoatMechanics::applyAdventureEffects(SpellCastEnvironment
|
||||
else //create boat
|
||||
{
|
||||
NewObject no;
|
||||
no.ID = Obj::BOAT;
|
||||
no.subID = parameters.caster->getHeroCaster()->getBoatType();
|
||||
no.ID = Obj::TRANSPORT;
|
||||
no.subID = parameters.caster->getHeroCaster()->getTransportType().getNum();
|
||||
no.pos = summonPos + int3(1,0,0);
|
||||
env->apply(&no);
|
||||
}
|
||||
@ -250,7 +250,7 @@ ESpellCastResult ScuttleBoatMechanics::applyAdventureEffects(SpellCastEnvironmen
|
||||
|
||||
//TODO: test range, visibility
|
||||
const TerrainTile *t = &env->getMap()->getTile(parameters.pos);
|
||||
if(t->visitableObjects.empty() || t->visitableObjects.back()->ID != Obj::BOAT)
|
||||
if(t->visitableObjects.empty() || t->visitableObjects.back()->ID != Obj::TRANSPORT)
|
||||
{
|
||||
env->complain("There is no boat to scuttle!");
|
||||
return ESpellCastResult::ERROR;
|
||||
|
@ -663,7 +663,7 @@ void MainWindow::loadObjectsTree()
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::HERO);
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::RANDOM_HERO);
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::HERO_PLACEHOLDER);
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::BOAT);
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::TRANSPORT);
|
||||
addGroupIntoCatalog("ARTIFACTS", true, false, Obj::ARTIFACT);
|
||||
addGroupIntoCatalog("ARTIFACTS", false, false, Obj::RANDOM_ART);
|
||||
addGroupIntoCatalog("ARTIFACTS", false, false, Obj::RANDOM_TREASURE_ART);
|
||||
|
@ -187,7 +187,7 @@ void MapHandler::initObjectRects()
|
||||
CGObjectInstance *obj = const_cast<CGObjectInstance *>(elem);
|
||||
if( !obj
|
||||
|| (obj->ID==Obj::HERO && static_cast<const CGHeroInstance*>(obj)->inTownGarrison) //garrisoned hero
|
||||
|| (obj->ID==Obj::BOAT && static_cast<const CGBoat*>(obj)->hero)) //boat with hero (hero graphics is used)
|
||||
|| (obj->ID==Obj::TRANSPORT && static_cast<const CGBoat*>(obj)->hero)) //boat with hero (hero graphics is used)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -2263,7 +2263,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
|
||||
const TerrainTile t = *getTile(hmpos);
|
||||
const int3 guardPos = gs->guardingCreaturePosition(hmpos);
|
||||
|
||||
const bool embarking = !h->boat && !t.visitableObjects.empty() && t.visitableObjects.back()->ID == Obj::BOAT;
|
||||
const bool embarking = !h->boat && !t.visitableObjects.empty() && t.visitableObjects.back()->ID == Obj::TRANSPORT;
|
||||
const bool disembarking = h->boat && t.terType->isLand() && !t.blocked;
|
||||
|
||||
//result structure for start - movement failed, no move points used
|
||||
@ -2286,7 +2286,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
|
||||
//OR hero is on land and dest is water and (there is not present only one object - boat)
|
||||
if (((!t.terType->isPassable() || (t.blocked && !t.visitable && !canFly))
|
||||
&& complain("Cannot move hero, destination tile is blocked!"))
|
||||
|| ((!h->boat && !canWalkOnSea && !canFly && t.terType->isWater() && (t.visitableObjects.size() < 1 || (t.visitableObjects.back()->ID != Obj::BOAT && 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)
|
||||
|| ((!h->boat && !canWalkOnSea && !canFly && t.terType->isWater() && (t.visitableObjects.size() < 1 || (t.visitableObjects.back()->ID != Obj::TRANSPORT && 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!"))
|
||||
|| ((h->boat && t.terType->isLand() && t.blocked)
|
||||
&& complain("Cannot disembark hero, tile is blocked!"))
|
||||
@ -5624,8 +5624,8 @@ bool CGameHandler::buildBoat(ObjectInstanceID objid, PlayerColor playerID)
|
||||
|
||||
//create boat
|
||||
NewObject no;
|
||||
no.ID = Obj::BOAT;
|
||||
no.subID = obj->getBoatType();
|
||||
no.ID = Obj::TRANSPORT;
|
||||
no.subID = obj->getTransportType().getNum();
|
||||
no.pos = tile + int3(1,0,0);
|
||||
sendAndApply(&no);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user