diff options
| author | Petr Mrázek | 2012-02-19 19:48:56 +0100 |
|---|---|---|
| committer | Petr Mrázek | 2012-02-19 19:48:56 +0100 |
| commit | c013085d0bd79ede547a1524809377d7fac4015d (patch) | |
| tree | 9145e5d4563a0bc74bdc5f2a482e79ff6629f73b /MapLoading.cpp | |
| parent | a757802f48e47929674b0ec808309932255adaa5 (diff) | |
| download | stonesense-c013085d0bd79ede547a1524809377d7fac4015d.tar.gz stonesense-c013085d0bd79ede547a1524809377d7fac4015d.tar.bz2 stonesense-c013085d0bd79ede547a1524809377d7fac4015d.tar.xz | |
Fix tree problem
Diffstat (limited to 'MapLoading.cpp')
| -rw-r--r-- | MapLoading.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/MapLoading.cpp b/MapLoading.cpp index ca8531c..7c66ab8 100644 --- a/MapLoading.cpp +++ b/MapLoading.cpp @@ -493,20 +493,23 @@ void ReadCellToSegment(DFHack::Core& DF, WorldSegment& segment, int CellX, int C }
//add trees and other vegetation
- for(int i = 0; i < plants->size(); i++)
+ for(auto iter = plants->begin(); iter != plants->end(); iter++)
{
- df::plant * wheat = plants->at(i);
+ df::plant * wheat = *iter;
+ assert(wheat != NULL);
Block* b = segment.getBlock( wheat->pos.x, wheat->pos.y, wheat->pos.z);
- if(b && (
- (b->tileMaterial == tiletype_shape::TREE) ||
- (b->tileMaterial == tiletype_shape::SAPLING) ||
- (b->tileMaterial == tiletype_shape::SHRUB)
- ))
- {
+ if(!b)
+ {
+ continue;
+ }
+ if( b->tileShape == tiletype_shape::TREE ||
+ b->tileShape == tiletype_shape::SAPLING ||
+ b->tileShape == tiletype_shape::SHRUB)
+ {
b->tree.type = wheat->flags.whole;
b->tree.index = wheat->material;
- }
- }
+ }
+ }
}
|
