mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Fixed #1909
This commit is contained in:
parent
e40818f2c6
commit
c832eab172
@ -616,12 +616,15 @@ DLL_LINKAGE void GiveHero::applyGs( CGameState *gs )
|
|||||||
|
|
||||||
DLL_LINKAGE void NewObject::applyGs( CGameState *gs )
|
DLL_LINKAGE void NewObject::applyGs( CGameState *gs )
|
||||||
{
|
{
|
||||||
|
const TerrainTile &t = gs->map->getTile(pos);
|
||||||
|
ETerrainType terrainType = t.terType;
|
||||||
|
|
||||||
CGObjectInstance *o = nullptr;
|
CGObjectInstance *o = nullptr;
|
||||||
switch(ID)
|
switch(ID)
|
||||||
{
|
{
|
||||||
case Obj::BOAT:
|
case Obj::BOAT:
|
||||||
o = new CGBoat();
|
o = new CGBoat();
|
||||||
|
terrainType = ETerrainType::WATER; //TODO: either boat should only spawn on water, or all water objects should be handled this way
|
||||||
break;
|
break;
|
||||||
case Obj::MONSTER: //probably more options will be needed
|
case Obj::MONSTER: //probably more options will be needed
|
||||||
o = new CGCreature();
|
o = new CGCreature();
|
||||||
@ -643,8 +646,7 @@ DLL_LINKAGE void NewObject::applyGs( CGameState *gs )
|
|||||||
o->ID = ID;
|
o->ID = ID;
|
||||||
o->subID = subID;
|
o->subID = subID;
|
||||||
o->pos = pos;
|
o->pos = pos;
|
||||||
const TerrainTile &t = gs->map->getTile(pos);
|
o->appearance = VLC->objtypeh->getHandlerFor(o->ID, o->subID)->getTemplates(terrainType).front();
|
||||||
o->appearance = VLC->objtypeh->getHandlerFor(o->ID, o->subID)->getTemplates(t.terType).front();
|
|
||||||
id = o->id = ObjectInstanceID(gs->map->objects.size());
|
id = o->id = ObjectInstanceID(gs->map->objects.size());
|
||||||
|
|
||||||
gs->map->objects.push_back(o);
|
gs->map->objects.push_back(o);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user