Cleanup code to get rid of MSVC warning C4482

develop
Quietust 2012-01-31 10:17:27 -06:00
parent 70454842ae
commit a82f4c9138
8 changed files with 64 additions and 62 deletions

@ -65,6 +65,7 @@ using namespace DFHack;
using namespace tthread;
using namespace df::enums;
using df::global::init;
struct Core::Cond
{
@ -630,7 +631,7 @@ bool Core::Init()
// init the console.
Gui * g = getGui();
bool is_text_mode = false;
if(df::global::init && df::global::init->display.flag.is_set(df::enums::init_display_flags::TEXT))
if(init && init->display.flag.is_set(init_display_flags::TEXT))
{
is_text_mode = true;
}

@ -1,4 +1,4 @@
bool isOre()
{
return flags.is_set(df::inorganic_flags::METAL_ORE) || flags.is_set(df::inorganic_flags::THREAD_METAL);
return flags.is_set(df::enums::inorganic_flags::METAL_ORE) || flags.is_set(df::enums::inorganic_flags::THREAD_METAL);
}

@ -1,8 +1,8 @@
bool isGem()
{
return flags.is_set(df::material_flags::IS_GEM);
return flags.is_set(df::enums::material_flags::IS_GEM);
}
bool isStone()
{
return flags.is_set(df::material_flags::IS_STONE);
return flags.is_set(df::enums::material_flags::IS_STONE);
}

@ -430,7 +430,7 @@ int32_t Items::getItemOwnerID(const df::item * item)
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::UNIT_ITEMOWNER)
if (ref->getType() == general_ref_type::UNIT_ITEMOWNER)
return ref->getID();
}
return -1;
@ -441,7 +441,7 @@ df::unit *Items::getItemOwner(const df::item * item)
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::UNIT_ITEMOWNER)
if (ref->getType() == general_ref_type::UNIT_ITEMOWNER)
return ref->getUnit();
}
return NULL;
@ -452,7 +452,7 @@ int32_t Items::getItemContainerID(const df::item * item)
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::CONTAINED_IN_ITEM)
if (ref->getType() == general_ref_type::CONTAINED_IN_ITEM)
return ref->getID();
}
return -1;
@ -463,7 +463,7 @@ df::item *Items::getItemContainer(const df::item * item)
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::CONTAINED_IN_ITEM)
if (ref->getType() == general_ref_type::CONTAINED_IN_ITEM)
return ref->getItem();
}
return NULL;
@ -471,7 +471,7 @@ df::item *Items::getItemContainer(const df::item * item)
bool Items::getContainedItems(const df::item * item, std::vector<int32_t> &items)
{
return readItemRefs(item, df::general_ref_type::CONTAINS_ITEM, items);
return readItemRefs(item, general_ref_type::CONTAINS_ITEM, items);
}
bool Items::readItemRefs(const df::item * item, df::general_ref_type type, std::vector<int32_t> &values)
@ -493,7 +493,7 @@ bool Items::removeItemOwner(df::item * item)
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() != df::general_ref_type::UNIT_ITEMOWNER)
if (ref->getType() != general_ref_type::UNIT_ITEMOWNER)
continue;
df::unit *unit = ref->getUnit();

