Merge further changes (???)

develop
Timothy Collett 2012-09-10 09:19:21 -04:00
parent 270351f510
commit 274d6038ad
17 changed files with 29 additions and 29 deletions

@ -7,10 +7,10 @@ IF(CMAKE_COMPILER_IS_GNUCC)
STRING(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION}) STRING(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION})
LIST(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR) LIST(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR)
LIST(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR) LIST(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR)
IF(GCC_MAJOR LESS 4 OR (GCC_MAJOR EQUAL 4 AND GCC_MINOR LESS 2)) #IF(GCC_MAJOR LESS 4 OR (GCC_MAJOR EQUAL 4 AND GCC_MINOR LESS 2))
#GCC is too old #GCC is too old
SET(STL_HASH_OLD_GCC 1) # SET(STL_HASH_OLD_GCC 1)
ENDIF() #ENDIF()
#SET(CMAKE_CXX_FLAGS "-std=c++0x") #SET(CMAKE_CXX_FLAGS "-std=c++0x")
SET(HAVE_HASH_MAP 0) SET(HAVE_HASH_MAP 0)

@ -394,7 +394,7 @@ command_result RemoteFunctionBase::execute(color_ostream &out,
//out.print("Received %d:%d\n", header.id, header.size); //out.print("Received %d:%d\n", header.id, header.size);
if (header.id == RPC_REPLY_FAIL) if ((DFHack::DFHackReplyCode)header.id == RPC_REPLY_FAIL)
return header.size == CR_OK ? CR_FAILURE : command_result(header.size); return header.size == CR_OK ? CR_FAILURE : command_result(header.size);
if (header.size < 0 || header.size > RPCMessageHeader::MAX_MESSAGE_SIZE) if (header.size < 0 || header.size > RPCMessageHeader::MAX_MESSAGE_SIZE)

@ -250,7 +250,7 @@ void ServerConnection::threadFn()
break; break;
} }
if (header.id == RPC_REQUEST_QUIT) if ((DFHack::DFHackReplyCode)header.id == RPC_REQUEST_QUIT)
break; break;
if (header.size < 0 || header.size > RPCMessageHeader::MAX_MESSAGE_SIZE) if (header.size < 0 || header.size > RPCMessageHeader::MAX_MESSAGE_SIZE)

@ -287,7 +287,7 @@ void DFHack::describeUnit(BasicUnitInfo *info, df::unit *unit,
if (mask && mask->profession()) if (mask && mask->profession())
{ {
if (unit->profession >= 0) if (unit->profession >= (df::profession)0)
info->set_profession(unit->profession); info->set_profession(unit->profession);
if (!unit->custom_profession.empty()) if (!unit->custom_profession.empty())
info->set_custom_profession(unit->custom_profession); info->set_custom_profession(unit->custom_profession);

@ -506,7 +506,7 @@ namespace DFHack {
template<class T> template<class T>
inline const char *enum_item_raw_key(T val) { inline const char *enum_item_raw_key(T val) {
typedef df::enum_traits<T> traits; typedef df::enum_traits<T> traits;
return traits::is_valid(val) ? traits::key_table[val - traits::first_item_value] : NULL; return traits::is_valid(val) ? traits::key_table[(short)val - traits::first_item_value] : NULL;
} }
/** /**

@ -88,7 +88,7 @@ namespace DFHack
{ {
typedef df::enum_traits<T> traits; typedef df::enum_traits<T> traits;
int base = traits::first_item; int base = traits::first_item;
int size = traits::last_item - base + 1; int size = (int)traits::last_item - base + 1;
describeEnum(pf, base, size, traits::key_table); describeEnum(pf, base, size, traits::key_table);
} }

@ -181,7 +181,7 @@ void DFHack::Job::printItemDetails(color_ostream &out, df::job_item *item, int i
out << " reaction class: " << item->reaction_class << endl; out << " reaction class: " << item->reaction_class << endl;
if (!item->has_material_reaction_product.empty()) if (!item->has_material_reaction_product.empty())
out << " reaction product: " << item->has_material_reaction_product << endl; out << " reaction product: " << item->has_material_reaction_product << endl;
if (item->has_tool_use >= 0) if (item->has_tool_use >= (df::tool_uses)0)
out << " tool use: " << ENUM_KEY_STR(tool_uses, item->has_tool_use) << endl; out << " tool use: " << ENUM_KEY_STR(tool_uses, item->has_tool_use) << endl;
} }

@ -838,7 +838,7 @@ std::string DFHack::Units::getCasteProfessionName(int race, int casteid, df::pro
{ {
std::string prof, race_prefix; std::string prof, race_prefix;
if (pid < 0 || !is_valid_enum_item(pid)) if (pid < (df::profession)0 || !is_valid_enum_item(pid))
return ""; return "";
bool use_race_prefix = (race >= 0 && race != df::global::ui->race_id); bool use_race_prefix = (race >= 0 && race != df::global::ui->race_id);

@ -114,7 +114,7 @@ void Kitchen::fillWatchMap(std::map<t_materialIndex, unsigned int>& watchMap)
watchMap.clear(); watchMap.clear();
for(std::size_t i = 0; i < size(); ++i) for(std::size_t i = 0; i < size(); ++i)
{ {
if(ui->kitchen.item_subtypes[i] == limitType && ui->kitchen.item_subtypes[i] == limitSubtype && ui->kitchen.exc_types[i] == limitExclusion) if(ui->kitchen.item_subtypes[i] == (short)limitType && ui->kitchen.item_subtypes[i] == (short)limitSubtype && ui->kitchen.exc_types[i] == limitExclusion)
{ {
watchMap[ui->kitchen.mat_indices[i]] = (unsigned int) ui->kitchen.mat_types[i]; watchMap[ui->kitchen.mat_indices[i]] = (unsigned int) ui->kitchen.mat_types[i];
} }

@ -732,9 +732,9 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
if (df::enums::building_type::Workshop == type) if (df::enums::building_type::Workshop == type)
{ {
auto subType = build->getSubtype(); auto subType = build->getSubtype();
if (df::enums::workshop_type::Butchers == subType) if ((short)df::enums::workshop_type::Butchers == subType)
has_butchers = true; has_butchers = true;
if (df::enums::workshop_type::Fishery == subType) if ((short)df::enums::workshop_type::Fishery == subType)
has_fishery = true; has_fishery = true;
} }
else if (df::enums::building_type::TradeDepot == type) else if (df::enums::building_type::TradeDepot == type)
@ -863,7 +863,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
{ {
// 7 / 0x7 = Newly arrived migrant, will not work yet // 7 / 0x7 = Newly arrived migrant, will not work yet
// 17 / 0x11 = On break // 17 / 0x11 = On break
if ((*p)->id == 0x07 || (*p)->id == 0x11) if ((*p)->id == (df::misc_trait_type)0x07 || (*p)->id == (df::misc_trait_type)0x11)
is_on_break = true; is_on_break = true;
} }

@ -50,12 +50,12 @@ command_result cleanmap (color_ostream &out, bool snow, bool mud)
// filter snow // filter snow
if(!snow if(!snow
&& spatter->mat_type == builtin_mats::WATER && spatter->mat_type == builtin_mats::WATER
&& spatter->mat_state == matter_state::Powder) && spatter->mat_state == (short)matter_state::Powder)
continue; continue;
// filter mud // filter mud
if(!mud if(!mud
&& spatter->mat_type == builtin_mats::MUD && spatter->mat_type == builtin_mats::MUD
&& spatter->mat_state == matter_state::Solid) && spatter->mat_state == (short)matter_state::Solid)
continue; continue;
delete evt; delete evt;

@ -117,13 +117,13 @@ command_result df_cleanowned (color_ostream &out, vector <string> & parameters)
else if (item->flags.bits.on_ground) else if (item->flags.bits.on_ground)
{ {
int32_t type = item->getType(); int32_t type = item->getType();
if(type == item_type::MEAT || if((df::enums::item_type::item_type)type == item_type::MEAT ||
type == item_type::FISH || (df::enums::item_type::item_type)type == item_type::FISH ||
type == item_type::VERMIN || (df::enums::item_type::item_type)type == item_type::VERMIN ||
type == item_type::PET || (df::enums::item_type::item_type)type == item_type::PET ||
type == item_type::PLANT || (df::enums::item_type::item_type)type == item_type::PLANT ||
type == item_type::CHEESE || (df::enums::item_type::item_type)type == item_type::CHEESE ||
type == item_type::FOOD (df::enums::item_type::item_type)type == item_type::FOOD
) )
{ {
confiscate = true; confiscate = true;

@ -372,7 +372,7 @@ static command_result job_cmd(color_ostream &out, vector <string> & parameters)
out << "Job item updated." << endl; out << "Job item updated." << endl;
if (item->item_type < 0 && minfo.isValid()) if (item->item_type < (df::item_type)0 && minfo.isValid())
out.printerr("WARNING: Due to a probable bug, creature & plant material subtype\n" out.printerr("WARNING: Due to a probable bug, creature & plant material subtype\n"
" is ignored unless the item type is also specified.\n"); " is ignored unless the item type is also specified.\n");

@ -293,7 +293,7 @@ static command_result embark_prospector(color_ostream &out, df::viewscreen_choos
int level_cnt = layer->top_height - layer->bottom_height + 1; int level_cnt = layer->top_height - layer->bottom_height + 1;
int layer_size = 48*48*cnt*level_cnt; int layer_size = 48*48*cnt*level_cnt;
int sums[ENUM_LAST_ITEM(inclusion_type)+1] = { 0 }; int sums[(int)ENUM_LAST_ITEM(inclusion_type)+1] = { 0 };
for (unsigned j = 0; j < layer->vein_mat.size(); j++) for (unsigned j = 0; j < layer->vein_mat.size(); j++)
if (is_valid_enum_item<df::inclusion_type>(layer->vein_type[j])) if (is_valid_enum_item<df::inclusion_type>(layer->vein_type[j]))

@ -767,7 +767,7 @@ command_result executePaintJob(color_ostream &out)
} }
// Remove liquid from walls, etc // Remove liquid from walls, etc
if (type != -1 && !DFHack::FlowPassable(type)) if (type != (df::tiletype)-1 && !DFHack::FlowPassable(type))
{ {
des.bits.flow_size = 0; des.bits.flow_size = 0;
//des.bits.liquid_type = DFHack::liquid_water; //des.bits.liquid_type = DFHack::liquid_water;

@ -808,7 +808,7 @@ static void compute_custom_job(ProtectedJob *pj, df::job *job)
using namespace df::enums::reaction_product_item_flags; using namespace df::enums::reaction_product_item_flags;
VIRTUAL_CAST_VAR(prod, df::reaction_product_itemst, r->products[i]); VIRTUAL_CAST_VAR(prod, df::reaction_product_itemst, r->products[i]);
if (!prod || (prod->item_type < 0 && !prod->flags.is_set(CRAFTS))) if (!prod || (prod->item_type < (df::item_type)0 && !prod->flags.is_set(CRAFTS)))
continue; continue;
MaterialInfo mat(prod); MaterialInfo mat(prod);

@ -792,7 +792,7 @@ void unitInfo(color_ostream & out, df::unit* unit, bool verbose = false)
bool isActivityZone(df::building * building) bool isActivityZone(df::building * building)
{ {
if( building->getType() == building_type::Civzone if( building->getType() == building_type::Civzone
&& building->getSubtype() == civzone_type::ActivityZone) && building->getSubtype() == (short)civzone_type::ActivityZone)
return true; return true;
else else
return false; return false;
@ -1603,7 +1603,7 @@ void zoneInfo(color_ostream & out, df::building* building, bool verbose)
if(building->getType()!= building_type::Civzone) if(building->getType()!= building_type::Civzone)
return; return;
if(building->getSubtype() != civzone_type::ActivityZone) if(building->getSubtype() != (short)civzone_type::ActivityZone)
return; return;
string name; string name;