diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index e250397af..4da5c5d13 100644 --- a/lib/NetPacksLib.cpp +++ b/lib/NetPacksLib.cpp @@ -616,12 +616,15 @@ DLL_LINKAGE void GiveHero::applyGs( CGameState *gs ) DLL_LINKAGE void NewObject::applyGs( CGameState *gs ) { + const TerrainTile &t = gs->map->getTile(pos); + ETerrainType terrainType = t.terType; CGObjectInstance *o = nullptr; switch(ID) { case Obj::BOAT: o = new CGBoat(); + terrainType = ETerrainType::WATER; //TODO: either boat should only spawn on water, or all water objects should be handled this way break; case Obj::MONSTER: //probably more options will be needed o = new CGCreature(); @@ -643,8 +646,7 @@ DLL_LINKAGE void NewObject::applyGs( CGameState *gs ) o->ID = ID; o->subID = subID; o->pos = pos; - const TerrainTile &t = gs->map->getTile(pos); - o->appearance = VLC->objtypeh->getHandlerFor(o->ID, o->subID)->getTemplates(t.terType).front(); + o->appearance = VLC->objtypeh->getHandlerFor(o->ID, o->subID)->getTemplates(terrainType).front(); id = o->id = ObjectInstanceID(gs->map->objects.size()); gs->map->objects.push_back(o);