@ -48,31 +48,32 @@ using namespace std;
using namespace DFHack;
using namespace DFHack::Simple;
using namespace df::enums;
using df::global::world;
const char * DFHack::sa_feature(df::feature_type index)
{
switch(index)
{
case df::feature_type::outdoor_river:
case feature_type::outdoor_river:
return "River";
case df::feature_type::cave:
case feature_type::cave:
return "Cave";
case df::feature_type::pit:
case feature_type::pit:
return "Pit";
case df::feature_type::magma_pool:
case feature_type::magma_pool:
return "Magma pool";
case df::feature_type::volcano:
case feature_type::volcano:
return "Volcano";
case df::feature_type::deep_special_tube:
case feature_type::deep_special_tube:
return "Adamantine deposit";
case df::feature_type::deep_surface_portal:
case feature_type::deep_surface_portal:
return "Underworld portal";
case df::feature_type::subterranean_from_layer:
case feature_type::subterranean_from_layer:
return "Cavern";
case df::feature_type::magma_core_from_layer:
case feature_type::magma_core_from_layer:
return "Magma sea";
case df::feature_type::feature_underworld_from_layer:
case feature_type::feature_underworld_from_layer:
return "Underworld";
default:
return "Unknown/Error";
@ -184,7 +185,7 @@ bool Maps::ReadDirtyBit(uint32_t x, uint32_t y, uint32_t z, bool &dirtybit)
df::map_block *block = getBlock(x,y,z);
if (block)
{
dirtybit = block->flags.is_set(df::block_flags::Designated);
dirtybit = block->flags.is_set(block_flags::Designated);
return true;
}
return false;
@ -195,7 +196,7 @@ bool Maps::WriteDirtyBit(uint32_t x, uint32_t y, uint32_t z, bool dirtybit)
df::map_block *block = getBlock(x,y,z);
if (block)
{
block->flags.set(df::block_flags::Designated, dirtybit);
block->flags.set(block_flags::Designated, dirtybit);
return true;
}
return false;
@ -475,7 +476,7 @@ bool Maps::SortBlockEvents(uint32_t x, uint32_t y, uint32_t z,
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_grassst *> *grass,
vector <df::block_square_event_grassst *> *grasses,
vector <df::block_square_event_world_constructionst *> *constructions)
{
if (veins)
@ -484,8 +485,8 @@ bool Maps::SortBlockEvents(uint32_t x, uint32_t y, uint32_t z,
ices->clear();
if (splatter)
splatter->clear();
if (grass)
grass->clear();
if (grasses)
grasses->clear();
if (constructions)
constructions->clear();
@ -500,23 +501,23 @@ bool Maps::SortBlockEvents(uint32_t x, uint32_t y, uint32_t z,
df::block_square_event *evt = block->block_events[i];
switch (evt->getType())
{
case df::block_square_event_type::mineral:
case block_square_event_type::mineral:
if (veins)
veins->push_back((df::block_square_event_mineralst *)evt);
break;
case df::block_square_event_type::frozen_liquid:
case block_square_event_type::frozen_liquid:
if (ices)
ices->push_back((df::block_square_event_frozen_liquidst *)evt);
break;
case df::block_square_event_type::material_spatter:
case block_square_event_type::material_spatter:
if (splatter)
splatter->push_back((df::block_square_event_material_spatterst *)evt);
break;
case df::block_square_event_type::grass:
if (grass)
grass->push_back((df::block_square_event_grassst *)evt);
case block_square_event_type::grass:
if (grasses)
grasses->push_back((df::block_square_event_grassst *)evt);
break;
case df::block_square_event_type::world_construction:
case block_square_event_type::world_construction:
if (constructions)
constructions->push_back((df::block_square_event_world_constructionst *)evt);
break;

@ -781,26 +781,26 @@ bool Materials::ReadCreatureTypesEx (void)
for (int32_t k = 0; k < 7; k++)
{
caste.strength[k] = ca->attributes.phys_att_range[df::physical_attribute_type::STRENGTH][k];
caste.agility[k] = ca->attributes.phys_att_range[df::physical_attribute_type::AGILITY][k];
caste.toughness[k] = ca->attributes.phys_att_range[df::physical_attribute_type::TOUGHNESS][k];
caste.endurance[k] = ca->attributes.phys_att_range[df::physical_attribute_type::ENDURANCE][k];
caste.recuperation[k] = ca->attributes.phys_att_range[df::physical_attribute_type::RECUPERATION][k];
caste.disease_resistance[k] = ca->attributes.phys_att_range[df::physical_attribute_type::DISEASE_RESISTANCE][k];
caste.analytical_ability[k] = ca->attributes.phys_att_range[df::mental_attribute_type::ANALYTICAL_ABILITY][k];
caste.focus[k] = ca->attributes.phys_att_range[df::mental_attribute_type::FOCUS][k];
caste.willpower[k] = ca->attributes.phys_att_range[df::mental_attribute_type::WILLPOWER][k];
caste.creativity[k] = ca->attributes.phys_att_range[df::mental_attribute_type::CREATIVITY][k];
caste.intuition[k] = ca->attributes.phys_att_range[df::mental_attribute_type::INTUITION][k];
caste.patience[k] = ca->attributes.phys_att_range[df::mental_attribute_type::PATIENCE][k];
caste.memory[k] = ca->attributes.phys_att_range[df::mental_attribute_type::MEMORY][k];
caste.linguistic_ability[k] = ca->attributes.phys_att_range[df::mental_attribute_type::LINGUISTIC_ABILITY][k];
caste.spatial_sense[k] = ca->attributes.phys_att_range[df::mental_attribute_type::SPATIAL_SENSE][k];
caste.musicality[k] = ca->attributes.phys_att_range[df::mental_attribute_type::MUSICALITY][k];
caste.kinesthetic_sense[k] = ca->attributes.phys_att_range[df::mental_attribute_type::KINESTHETIC_SENSE][k];
caste.empathy[k] = ca->attributes.phys_att_range[df::mental_attribute_type::EMPATHY][k];
caste.social_awareness[k] = ca->attributes.phys_att_range[df::mental_attribute_type::SOCIAL_AWARENESS][k];
caste.strength[k] = ca->attributes.phys_att_range[physical_attribute_type::STRENGTH][k];
caste.agility[k] = ca->attributes.phys_att_range[physical_attribute_type::AGILITY][k];
caste.toughness[k] = ca->attributes.phys_att_range[physical_attribute_type::TOUGHNESS][k];
caste.endurance[k] = ca->attributes.phys_att_range[physical_attribute_type::ENDURANCE][k];
caste.recuperation[k] = ca->attributes.phys_att_range[physical_attribute_type::RECUPERATION][k];
caste.disease_resistance[k] = ca->attributes.phys_att_range[physical_attribute_type::DISEASE_RESISTANCE][k];
caste.analytical_ability[k] = ca->attributes.phys_att_range[mental_attribute_type::ANALYTICAL_ABILITY][k];
caste.focus[k] = ca->attributes.phys_att_range[mental_attribute_type::FOCUS][k];
caste.willpower[k] = ca->attributes.phys_att_range[mental_attribute_type::WILLPOWER][k];
caste.creativity[k] = ca->attributes.phys_att_range[mental_attribute_type::CREATIVITY][k];
caste.intuition[k] = ca->attributes.phys_att_range[mental_attribute_type::INTUITION][k];
caste.patience[k] = ca->attributes.phys_att_range[mental_attribute_type::PATIENCE][k];
caste.memory[k] = ca->attributes.phys_att_range[mental_attribute_type::MEMORY][k];
caste.linguistic_ability[k] = ca->attributes.phys_att_range[mental_attribute_type::LINGUISTIC_ABILITY][k];
caste.spatial_sense[k] = ca->attributes.phys_att_range[mental_attribute_type::SPATIAL_SENSE][k];
caste.musicality[k] = ca->attributes.phys_att_range[mental_attribute_type::MUSICALITY][k];
caste.kinesthetic_sense[k] = ca->attributes.phys_att_range[mental_attribute_type::KINESTHETIC_SENSE][k];
caste.empathy[k] = ca->attributes.phys_att_range[mental_attribute_type::EMPATHY][k];
caste.social_awareness[k] = ca->attributes.phys_att_range[mental_attribute_type::SOCIAL_AWARENESS][k];
}
mat.castes.push_back(caste);
}

@ -57,7 +57,7 @@ void Kitchen::allowPlantSeedCookery(t_materialIndex materialIndex)
for(std::size_t i = 0; i < size(); ++i)
{
if(ui->kitchen.mat_indices[i] == materialIndex
&& (ui->kitchen.item_types[i] == df::item_type::SEEDS || ui->kitchen.item_types[i] == df::item_type::PLANT)
&& (ui->kitchen.item_types[i] == item_type::SEEDS || ui->kitchen.item_types[i] == item_type::PLANT)
&& ui->kitchen.exc_types[i] == cookingExclusion
)
{
@ -86,15 +86,15 @@ void Kitchen::denyPlantSeedCookery(t_materialIndex materialIndex)
if(ui->kitchen.mat_indices[i] == materialIndex
&& ui->kitchen.exc_types[i] == cookingExclusion)
{
if(ui->kitchen.item_types[i] == df::item_type::SEEDS)
if(ui->kitchen.item_types[i] == item_type::SEEDS)
SeedAlreadyIn = true;
else if (ui->kitchen.item_types[i] == df::item_type::PLANT)
else if (ui->kitchen.item_types[i] == item_type::PLANT)
PlantAlreadyIn = true;
}
}
if(!SeedAlreadyIn)
{
ui->kitchen.item_types.push_back(df::item_type::SEEDS);
ui->kitchen.item_types.push_back(item_type::SEEDS);
ui->kitchen.item_subtypes.push_back(organicSubtype);
ui->kitchen.mat_types.push_back(type->material_defs.type_seed);
ui->kitchen.mat_indices.push_back(materialIndex);
@ -102,7 +102,7 @@ void Kitchen::denyPlantSeedCookery(t_materialIndex materialIndex)
}
if(!PlantAlreadyIn)
{
ui->kitchen.item_types.push_back(df::item_type::PLANT);
ui->kitchen.item_types.push_back(item_type::PLANT);
ui->kitchen.item_subtypes.push_back(organicSubtype);
ui->kitchen.mat_types.push_back(type->material_defs.type_basic_mat);
ui->kitchen.mat_indices.push_back(materialIndex);

@ -984,7 +984,7 @@ static void dryBucket(df::item *item)
for (unsigned i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::CONTAINS_ITEM)
if (ref->getType() == general_ref_type::CONTAINS_ITEM)
{
df::item *obj = ref->getItem();
@ -1006,20 +1006,20 @@ static bool itemBusy(df::item *item)
for (unsigned i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::CONTAINS_ITEM)
if (ref->getType() == general_ref_type::CONTAINS_ITEM)
{
df::item *obj = ref->getItem();
if (obj && !obj->flags.bits.garbage_colect)
return true;
}
else if (ref->getType() == df::general_ref_type::CONTAINS_UNIT)
else if (ref->getType() == general_ref_type::CONTAINS_UNIT)
return true;
else if (ref->getType() == df::general_ref_type::UNIT_HOLDER)
else if (ref->getType() == general_ref_type::UNIT_HOLDER)
{
if (!item->flags.bits.in_job)
return true;
}
else if (ref->getType() == df::general_ref_type::CONTAINED_IN_ITEM)
else if (ref->getType() == general_ref_type::CONTAINED_IN_ITEM)
{
df::item *obj = ref->getItem();
if (!obj)