DjWarmonger 11 år sedan
förälder
incheckning
c832eab172
1 ändrade filer med 4 tillägg och 2 borttagningar
  1. 4 2
      lib/NetPacksLib.cpp

+ 4 - 2
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);