Fix Windows build

This commit also disables warnings for comparison of differently signed integers
This commit is contained in:
2015-02-12 18:21:58 -05:00
parent b3b72f648c
commit d45ba59cce
16 changed files with 59 additions and 34 deletions

View File

@@ -12,7 +12,9 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\classes\creatlist.h" />
<ClInclude Include="..\..\classes\creature.hpp" />
<ClInclude Include="..\..\classes\item.h" />
<ClInclude Include="..\..\classes\living.hpp" />
<ClInclude Include="..\..\classes\location.h" />
<ClInclude Include="..\..\classes\monster.h" />
<ClInclude Include="..\..\classes\outdoors.h" />
@@ -67,7 +69,9 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\classes\creatlist.cpp" />
<ClCompile Include="..\..\classes\creature.cpp" />
<ClCompile Include="..\..\classes\item.cpp" />
<ClCompile Include="..\..\classes\living.cpp" />
<ClCompile Include="..\..\classes\location.cpp" />
<ClCompile Include="..\..\classes\monster.cpp" />
<ClCompile Include="..\..\classes\outdoors.cpp" />
@@ -104,6 +108,8 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\tools\fileio.cpp" />
<ClCompile Include="..\..\tools\fileio_party.cpp" />
<ClCompile Include="..\..\tools\fileio_scen.cpp" />
<ClCompile Include="..\..\tools\graphtool.cpp" />
<ClCompile Include="..\..\tools\gzstream\gzstream.cpp" />
<ClCompile Include="..\..\tools\map_parse.cpp" />
@@ -154,7 +160,7 @@
<AdditionalIncludeDirectories>..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<AdditionalOptions>/FS %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4800;4290;4244;4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
</ClCompile>
@@ -180,7 +186,7 @@
<AdditionalIncludeDirectories>..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
<DisableSpecificWarnings>4800;4290;4244;4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -200,6 +200,12 @@
<ClInclude Include="..\..\oldstructs.h">
<Filter>Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\classes\creature.hpp">
<Filter>Classes\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\classes\living.hpp">
<Filter>Classes\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\classes\creatlist.cpp">
@@ -343,5 +349,17 @@
<ClCompile Include="..\..\tools\debugout.win.cpp">
<Filter>Tools\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tools\fileio_party.cpp">
<Filter>Tools\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tools\fileio_scen.cpp">
<Filter>Tools\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\classes\creature.cpp">
<Filter>Classes\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\classes\living.cpp">
<Filter>Classes\Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -54,7 +54,7 @@
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
<AdditionalIncludeDirectories>..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800;4290;4244;4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -77,7 +77,7 @@
<AdditionalIncludeDirectories>..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
<DisableSpecificWarnings>4800;4290;4244;4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -55,7 +55,7 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800;4290;4244;4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
</ClCompile>
@@ -77,7 +77,7 @@
<AdditionalIncludeDirectories>..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
<DisableSpecificWarnings>4800;4290;4244;4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -55,7 +55,7 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800;4290;4244;4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
</ClCompile>
@@ -77,7 +77,7 @@
<AdditionalIncludeDirectories>..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
<DisableSpecificWarnings>4800;4290;4244;4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -136,7 +136,7 @@ void start_shop_mode(short which,short cost_adj,std::string store_name) {
if(entry.quantity == 0) continue; // Just in case a stray entry accidentally gets put in for an infinite stock item
if(quant_left == 0)
entry.type = eShopItemType::EMPTY;
else if(entry.type == eShopItemType::OPTIONAL)
else if(entry.type == eShopItemType::OPT_ITEM)
entry.quantity = quant_left + (entry.quantity / 1000) * 1000;
else entry.quantity = quant_left;
active_shop.replaceItem(which_item, entry);
@@ -258,7 +258,7 @@ void handle_sale(cShopItem item, int i) {
case eShopItemType::EMPTY: break; // Invalid
case eShopItemType::TREASURE: break; // Also invalid
case eShopItemType::CLASS: break; // Also invalid
case eShopItemType::OPTIONAL: break; // Also invalid
case eShopItemType::OPT_ITEM: break; // Also invalid
case eShopItemType::ITEM:
switch(univ.party[current_pc].ok_to_buy(cost,base_item)) {
case eBuyStatus::OK:
@@ -411,7 +411,7 @@ void handle_info_request(cShopItem item) {
case eShopItemType::EMPTY: break;
case eShopItemType::TREASURE: break;
case eShopItemType::CLASS: break;
case eShopItemType::OPTIONAL: break;
case eShopItemType::OPT_ITEM: break;
case eShopItemType::ITEM:
display_pc_item(6,0, base_item,0);
break;
@@ -524,7 +524,7 @@ void set_up_shop_array() {
if(PSD[entry.item.abil_data[0]][entry.item.abil_data[1]])
shop_array[i++] = j;
break;
case eShopItemType::OPTIONAL:
case eShopItemType::OPT_ITEM:
entry.quantity %= 1000;
case eShopItemType::TREASURE:
case eShopItemType::CLASS:

View File

@@ -981,7 +981,7 @@ void refresh_store_items() {
univ.party.magic_store_items[i][j] = univ.scenario.scen_items[*iter];
continue;
}
} else if(entry.type == eShopItemType::OPTIONAL) {
} else if(entry.type == eShopItemType::OPT_ITEM) {
int roll = get_ran(1,1,100);
if(roll <= entry.quantity / 1000) {
univ.party.magic_store_items[i][j] = entry.item;

View File

@@ -131,7 +131,7 @@ void adjust_monst_menu() {
on_monst_menu[i] = -1;
}
for(i = 1; i < 256; i++) {
if((i == 1) || (univ.party.m_noted[i] > 0)) {
if(i == 1 || univ.party.m_noted.count(i) > 0) {
on_monst_menu[monst_pos] = i;
monst_pos++;
}

View File

@@ -982,7 +982,7 @@ void add_string_to_buf(std::string str, unsigned short indent) {
while(last < str.length() && str[last] == text_buffer[prev_pointer].line[last])
last++;
while(text_buffer[prev_pointer].line[--last] == ' ');
bool is_dup;
bool is_dup = false;
if(last == new_last) {
size_t i, num_pos = 0;
enum {begin, f_space, f_lparen, f_x, f_num, f_rparen, err} state = begin;

View File

@@ -1238,7 +1238,8 @@ void erase_specials() {
if(!is_town() && !is_combat())
return;
for(k = 0; k < univ.town->special_locs.size(); k++) {
//if(univ.town->spec_id[k] >= 0) {
if(univ.town->special_locs[k].spec < 0 || univ.town->special_locs[k].spec >= univ.town->specials.size())
continue;
sn = univ.town->specials[univ.town->special_locs[k].spec];
sd1 = sn.sd1; sd2 = sn.sd2;
if((univ.party.sd_legit(sd1,sd2)) && (PSD[sd1][sd2] == 250)) {
@@ -1255,9 +1256,6 @@ void erase_specials() {
univ.town.set_spot(where.x,where.y,false);
}
}
//}
}
}

View File

@@ -89,14 +89,15 @@ struct spec_loc_t : public location {
spec_loc_t(int x, int y, long spec) : location(x,y), spec(spec) {}
spec_loc_t(const location& loc) : location(loc) {}
spec_loc_t& operator=(const location& loc) {*this = spec_loc_t(loc); return *this;}
spec_loc_t& operator=(const location& loc) {
*this = spec_loc_t(loc);
return *this;
}
// Declaring one constructor suppresses all implicit constructors, so declare them explicitly
spec_loc_t() = default;
spec_loc_t(const spec_loc_t& other) = default;
spec_loc_t(spec_loc_t&& other) = default;
// Ditto for assignment operators
// Ditto for assignment operator
spec_loc_t& operator=(const spec_loc_t& other) = default;
spec_loc_t& operator=(spec_loc_t&& other) = default;
};
bool operator == (location p1,location p2);

View File

@@ -19,9 +19,6 @@
#include "fileio.hpp"
#include "spell.hpp"
static uAbility test;
static_assert(&test.active == &test.missile.active, "uAbility union has incorrect layout");
void cMonster::append(legacy::monster_record_type& old){
level = old.level;
//m_name = old.m_name;

View File

@@ -103,7 +103,7 @@ void cShop::addItem(size_t n, cItem item, size_t quantity, int chance) {
size_t i = firstEmpty();
if(i >= items.size()) return;
if(item.variety == eItemType::NO_ITEM) return;
items[i].type = chance == 100 ? eShopItemType::ITEM : eShopItemType::OPTIONAL;
items[i].type = chance == 100 ? eShopItemType::ITEM : eShopItemType::OPT_ITEM;
items[i].item = item;
items[i].item.ident = true;
items[i].quantity = quantity;
@@ -173,7 +173,7 @@ static cItem store_alchemy(short which_s) {
void cShop::addSpecial(eShopItemType type, int n) {
if(type == eShopItemType::EMPTY || type == eShopItemType::CALL_SPECIAL) return;
if(type == eShopItemType::OPTIONAL || type == eShopItemType::ITEM) return;
if(type == eShopItemType::OPT_ITEM || type == eShopItemType::ITEM) return;
replaceSpecial(firstEmpty(), type, n);
}
@@ -186,7 +186,7 @@ void cShop::replaceSpecial(size_t i, eShopItemType type, int n) {
};
if(type == eShopItemType::EMPTY) return;
if(type == eShopItemType::ITEM) return;
if(type == eShopItemType::OPTIONAL) return;
if(type == eShopItemType::OPT_ITEM) return;
if(type == eShopItemType::CALL_SPECIAL) return;
if(i >= items.size()) return;
items[i].type = type;

View File

@@ -15,6 +15,11 @@
#include "item.h"
#include "pictypes.hpp" // for pic_num_t
// Windows headers are really annoying with their defined constants.
#ifdef INFINITE
#undef INFINITE
#endif
enum class eShopType {NORMAL, ALLOW_DEAD, RANDOM};
enum class eShopPrompt {SHOPPING, HEALING, MAGE, PRIEST, SPELLS, ALCHEMY, TRAINING};
@@ -29,7 +34,7 @@ enum class eShopItemType {
SKILL,
TREASURE,
CLASS,
OPTIONAL,
OPT_ITEM,
CALL_SPECIAL,
// All non-healing types must be above here and all healing types below, with HEAL_WOUNDS kept first
HEAL_WOUNDS,

View File

@@ -2064,7 +2064,7 @@ static bool put_shop_item_in_dlog(cPict& pic, cControl& num, cControl& title, co
}
std::string name = entry.item.full_name;
int amount = entry.quantity;
if(entry.type == eShopItemType::OPTIONAL) {
if(entry.type == eShopItemType::OPT_ITEM) {
name += " [" + std::to_string(amount / 1000) + "% chance]";
amount %= 1000;
}
@@ -2240,8 +2240,8 @@ static bool edit_shop_entry(cDialog& me, std::string which, cShop& shop) {
switch(entry.type) {
case eShopItemType::EMPTY: return true;
case eShopItemType::ITEM:
case eShopItemType::OPTIONAL:
edit_shop_item(me, entry.index, entry.quantity, entry.type == eShopItemType::OPTIONAL);
case eShopItemType::OPT_ITEM:
edit_shop_item(me, entry.index, entry.quantity, entry.type == eShopItemType::OPT_ITEM);
entry.item = scenario.scen_items[entry.index];
shop.replaceItem(i, entry);
need_string = false;

View File

@@ -230,7 +230,7 @@ static void writeScenarioToXml(ticpp::Printer&& data) {
int quantity = entry.quantity, chance = 100;
switch(entry.type) {
case eShopItemType::EMPTY: break;
case eShopItemType::OPTIONAL:
case eShopItemType::OPT_ITEM:
quantity %= 1000;
chance = entry.quantity / 1000;
case eShopItemType::ITEM: