summaryrefslogtreecommitdiff
path: root/MapLoading.cpp
diff options
context:
space:
mode:
authorJapa Illo2012-03-24 13:27:25 +0100
committerJapa Illo2012-03-24 13:27:25 +0100
commit3f7c63d777bf3722c07fdea721652da22fd2bbc2 (patch)
treefdafc632a4c9fa26cfc82df51bd2be6261dc5bda /MapLoading.cpp
parent9e7bff5c321b3da4cf73546ede00095351ee1b43 (diff)
downloadstonesense-3f7c63d777bf3722c07fdea721652da22fd2bbc2.tar.gz
stonesense-3f7c63d777bf3722c07fdea721652da22fd2bbc2.tar.bz2
stonesense-3f7c63d777bf3722c07fdea721652da22fd2bbc2.tar.xz
Added rudimentary floor item showage.
Signed-off-by: Japa Illo <japa.mala.illo@gmail.com>
Diffstat (limited to 'MapLoading.cpp')
-rw-r--r--MapLoading.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/MapLoading.cpp b/MapLoading.cpp
index c4d0524..9037947 100644
--- a/MapLoading.cpp
+++ b/MapLoading.cpp
@@ -10,7 +10,9 @@
#include "Occlusion_Test.h"
#include <df/plant.h>
#include <df/effect.h>
-
+#include "df/item_constructed.h"
+#include "df/itemimprovement.h"
+#include "df/itemimprovement_threadst.h"
/*
static DFHack::Core* pDFApiHandle = 0;
static DFHack::Process * DFProc = 0;
@@ -491,6 +493,41 @@ void ReadCellToSegment(DFHack::Core& DF, WorldSegment& segment, int CellX, int C
}
}
+ //add items
+ for(auto iter = trueBlock->items.begin(); iter != trueBlock->items.end(); iter++)
+ {
+ int32_t item_index = *iter;
+ df::item * found_item = df::item::find(item_index);
+ if(!found_item) continue;
+ Block* b = segment.getBlock( found_item->pos.x, found_item->pos.y, found_item->pos.z);
+ if(!b) continue;
+ b->Item.item.type = found_item->getType(); //itemtype
+ b->Item.item.index = found_item->getSubtype(); //item subtype
+
+ b->Item.matt.type = found_item->getActualMaterial();
+ b->Item.matt.index = found_item->getActualMaterialIndex();
+
+ if(found_item->isDyed())
+ {
+ auto Constructed_Item = virtual_cast<df::item_constructed>(found_item);
+ if(Constructed_Item)
+ {
+ for(int idex = 0; idex < Constructed_Item->improvements.size(); idex++)
+ {
+ if(!Constructed_Item->improvements[idex])
+ continue;
+ if(Constructed_Item->improvements[idex]->getType() != improvement_type::THREAD)
+ continue;
+ auto Improvement_Thread = virtual_cast<df::itemimprovement_threadst>(Constructed_Item->improvements[idex]);
+ if(!Improvement_Thread)
+ continue;
+ b->Item.matt.type = Improvement_Thread->dye.mat_type;
+ b->Item.matt.index = Improvement_Thread->dye.mat_index;
+ }
+ }
+ }
+ }
+
//add effects
for(auto iter = trueBlock->effects.begin(); iter != trueBlock->effects.end(); iter++)
{