Skip to content

Commit

Permalink
Update Maps::SortBlockEvents to include spoors and item spatters
Browse files Browse the repository at this point in the history
  • Loading branch information
quietust committed Aug 20, 2014
1 parent ae80ca9 commit deee486
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
8 changes: 6 additions & 2 deletions library/include/modules/Maps.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ distribution.
#include "df/block_square_event_world_constructionst.h"
#include "df/block_square_event_material_spatterst.h"
#include "df/block_square_event_grassst.h"
#include "df/block_square_event_spoorst.h"
#include "df/block_square_event_item_spatterst.h"
#include "df/tile_liquid.h"
#include "df/tile_dig_designation.h"
#include "df/tile_traffic.h"
Expand Down Expand Up @@ -301,9 +303,11 @@ DFHACK_EXPORT df::flow_info *spawnFlow(df::coord pos, df::flow_type type, int ma
extern DFHACK_EXPORT bool SortBlockEvents(df::map_block *block,
std::vector<df::block_square_event_mineralst *>* veins,
std::vector<df::block_square_event_frozen_liquidst *>* ices = 0,
std::vector<df::block_square_event_material_spatterst *>* splatter = 0,
std::vector<df::block_square_event_material_spatterst *>* materials = 0,
std::vector<df::block_square_event_grassst *>* grass = 0,
std::vector<df::block_square_event_world_constructionst *>* constructions = 0
std::vector<df::block_square_event_world_constructionst *>* constructions = 0,
std::vector<df::block_square_event_spoorst *>* spoors = 0,
std::vector<df::block_square_event_item_spatterst *>* items = 0
);

/// remove a block event from the block by address
Expand Down
36 changes: 25 additions & 11 deletions library/modules/Maps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,20 +386,26 @@ bool Maps::ReadFeatures(df::map_block * block, t_feature * local, t_feature * gl
bool Maps::SortBlockEvents(df::map_block *block,
vector <df::block_square_event_mineralst *>* veins,
vector <df::block_square_event_frozen_liquidst *>* ices,
vector <df::block_square_event_material_spatterst *> *splatter,
vector <df::block_square_event_material_spatterst *> *materials,
vector <df::block_square_event_grassst *> *grasses,
vector <df::block_square_event_world_constructionst *> *constructions)
vector <df::block_square_event_world_constructionst *> *constructions,
vector <df::block_square_event_spoorst *> *spoors,
vector <df::block_square_event_item_spatterst *> *items)
{
if (veins)
veins->clear();
if (ices)
ices->clear();
if (splatter)
splatter->clear();
if (grasses)
grasses->clear();
if (constructions)
constructions->clear();
if (materials)
materials->clear();
if (grasses)
grasses->clear();
if (spoors)
spoors->clear();
if (items)
items->clear();

if (!block)
return false;
Expand All @@ -418,17 +424,25 @@ bool Maps::SortBlockEvents(df::map_block *block,
if (ices)
ices->push_back((df::block_square_event_frozen_liquidst *)evt);
break;
case block_square_event_type::world_construction:
if (constructions)
constructions->push_back((df::block_square_event_world_constructionst *)evt);
break;
case block_square_event_type::material_spatter:
if (splatter)
splatter->push_back((df::block_square_event_material_spatterst *)evt);
if (materials)
materials->push_back((df::block_square_event_material_spatterst *)evt);
break;
case block_square_event_type::grass:
if (grasses)
grasses->push_back((df::block_square_event_grassst *)evt);
break;
case block_square_event_type::world_construction:
if (constructions)
constructions->push_back((df::block_square_event_world_constructionst *)evt);
case block_square_event_type::spoor:
if (spoors)
spoors->push_back((df::block_square_event_spoorst *)evt);
break;
case block_square_event_type::item_spatter:
if (items)
items->push_back((df::block_square_event_item_spatterst *)evt);
break;
}
}
Expand Down

0 comments on commit deee486

Please sign in to comment.