diff --git a/src/BoE.vsproj/Common/Common.vcxproj b/src/BoE.vsproj/Common/Common.vcxproj
index 80473c5d..3fdecc84 100644
--- a/src/BoE.vsproj/Common/Common.vcxproj
+++ b/src/BoE.vsproj/Common/Common.vcxproj
@@ -153,7 +153,7 @@
..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;%(AdditionalIncludeDirectories)
false
/FS %(AdditionalOptions)
- 4800;4290
+ 4800;4290;4244;4996
@@ -179,7 +179,7 @@
..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;%(AdditionalIncludeDirectories)
- 4800;4290
+ 4800;4290;4244;4996
Windows
diff --git a/src/BoE.vsproj/Game/Blades of Exile.vcxproj b/src/BoE.vsproj/Game/Blades of Exile.vcxproj
index 1dc76875..0bf23a25 100644
--- a/src/BoE.vsproj/Game/Blades of Exile.vcxproj
+++ b/src/BoE.vsproj/Game/Blades of Exile.vcxproj
@@ -54,7 +54,7 @@
..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)
- 4800;4290
+ 4800;4290;4244;4996
Windows
@@ -77,7 +77,7 @@
..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)
- 4800;4290
+ 4800;4290;4244;4996
Windows
diff --git a/src/BoE.vsproj/PcEdit/Char Editor.vcxproj b/src/BoE.vsproj/PcEdit/Char Editor.vcxproj
index b01d72ab..7cf105e3 100644
--- a/src/BoE.vsproj/PcEdit/Char Editor.vcxproj
+++ b/src/BoE.vsproj/PcEdit/Char Editor.vcxproj
@@ -55,7 +55,7 @@
Disabled
WIN32;_DEBUG;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions)
..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)
- 4800;4290
+ 4800;4290;4244;4996
@@ -77,7 +77,7 @@
..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)
- 4800;4290
+ 4800;4290;4244;4996
Windows
diff --git a/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj b/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj
index 82cd0fed..cd156531 100644
--- a/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj
+++ b/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj
@@ -55,7 +55,7 @@
Disabled
WIN32;_DEBUG;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions)
..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)
- 4800;4290
+ 4800;4290;4244;4996
@@ -77,7 +77,7 @@
..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;.;%(AdditionalIncludeDirectories)
- 4800;4290
+ 4800;4290;4244;4996
Windows
diff --git a/src/boe.actions.cpp b/src/boe.actions.cpp
index 4cb415fb..44eb16b2 100644
--- a/src/boe.actions.cpp
+++ b/src/boe.actions.cpp
@@ -730,7 +730,7 @@ static void handle_drop_item(short item_hit, bool& need_redraw) {
}
static void handle_item_shop_action(short item_hit) {
- short i = item_hit - item_sbar->getPosition();
+ long i = item_hit - item_sbar->getPosition();
switch(stat_screen_mode) {
case 2: // identify item
if(!take_gold(shop_identify_cost,false))
@@ -931,7 +931,8 @@ static void handle_party_death() {for(int i = 0; i < 6; i++)
}
bool handle_action(sf::Event event) {
- short item_hit,s1,s2,s3;
+ short s1,s2,s3;
+ long item_hit;
bool are_done = false;
bool need_redraw = false, did_something = false, need_reprint = false;
bool pc_delayed = false;
@@ -1237,7 +1238,7 @@ bool handle_action(sf::Event event) {
}
for(int i = 0; i < 6; i++)
for(int j = 0; j < 5; j++)
- if(pc_area_button_active[i][j] > 0 && point_in_area.in(pc_buttons[i][j])) {
+ if(pc_area_button_active[i][j] && point_in_area.in(pc_buttons[i][j])) {
pc_buttons[i][j].offset(PC_WIN_UL_X,PC_WIN_UL_Y);
arrow_button_click(pc_buttons[i][j]);
pc_buttons[i][j].offset(-PC_WIN_UL_X,-PC_WIN_UL_Y);
@@ -1311,7 +1312,7 @@ bool handle_action(sf::Event event) {
if(stat_window < 7) {
for(int i = 0; i < 8; i++)
for(int j = 0; j < 6; j++)
- if(item_area_button_active[i][j] > 0 && point_in_area.in(item_buttons[i][j])) {
+ if(item_area_button_active[i][j] && point_in_area.in(item_buttons[i][j])) {
item_buttons[i][j].offset(ITEM_WIN_UL_X,ITEM_WIN_UL_Y);
// if((j > 0) || (stat_screen_mode < 2)) // TODO: <-- Windows version has this check - why?
arrow_button_click(item_buttons[i][j]);
@@ -2446,11 +2447,11 @@ void increase_age() {
// Recuperation and chronic disease disads
for(i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE) {
- if(univ.party[i].traits[eTrait::RECUPERATION] > 0 && get_ran(1,0,10) == 1 && univ.party[i].cur_health < univ.party[i].max_health) {
+ if(univ.party[i].traits[eTrait::RECUPERATION] && get_ran(1,0,10) == 1 && univ.party[i].cur_health < univ.party[i].max_health) {
heal_pc(i,2);
update_stat = true;
}
- if(univ.party[i].traits[eTrait::CHRONIC_DISEASE] > 0 && get_ran(1,0,110) == 1) {
+ if(univ.party[i].traits[eTrait::CHRONIC_DISEASE] && get_ran(1,0,110) == 1) {
disease_pc(i,4);
update_stat = true;
}
diff --git a/src/boe.combat.cpp b/src/boe.combat.cpp
index 3a6f4a58..7fb5d5fb 100644
--- a/src/boe.combat.cpp
+++ b/src/boe.combat.cpp
@@ -48,7 +48,7 @@ extern effect_pat_type current_pat;
extern short num_targets_left;
extern location spell_targets[8];
extern bool in_scen_debug;
-extern bool fast_bang;
+extern short fast_bang;
//extern unsigned char misc_i[64][64],sfx[64][64];
extern short store_current_pc;
//extern location monster_targs[60];
@@ -2080,7 +2080,7 @@ void do_monster_turn() {
}
if(cur_monst->attitude == 0) {
- acted_yet = rand_move (i);
+ acted_yet = rand_move(i);
futzing++;
}
}
@@ -2660,12 +2660,12 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor
if(target < 100) { // on PC
std::string create_line = " Gazes at " + univ.party[target].name + '.';
add_string_to_buf(create_line);
- petrify_pc(target, univ.town.monst[i].level / 4);
+ petrify_pc(target, m_target->level / 4);
}
else {
// TODO: This might be relevant to the AFFECT_DEADNESS special when used on monsters
monst_spell_note(m_target->number,9);
- petrify_monst(m_target, univ.town.monst[i].level / 4);
+ petrify_monst(m_target, m_target->level / 4);
}
}
else if(level == 9) { /// Drain sp
@@ -3830,7 +3830,7 @@ static void place_spell_pattern(effect_pat_type pat,location center,unsigned sho
spot_hit.x = i;
spot_hit.y = j;
- if(!monster_hit && sight_obscurity(i,j) < 5 && monst_on_space(spot_hit,k) > 0) {
+ if(!monster_hit && sight_obscurity(i,j) < 5 && monst_on_space(spot_hit,k)) {
if(pat.pattern[i - center.x + 4][j - center.y + 4] > 0)
monster_hit = true;
@@ -4431,7 +4431,6 @@ bool combat_cast_mage_spell() {
bool combat_cast_priest_spell() {
short target,i,store_sp,bonus,store_sound = 0,store_m_type = 0,num_opp = 0;
eSpell spell_num;
- char c_line[60];
cCreature *which_m;
effect_pat_type protect_pat = {{
{0,1,1,1,1,1,1,1,0},
@@ -4710,7 +4709,7 @@ static void process_force_cage(location loc, short i) {
void process_fields() {
short i,j,k,r1;
location loc;
- char qf[64][64];
+ short qf[64][64];
rectangle r;
if(is_out())
@@ -4724,7 +4723,7 @@ void process_fields() {
for(k = 0; k < ((is_combat()) ? 4 : 1); k++) {
for(i = r.left + 1; i < r.right ; i++)
for(j = r.top + 1; j < r.bottom ; j++)
- if(univ.town.is_quickfire(i,j) > 0) {
+ if(univ.town.is_quickfire(i,j)) {
r1 = get_ran(1,1,8);
if(r1 != 1) {
qf[i - 1][j] = 1;
diff --git a/src/boe.consts.h b/src/boe.consts.h
index d7b2dc81..0cf400f8 100644
--- a/src/boe.consts.h
+++ b/src/boe.consts.h
@@ -83,26 +83,10 @@ enum eGameMode {
MODE_CUTSCENE = 51, // for future use
};
-// Directions!
-enum eDirection {
- DIR_N = 0,
- DIR_NE = 1,
- DIR_E = 2,
- DIR_SE = 3,
- DIR_S = 4,
- DIR_SW = 5,
- DIR_W = 6,
- DIR_NW = 7,
- DIR_HERE = 8,
-};
#ifndef DIR_ARRAY_DEF
extern signed char dir_x_dif[9];
extern signed char dir_y_dif[9];
#endif
-inline eDirection& operator++ (eDirection& me,int){
- if(me == DIR_HERE) return me = DIR_N;
- else return me = (eDirection) (1 + (int) me);
-}
//inline eDamageType operator + (eDamageType lhs, eDamageType rhs){
// if(lhs == DAMAGE_MARKED || lhs == DAMAGE_NO_PRINT){
diff --git a/src/boe.dlgutil.cpp b/src/boe.dlgutil.cpp
index 13559956..5d4ccc17 100644
--- a/src/boe.dlgutil.cpp
+++ b/src/boe.dlgutil.cpp
@@ -182,7 +182,8 @@ void end_shop_mode() {
}
void handle_shop_event(location p) {
- short i,store_what_picked;
+ short i;
+ unsigned long store_what_picked;
p.x -= 5;
p.y -= 5;
@@ -823,7 +824,7 @@ void handle_talk_event(location p) {
strnum1 = -1;
return;
case 24:
- if(univ.party.can_find_town[b] > 0) {
+ if(univ.party.can_find_town[b]) {
// TODO: Uh, is something supposed to happen here?
}
else if(univ.party.gold < a) {
diff --git a/src/boe.fileio.h b/src/boe.fileio.h
index b6a76ae2..47282e9f 100644
--- a/src/boe.fileio.h
+++ b/src/boe.fileio.h
@@ -12,9 +12,6 @@ namespace fs = boost::filesystem; // TODO: Centralize this alias!
//void save_file(short mode);
void finish_load_party();
void change_rect_terrain(rectangle r,ter_num_t terrain_type,short probability,bool hollow);
-void swap_val(unsigned char *val,short a,short b);
-void change_val_4 (unsigned char *val,short a,short b,short c,short d);
-void change_val (unsigned char *val,short a,short b);
void form_template_terrain() ;
//void load_town(short town_num,short mode,short extra,char *str);
void shift_universe_left();
diff --git a/src/boe.graphics.cpp b/src/boe.graphics.cpp
index 349dcb7f..6681fc7d 100644
--- a/src/boe.graphics.cpp
+++ b/src/boe.graphics.cpp
@@ -55,7 +55,7 @@ extern tessel_ref_t map_pat[];
extern location store_anim_ul;
extern long register_flag;
extern long ed_flag,ed_key;
-extern bool fast_bang;
+extern short fast_bang;
extern tessel_ref_t bg[];
extern cUniverse univ;
extern cCustomGraphics spec_scen_g;
@@ -781,7 +781,7 @@ void refresh_text_bar() {
// this is used for determinign whether to round off walkway corners
// right now, trying a restrictive rule (just cave floor and grass, mainly)
-bool is_nature(char x, char y, unsigned char ground_t) {
+bool is_nature(short x, short y, unsigned short ground_t) {
ter_num_t ter_type;
ter_type = coord_to_ter((short) x,(short) y);
@@ -930,7 +930,7 @@ void draw_terrain(short mode) {
// Finally, draw this terrain spot
if(trim == eTrimType::WALKWAY){
int trim = -1;
- unsigned char ground_t = univ.scenario.ter_types[spec_terrain].trim_ter;
+ unsigned short ground_t = univ.scenario.ter_types[spec_terrain].trim_ter;
ter_num_t ground_ter = get_ter_from_ground(ground_t);
if(!loc_off_act_area(where_draw)) {
if(is_nature(where_draw.x - 1,where_draw.y,ground_t)){ // check left
diff --git a/src/boe.graphics.h b/src/boe.graphics.h
index 22d20b01..5be23309 100644
--- a/src/boe.graphics.h
+++ b/src/boe.graphics.h
@@ -55,7 +55,7 @@ void erase_spot(short i,short j);
void draw_targeting_line(location where_curs);
bool party_toast();
void redraw_partial_terrain(rectangle redraw_rect);
-bool is_nature(char i, char j, unsigned char ground_t);
+bool is_nature(short i, short j, unsigned short ground_t);
void put_dialog_graphic(short graphic_num,short spec_g,rectangle draw_rect);
void draw_startup_stats();
void draw_trim(short q,short r,short which_trim,ter_num_t ground_ter);
diff --git a/src/boe.infodlg.cpp b/src/boe.infodlg.cpp
index 68eb374c..1471ceac 100644
--- a/src/boe.infodlg.cpp
+++ b/src/boe.infodlg.cpp
@@ -64,7 +64,8 @@ short store_str2b;
short store_page_on,store_num_i;
// Misc dialog vars
-short position,num_entries;
+short position;
+long num_entries;
unsigned short cur_entry;
static void put_spell_info(cDialog& me, eSkill display_mode) {
diff --git a/src/boe.items.cpp b/src/boe.items.cpp
index e5605407..1c13544a 100644
--- a/src/boe.items.cpp
+++ b/src/boe.items.cpp
@@ -116,7 +116,6 @@ bool give_to_party(cItemRec item, short print_result) {
////
bool give_to_pc(short pc_num,cItemRec item,short print_result,bool allow_overload) {
short free_space;
- char announce_string[60];
if(item.variety == eItemType::NO_ITEM)
return true;
@@ -529,9 +528,10 @@ void equip_item(short pc_num,short item_num) {
}
}
+ size_t hands_free = 2 - num_hands_occupied;
if(is_combat() && univ.party[pc_num].items[item_num].variety == eItemType::ARMOR)
add_string_to_buf("Equip: Not armor in combat");
- else if(2 - num_hands_occupied < num_hands_to_use.count(univ.party[pc_num].items[item_num].variety))
+ else if(hands_free < num_hands_to_use.count(univ.party[pc_num].items[item_num].variety))
add_string_to_buf("Equip: Not enough free hands");
else if(equippable.count(univ.party[pc_num].items[item_num].variety) <= num_equipped_of_this_type)
add_string_to_buf("Equip: Can't equip another");
@@ -775,7 +775,7 @@ short get_item(location place,short pc_num,bool check_container) {
item_near = true;
}
if(item_near)
- if(display_item(place,pc_num,mass_get,check_container) > 0) { // if true, there was a theft
+ if(display_item(place,pc_num,mass_get,check_container)) { // if true, there was a theft
for(i = 0; i < univ.town->max_monst(); i++)
if((univ.town.monst[i].active > 0) && (univ.town.monst[i].attitude % 2 != 1)
&& (can_see_light(place,univ.town.monst[i].cur_loc,sight_obscurity) < 5)) {
diff --git a/src/boe.locutils.cpp b/src/boe.locutils.cpp
index 83f716b2..89043bb6 100644
--- a/src/boe.locutils.cpp
+++ b/src/boe.locutils.cpp
@@ -96,7 +96,7 @@ bool point_onscreen(location center,location check) {
}
-short set_direction (location old_pt, location new_pt) {
+eDirection set_direction (location old_pt, location new_pt) {
if(old_pt.x == new_pt.x) {
if(old_pt.y > new_pt.y)
return DIR_N;
diff --git a/src/boe.locutils.h b/src/boe.locutils.h
index 37d6b805..4496756d 100644
--- a/src/boe.locutils.h
+++ b/src/boe.locutils.h
@@ -11,7 +11,7 @@ bool is_combat();
//short vdist(location p1,location p2) ;
bool adjacent(location p1,location p2);
bool point_onscreen(location center,location check);
-short set_direction (location old_pt, location new_pt);
+eDirection set_direction (location old_pt, location new_pt);
location global_to_local(location global);
location local_to_global(location local);
bool loc_off_world(location p1);
diff --git a/src/boe.main.cpp b/src/boe.main.cpp
index b9e473cc..76b9d73d 100644
--- a/src/boe.main.cpp
+++ b/src/boe.main.cpp
@@ -85,7 +85,7 @@ bool belt_present = false;
/* Display globals */
short combat_posing_monster = -1, current_working_monster = -1; // 0-5 PC 100 + x - monster x
-bool fast_bang = false;
+short fast_bang = false; // Note: This mostly behaves as a boolean variable, but values other than 1 are assigned to it, so I made it a short
short spec_item_array[60];
short current_spell_range;
eGameMode overall_mode = MODE_STARTUP;
@@ -208,38 +208,14 @@ int main(int /*argc*/, char* argv[]) {
}
}
-//
-// Initialize everything for the program, make sure we can run
-//
-
-//MW specified argument and return type.
void Initialize(void) {
- /* Initialize all the needed managers. */
- //InitCursor();
-
-
- //GetKeys(key_state);
-
- //
// To make the Random sequences truly random, we need to make the seed start
// at a different number. An easy way to do this is to put the current time
// and date into the seed. Since it is always incrementing the starting seed
// will always be different. Don't for each call of Random, or the sequence
// will no longer be random. Only needed once, here in the init.
- //
- //unsigned long time;
- //GetDateTime(&time);
- //SetQDGlobalsRandomSeed(time);
srand(time(NULL));
-// stored_key = open_pref_file();
-// if(stored_key == -100) {
-// stored_key = open_pref_file();
-// if(stored_key == -100) {
-// Alert(983,NULL);
-// ExitToShell();
-// }
-// }
load_prefs();
text_sbar.reset(new cScrollbar(mainPtr));
text_sbar->setBounds(sbar_rect);
@@ -256,7 +232,6 @@ void Initialize(void) {
shop_sbar->setPageSize(8);
shop_sbar->hide();
adjust_window_mode();
-
}
void Handle_One_Event() {
diff --git a/src/boe.monster.cpp b/src/boe.monster.cpp
index f5129d05..cdf56b12 100644
--- a/src/boe.monster.cpp
+++ b/src/boe.monster.cpp
@@ -586,7 +586,7 @@ short switch_target_to_adjacent(short which_m,short orig_target) {
}
-bool rand_move(char i) {
+bool rand_move(m_num_t i) {
bool acted_yet = false;
short j;
location store_loc;
@@ -722,8 +722,7 @@ bool combat_move_monster(short which,location destination) {
else if(!monst_check_special_terrain(destination,2,which))
return false;
else {
- univ.town.monst[which].direction =
- set_direction(univ.town.monst[which].cur_loc, destination);
+ univ.town.monst[which].direction = set_direction(univ.town.monst[which].cur_loc, destination);
univ.town.monst[which].cur_loc = destination;
monst_inflict_fields(which);
@@ -803,8 +802,7 @@ bool town_move_monster(short num,location dest) {
return false;
if(monst_can_be_there(dest,num)) {
- univ.town.monst[num].direction =
- set_direction(univ.town.monst[num].cur_loc, dest);
+ univ.town.monst[num].direction = set_direction(univ.town.monst[num].cur_loc, dest);
univ.town.monst[num].cur_loc = dest;
monst_inflict_fields(num);
return true;
@@ -1003,9 +1001,9 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
can_enter = false;
else {
to_loc = push_loc(from_loc,where_check);
- univ.town.set_crate((short) where_check.x,(short) where_check.y,false);
+ univ.town.set_crate(where_check.x,where_check.y,false);
if(to_loc.x > 0)
- univ.town.set_crate((short) to_loc.x,(short) to_loc.y, true);
+ univ.town.set_crate(to_loc.x,to_loc.y, true);
for(i = 0; i < NUM_TOWN_ITEMS; i++)
if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].item_loc == where_check
&& (univ.town.items[i].contained))
@@ -1017,9 +1015,9 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
can_enter = false;
else {
to_loc = push_loc(from_loc,where_check);
- univ.town.set_barrel((short) where_check.x,(short) where_check.y,false);
+ univ.town.set_barrel(where_check.x,where_check.y,false);
if(to_loc.x > 0)
- univ.town.set_barrel((short) to_loc.x,(short) to_loc.y,true);
+ univ.town.set_barrel(to_loc.x,to_loc.y,true);
for(i = 0; i < NUM_TOWN_ITEMS; i++)
if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].item_loc == where_check
&& (univ.town.items[i].contained))
diff --git a/src/boe.monster.h b/src/boe.monster.h
index 5116fa08..8f1d0313 100644
--- a/src/boe.monster.h
+++ b/src/boe.monster.h
@@ -20,7 +20,7 @@ short select_active_pc();
short closest_pc(location where);
short closest_monst(location where,short mode);
short switch_target_to_adjacent(short which_m,short orig_target);
-bool rand_move(char i);
+bool rand_move(m_num_t i);
bool seek_party(short i,location l1,location l2);
bool flee_party(short i,location l1,location l2);
bool try_move(short i,location start,short x,short y);
diff --git a/src/boe.newgraph.cpp b/src/boe.newgraph.cpp
index 9e7b246f..3f84fa33 100644
--- a/src/boe.newgraph.cpp
+++ b/src/boe.newgraph.cpp
@@ -679,7 +679,7 @@ void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
sf::Color c[7] = {sf::Color{0,0,0},sf::Color{0,0,128},sf::Color{0,0,57},sf::Color{0,0,104},sf::Color{0,0,232},
sf::Color{0,160,0},sf::Color{0,96,0}};
rectangle shopper_name = {44,6,56,260};
- short current_pos;
+ long current_pos;
short cur_cost;
static const char*const cost_strs[] = {
diff --git a/src/boe.party.cpp b/src/boe.party.cpp
index 07bbf315..8e9efbee 100644
--- a/src/boe.party.cpp
+++ b/src/boe.party.cpp
@@ -56,7 +56,7 @@ extern cItemRec start_items[6];
char empty_string[256] = " ";
//extern stored_town_maps_type town_maps;
-extern bool fast_bang;
+extern short fast_bang;
extern bool flushingInput;
//extern party_record_type party;
extern short stat_window,current_pc;
@@ -877,7 +877,6 @@ bool repeat_cast_ok(eSkill type) {
void give_party_spell(short which) {
short i;
bool sound_done = false;
- char str[60];
if((which < 0) || (which > 161) || ((which > 61) && (which < 100))) {
giveError("The scenario has tried to give you a non-existant spell.");
@@ -1730,8 +1729,6 @@ void dispel_fields(short i,short j,short mode) {
}
bool pc_can_cast_spell(short pc_num,eSkill type) {
- short store_w_cast;
-
if(type == eSkill::MAGE_SPELLS && pc_can_cast_spell(pc_num, eSpell::LIGHT))
return true;
if(type == eSkill::PRIEST_SPELLS && pc_can_cast_spell(pc_num, eSpell::HEAL_MINOR))
@@ -2937,7 +2934,7 @@ void take_ap(short num) {
short trait_present(eTrait which_trait) {
short i,ret = 0;
for(i = 0; i < 6; i++)
- if(univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].traits[which_trait] > 0)
+ if(univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].traits[which_trait])
ret += 1;
return ret;
}
diff --git a/src/boe.specials.cpp b/src/boe.specials.cpp
index 9f10ddfd..9e338b2e 100644
--- a/src/boe.specials.cpp
+++ b/src/boe.specials.cpp
@@ -47,7 +47,8 @@ extern cOutdoors::cWandering store_wandering_special;
extern short monst_marked_damage[60];
extern eSpell spell_being_cast, town_spell;
extern sf::RenderWindow mini_map;
-extern bool fast_bang,end_scenario;
+extern short fast_bang;
+extern bool end_scenario;
//extern short town_size[3];
extern cUniverse univ;
extern std::queue special_queue;
@@ -278,9 +279,9 @@ bool check_special_terrain(location where_check,eSpecCtx mode,short which_pc,sho
if(univ.town.is_crate(where_check.x,where_check.y)) {
add_string_to_buf(" You push the crate.");
to_loc = push_loc(from_loc,where_check);
- univ.town.set_crate((short) where_check.x,(short) where_check.y,false);
+ univ.town.set_crate(where_check.x,where_check.y,false);
if(to_loc.x > 0)
- univ.town.set_crate((short) to_loc.x,(short) to_loc.y,true);
+ univ.town.set_crate(to_loc.x,to_loc.y,true);
for(i = 0; i < NUM_TOWN_ITEMS; i++)
if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].item_loc == where_check
&& (univ.town.items[i].contained))
@@ -289,9 +290,9 @@ bool check_special_terrain(location where_check,eSpecCtx mode,short which_pc,sho
if(univ.town.is_barrel(where_check.x,where_check.y)) {
add_string_to_buf(" You push the barrel.");
to_loc = push_loc(from_loc,where_check);
- univ.town.set_barrel((short) where_check.x,(short) where_check.y,false);
+ univ.town.set_barrel(where_check.x,where_check.y,false);
if(to_loc.x > 0)
- univ.town.set_barrel((short) to_loc.x,(short) to_loc.y,false);
+ univ.town.set_barrel(to_loc.x,to_loc.y,false);
for(i = 0; i < NUM_TOWN_ITEMS; i++)
if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].item_loc == where_check
&& (univ.town.items[i].contained))
@@ -1207,8 +1208,8 @@ bool use_space(location where) {
return false;
}
add_string_to_buf(" You push the crate.");
- univ.town.set_crate((short) where.x,(short) where.y,false);
- univ.town.set_crate((short) to_loc.x,(short) to_loc.y,true);
+ univ.town.set_crate(where.x,where.y,false);
+ univ.town.set_crate(to_loc.x,to_loc.y,true);
for(i = 0; i < NUM_TOWN_ITEMS; i++)
if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].item_loc == where
&& (univ.town.items[i].contained))
@@ -1221,8 +1222,8 @@ bool use_space(location where) {
return false;
}
add_string_to_buf(" You push the barrel.");
- univ.town.set_barrel((short) where.x,(short) where.y,false);
- univ.town.set_barrel((short) to_loc.x,(short) to_loc.y,true);
+ univ.town.set_barrel(where.x, where.y,false);
+ univ.town.set_barrel(to_loc.x,to_loc.y,true);
for(i = 0; i < NUM_TOWN_ITEMS; i++)
if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].item_loc == where
&& (univ.town.items[i].contained))
@@ -1235,8 +1236,8 @@ bool use_space(location where) {
return false;
}
add_string_to_buf(" You push the block.");
- univ.town.set_block((short) where.x,(short) where.y,false);
- univ.town.set_block((short) to_loc.x,(short) to_loc.y,true);
+ univ.town.set_block(where.x,where.y,false);
+ univ.town.set_block(to_loc.x,to_loc.y,true);
}
if(univ.scenario.ter_types[ter].special == eTerSpec::CHANGE_WHEN_USED) {
@@ -1345,7 +1346,7 @@ void PSOE(short which_special,unsigned char *stuff_done_val,short where_put) {
//play_sound(0);
}
-void out_move_party(char x,char y) {
+void out_move_party(short x,short y) {
location l;
l.x = x;l.y = y;
@@ -1921,7 +1922,7 @@ void special_increase_age(long length, bool queue) {
draw_terrain(0);
}
-void queue_special(eSpecCtx mode, short which_type, short spec, location spec_loc) {
+void queue_special(eSpecCtx mode, unsigned short which_type, short spec, location spec_loc) {
if(spec < 0) return;
pending_special_type queued_special;
queued_special.spec = spec;
@@ -2351,7 +2352,7 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
// TODO: What was next_spec_type for? Is it still needed?
void oneshot_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
- short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw) {
+ short *next_spec,short* /*next_spec_type*/,short *a,short *b,short *redraw) {
bool check_mess = true,set_sd = true;
std::array strs;
short i,j;
@@ -2507,7 +2508,7 @@ void oneshot_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
// TODO: What was next_spec_type for? Is it still needed?
void affect_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
- short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw) {
+ short *next_spec,short* /*next_spec_type*/,short *a,short *b,short *redraw) {
bool check_mess = true;
short i,pc = 6,r1;
cSpecial spec;
@@ -2929,7 +2930,7 @@ static bool isValidField(int fld, bool allowSpecial) {
// TODO: What was next_spec_type for? Is it still needed?
void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
- short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw) {
+ short *next_spec,short* /*next_spec_type*/,short *a,short *b,short *redraw) {
bool check_mess = false;
std::string str1, str2, str3;
short i,j,k;
@@ -3385,7 +3386,7 @@ void set_terrain(location l, ter_num_t terrain_type) {
// TODO: What was next_spec_type for? Is it still needed?
void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
- short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw) {
+ short *next_spec,short* /*next_spec_type*/,short *a,short *b,short *redraw) {
static const char*const stairDlogs[8] = {
"basic-stair-up", "basic-stair-down",
"basic-slope-up", "basic-slope-down",
@@ -3697,13 +3698,13 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
break;
if(is_combat()) {
ASB("Not while in combat.");
- if((which_mode == eSpecCtx::OUT_MOVE || which_mode == eSpecCtx::TOWN_MOVE || which_mode == eSpecCtx::COMBAT_MOVE) < 3)
+ if(which_mode == eSpecCtx::OUT_MOVE || which_mode == eSpecCtx::TOWN_MOVE || which_mode == eSpecCtx::COMBAT_MOVE)
*a = 1;
*next_spec = -1;
check_mess = false;
break;
}
- if(univ.party.is_split() > 0) {
+ if(univ.party.is_split()) {
ASB("Party is already split.");
if(which_mode == eSpecCtx::OUT_MOVE || which_mode == eSpecCtx::TOWN_MOVE || which_mode == eSpecCtx::COMBAT_MOVE)
*a = 1;
@@ -3772,7 +3773,7 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
// TODO: What was next_spec_type for? Is it still needed?
void rect_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
- short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw){
+ short *next_spec,short* /*next_spec_type*/,short *a,short *b,short *redraw){
bool check_mess = true;
short i,j,k;
cSpecial spec;
@@ -3901,7 +3902,7 @@ END:
// TODO: What was next_spec_type for? Is it still needed?
void outdoor_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
- short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw){
+ short *next_spec,short* /*next_spec_type*/,short *a,short *b,short *redraw){
bool check_mess = false;
std::string str1, str2;
cSpecial spec;
diff --git a/src/boe.specials.h b/src/boe.specials.h
index cbd2b646..76204720 100644
--- a/src/boe.specials.h
+++ b/src/boe.specials.h
@@ -13,14 +13,14 @@ void kill_monst(cCreature *which_m,short who_killed,eMainStatus type = eMainStat
void petrify_monst(cCreature* m_target, short strength);
void special_increase_age(long length = 1, bool queue = false);
void do_rest(long length, int hp_restore, int mp_restore);
-void out_move_party(char x,char y) ;
+void out_move_party(short x,short y) ;
void teleport_party(short x,short y,short mode);
bool run_stone_circle(short which);
void fade_party();
void change_level(short town_num,short x,short y);
void push_things();
void set_terrain(location l, ter_num_t terrain_type);
-void queue_special(eSpecCtx mode, short which_type, short spec, location spec_loc);
+void queue_special(eSpecCtx mode, unsigned short which_type, short spec, location spec_loc);
void run_special(eSpecCtx which_mode,short which_type,short start_spec,location spec_loc,short *a,short *b,short *redraw);
void run_special(pending_special_type spec, short* a, short* b, short* redraw);
cSpecial get_node(short cur_spec,short cur_spec_type);
diff --git a/src/boe.text.cpp b/src/boe.text.cpp
index f36fd833..241d77a8 100644
--- a/src/boe.text.cpp
+++ b/src/boe.text.cpp
@@ -213,7 +213,8 @@ void put_pc_screen() {
// if suppress_buttons > 0, save time by not redrawing buttons
void put_item_screen(short screen_num,short suppress_buttons) {
std::ostringstream sout;
- short i_num,item_offset;
+ long i_num;
+ long item_offset;
short i = 0,j,pc;
rectangle erase_rect = {17,2,122,255},dest_rect;
rectangle upper_frame_rect = {3,3,15,268};
@@ -919,16 +920,10 @@ void notify_out_combat_began(cOutdoors::cWandering encounter,short *nums) {
for(i = 0; i < 6; i++)
if(encounter.monst[i] != 0) {
- switch(encounter.monst[i]) {
- ////
-
- default:
- msg = get_m_name(encounter.monst[i]);
- std::ostringstream sout;
- sout << " " << nums[i] << " x " << msg << " ";
- msg = sout.str();
- break;
- }
+ msg = get_m_name(encounter.monst[i]);
+ std::ostringstream sout;
+ sout << " " << nums[i] << " x " << msg << " ";
+ msg = sout.str();
add_string_to_buf((char *) msg.c_str());
}
if(encounter.monst[6] != 0) {
@@ -1225,7 +1220,8 @@ void add_string_to_buf(std::string str, unsigned short indent) {
size_t split = str.find_last_of(' ', 49);
add_string_to_buf(str.substr(0,split));
str = str.substr(split);
- while(str.find_last_not_of(' ') > 48 - indent) {
+ size_t wrap_w = 48 - indent;
+ while(str.find_last_not_of(' ') > wrap_w) {
std::string wrap(indent, ' ');
split = str.find_last_of(' ', 49 - indent);
wrap += str.substr(0,split);
@@ -1310,9 +1306,10 @@ void init_buf() {
}
void print_buf () {
- short num_lines_printed = 0,ctrl_val;
+ short num_lines_printed = 0;
+ long ctrl_val;
short line_to_print;
- short start_print_point;
+ long start_print_point;
bool end_loop = false;
rectangle store_text_rect,dest_rect,erase_rect = {2,2,136,255};
@@ -1417,7 +1414,7 @@ short calc_day() {
// which_event is the univ.party.key_times value to cross reference with.
// if the key_time is reached before which_day, event won't happen
// if it's 0, event always happens
-bool day_reached(unsigned char which_day, unsigned char which_event) {
+bool day_reached(unsigned short which_day, unsigned short which_event) {
// Windows version unconditionally added 20 days for no reason at all.
// Instead, let's add 10 days, but only if easy mode enabled.
if(PSD[SDF_EASY_MODE]) which_day += 10;
diff --git a/src/boe.text.h b/src/boe.text.h
index e4ca21e2..590065a1 100644
--- a/src/boe.text.h
+++ b/src/boe.text.h
@@ -41,7 +41,7 @@ void through_sending();
rectangle coord_to_rect(short i,short j);
void make_cursor_sword() ;
short calc_day();
-bool day_reached(unsigned char which_day, unsigned char which_event);
+bool day_reached(unsigned short which_day, unsigned short which_event);
void Draw_Some_Item (sf::Texture& src_gworld, rectangle src_rect, sf::RenderTarget& targ_gworld, location target, char masked, short main_win);
//rectangle get_custom_rect (short which_rect);
diff --git a/src/boe.town.cpp b/src/boe.town.cpp
index c6f8750e..038b1a1c 100644
--- a/src/boe.town.cpp
+++ b/src/boe.town.cpp
@@ -121,7 +121,6 @@ void force_town_enter(short which_town,location where_start) {
//short entry_dir; // if 9, go to forced
void start_town_mode(short which_town, short entry_dir) {
short i,m,n;
- char message[60];
short j,k,town_number;
short at_which_save_slot,former_town;
bool monsters_loaded = false,town_toast = false;
@@ -298,13 +297,11 @@ void start_town_mode(short which_town, short entry_dir) {
// Now, if necessary, fry the monster.
switch(univ.town.monst[i].time_flag) {
case 1:
- if(!day_reached(univ.town.monst[i].monster_time,
- univ.town.monst[i].time_code))
+ if(!day_reached(univ.town.monst[i].monster_time, univ.town.monst[i].time_code))
univ.town.monst[i].active = 0;
break;
case 2:
- if(day_reached(univ.town.monst[i].monster_time,
- univ.town.monst[i].time_code))
+ if(day_reached(univ.town.monst[i].monster_time, univ.town.monst[i].time_code))
univ.town.monst[i].active = 0;
break;
case 3:
@@ -595,7 +592,7 @@ location end_town_mode(short switching_level,location destination) { // returns
//if(univ.town.town_num < 120) {
for(i = 0; i < univ.town->max_dim(); i++)
for(j = 0; j < univ.town->max_dim(); j++)
- if(is_explored(i,j) > 0) {
+ if(is_explored(i,j)) {
univ.town_maps[univ.town.num][i / 8][j] = univ.town_maps[univ.town.num][i / 8][j] |
(char) (s_pow(2,i % 8));
}
@@ -1216,7 +1213,7 @@ void erase_out_specials() {
univ.out[48 * i + sector.exit_locs[k].x][48 * j + sector.exit_locs[k].y] =
univ.scenario.ter_types[sector.terrain[sector.exit_locs[k].x][sector.exit_locs[k].y]].flag1.u;
}
- else if(univ.party.can_find_town[sector.exit_dests[k]] > 0) {
+ else if(univ.party.can_find_town[sector.exit_dests[k]]) {
univ.out[48 * i + sector.exit_locs[k].x][48 * j + sector.exit_locs[k].y] =
sector.terrain[sector.exit_locs[k].x][sector.exit_locs[k].y];
@@ -1266,7 +1263,7 @@ void clear_map() {
void draw_map(bool need_refresh) {
if(!map_visible) return;
- short i,j;
+ short i;
pic_num_t pic;
rectangle the_rect,map_world_rect = {0,0,384,384};
location where;
diff --git a/src/classes/creatlist.cpp b/src/classes/creatlist.cpp
index a76fafef..049aa972 100644
--- a/src/classes/creatlist.cpp
+++ b/src/classes/creatlist.cpp
@@ -51,7 +51,7 @@ void cPopulation::assign(size_t n, const cCreature& other, const cMonster& base,
if(dudes[n].level >= 20)
dudes[n].m_morale += 10 * (dudes[n].level - 20);
dudes[n].morale = dudes[n].m_morale;
- dudes[n].direction = 0;
+ dudes[n].direction = DIR_HERE;
dudes[n].status.clear();
dudes[n].attitude = dudes[n].start_attitude; // TODO: Is this right?
dudes[n].cur_loc = dudes[n].start_loc;
diff --git a/src/classes/monster.cpp b/src/classes/monster.cpp
index d8898c64..a0b38c2f 100644
--- a/src/classes/monster.cpp
+++ b/src/classes/monster.cpp
@@ -128,7 +128,7 @@ void cCreature::append(legacy::creature_data_type old){
m_morale = old.m_d.m_morale;
for(int i = 0; i < 15; i++)
status[(eStatus) i] = old.m_d.status[i];
- direction = old.m_d.direction;
+ direction = eDirection(old.m_d.direction);
}
cMonster::cAttack::operator int() const {
@@ -173,6 +173,19 @@ std::istream& operator >> (std::istream& in, eRace& e){
return in;
}
+std::ostream& operator << (std::ostream& out, eDirection e) {
+ return out << (int)e;
+}
+
+std::istream& operator >> (std::istream& in, eDirection& e) {
+ int i;
+ in >> i;
+ if(i >= 0 && i < 8)
+ e = (eDirection)i;
+ else e = DIR_HERE;
+ return in;
+}
+
cMonster::cAbility::operator std::string(){
std::ostringstream sout;
short i = 0;
@@ -447,14 +460,14 @@ std::string cMonster::getAbil2Name() {
return (std::string) abil2;
}
-bool cMonster::hasAbil(eMonstAbil what, unsigned char* x1, unsigned char* x2){
+bool cMonster::hasAbil(eMonstAbil what, unsigned short& x1, unsigned short& x2){
if(abil1.abil == what){
- if(x1 != NULL) *x1 = abil1.extra1;
- if(x2 != NULL) *x2 = abil1.extra2;
+ x1 = abil1.extra1;
+ x2 = abil1.extra2;
return true;
}else if(abil2.abil == what){
- if(x1 != NULL) *x1 = abil2.extra1;
- if(x2 != NULL) *x2 = abil2.extra2;
+ x1 = abil2.extra1;
+ x2 = abil2.extra2;
return true;
}
return false;
diff --git a/src/classes/monster.h b/src/classes/monster.h
index e9752aeb..317f1718 100644
--- a/src/classes/monster.h
+++ b/src/classes/monster.h
@@ -95,6 +95,24 @@ class cUniverse;
//as said 13 and 14 are unused
#define MONSTER_DEATH_TRIGGERS 15 //death triggers global special
+// Directions!
+enum eDirection {
+ DIR_N = 0,
+ DIR_NE = 1,
+ DIR_E = 2,
+ DIR_SE = 3,
+ DIR_S = 4,
+ DIR_SW = 5,
+ DIR_W = 6,
+ DIR_NW = 7,
+ DIR_HERE = 8,
+};
+
+inline eDirection& operator++ (eDirection& me, int) {
+ if(me == DIR_HERE) return me = DIR_N;
+ else return me = (eDirection)(1 + (int)me);
+}
+
class cMonster {
public:
struct cAttack{
@@ -142,7 +160,7 @@ public:
std::string getAbil1Name();
std::string getAbil2Name();
- bool hasAbil(eMonstAbil what, unsigned char* x1 = NULL, unsigned char* x2 = NULL);
+ bool hasAbil(eMonstAbil what, unsigned short& x1, unsigned short& x2);
void append(legacy::monster_record_type& old);
cMonster();
void writeTo(std::ostream& file) const;
@@ -156,7 +174,7 @@ public:
short active, attitude;
unsigned char start_attitude;
location start_loc, cur_loc;
- unsigned char mobility; // Was a bool, but am making it a char to allow for additional mobility states
+ unsigned short mobility;
unsigned char time_flag;
short summoned;
unsigned char extra1, extra2;
@@ -169,10 +187,10 @@ public:
short health;
short mp;
short max_mp;
- unsigned char ap;
+ short ap;
short morale,m_morale; // these are calculated in-game based on the level
std::map status;
- unsigned char direction;
+ eDirection direction;
cCreature();
cCreature(int num);
@@ -189,5 +207,7 @@ std::ostream& operator << (std::ostream& out, eRace e);
std::istream& operator >> (std::istream& in, eRace& e);
std::ostream& operator << (std::ostream& out, eMonstAbil e);
std::istream& operator >> (std::istream& in, eMonstAbil& e);
+std::ostream& operator << (std::ostream& out, eDirection e);
+std::istream& operator >> (std::istream& in, eDirection& e);
std::ostream& operator<<(std::ostream& out, const cMonster::cAttack& att);
#endif
diff --git a/src/classes/outdoors.h b/src/classes/outdoors.h
index b3bf7989..2049e429 100644
--- a/src/classes/outdoors.h
+++ b/src/classes/outdoors.h
@@ -56,7 +56,7 @@ public:
location special_locs[18];
unsigned short special_id[18];
location exit_locs[8];
- char exit_dests[8];
+ short exit_dests[8];
location sign_locs[8];
cWandering wandering[4],special_enc[4];
location wandering_locs[4];
diff --git a/src/classes/party.h b/src/classes/party.h
index b937dfb3..7c0acbda 100644
--- a/src/classes/party.h
+++ b/src/classes/party.h
@@ -60,7 +60,7 @@ public:
};
class cTimer {
public:
- short time;
+ long time;
short global_or_town;
short node_to_call;
};
diff --git a/src/classes/special.h b/src/classes/special.h
index 6f07f47f..df6b96e8 100644
--- a/src/classes/special.h
+++ b/src/classes/special.h
@@ -43,7 +43,7 @@ public:
struct pending_special_type {
spec_num_t spec;
eSpecCtx mode;
- unsigned char type; // 0 - scen, 1 - out, 2 - town
+ unsigned short type; // 0 - scen, 1 - out, 2 - town
location where;
long long trigger_time;
};
diff --git a/src/classes/town.cpp b/src/classes/town.cpp
index 9e842379..1b8a5f71 100644
--- a/src/classes/town.cpp
+++ b/src/classes/town.cpp
@@ -239,8 +239,8 @@ void cTown::set_up_lights() {
if(rad > 0) {
for(where.x = std::max(0,i - rad); where.x < std::min(this->max_dim(),short(i + rad + 1)); where.x++)
for(where.y = std::max(0,j - rad); where.y < std::min(this->max_dim(),short(j + rad + 1)); where.y++)
- if((where_lit[where.x][where.y] == 0) && (dist(where,l) <= rad) && (can_see(l,where,get_obscurity) < 5))
- where_lit[where.x][where.y] = 1;
+ if(!where_lit[where.x][where.y] && dist(where,l) <= rad && can_see(l,where,get_obscurity) < 5)
+ where_lit[where.x][where.y] = true;
}
}
for(short i = 0; i < 8; i++)
@@ -248,7 +248,7 @@ void cTown::set_up_lights() {
this->lighting(i,j) = 0;
for(where.x = 0; where.x < this->max_dim(); where.x++)
for(where.y = 0; where.y < this->max_dim(); where.y++) {
- if(where_lit[where.x][where.y] > 0) {
+ if(where_lit[where.x][where.y]) {
this->lighting(where.x / 8,where.y) = this->lighting(where.x / 8,where.y) | (1 << (where.x % 8));
}
}
diff --git a/src/classes/town.h b/src/classes/town.h
index a4cbce5d..108b524d 100644
--- a/src/classes/town.h
+++ b/src/classes/town.h
@@ -68,7 +68,8 @@ public:
public:
location loc;
short code,ability;
- unsigned char charges,always_there,property,contained;
+ unsigned char charges;
+ bool always_there, property, contained;
void append(legacy::preset_item_type old);
};
diff --git a/src/classes/universe.cpp b/src/classes/universe.cpp
index 95c24b97..53ffed64 100644
--- a/src/classes/universe.cpp
+++ b/src/classes/universe.cpp
@@ -179,56 +179,56 @@ cTown*const cCurTown::record() const {
return univ.scenario.towns[num];
}
-bool cCurTown::is_explored(char x, char y) const{
+bool cCurTown::is_explored(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & SPECIAL_EXPLORED;
}
-bool cCurTown::is_force_wall(char x, char y) const{
+bool cCurTown::is_force_wall(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & WALL_FORCE;
}
-bool cCurTown::is_fire_wall(char x, char y) const{
+bool cCurTown::is_fire_wall(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & WALL_FIRE;
}
-bool cCurTown::is_antimagic(char x, char y) const{
+bool cCurTown::is_antimagic(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & FIELD_ANTIMAGIC;
}
-bool cCurTown::is_scloud(char x, char y) const{ // stinking cloud
+bool cCurTown::is_scloud(short x, short y) const{ // stinking cloud
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & CLOUD_STINK;
}
-bool cCurTown::is_ice_wall(char x, char y) const{
+bool cCurTown::is_ice_wall(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & WALL_ICE;
}
-bool cCurTown::is_blade_wall(char x, char y) const{
+bool cCurTown::is_blade_wall(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & WALL_BLADES;
}
-bool cCurTown::is_sleep_cloud(char x, char y) const{
+bool cCurTown::is_sleep_cloud(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & CLOUD_SLEEP;
}
-bool cCurTown::is_block(char x, char y) const{ // currently unused
+bool cCurTown::is_block(short x, short y) const{ // currently unused
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & OBJECT_BLOCK;
}
-bool cCurTown::is_spot(char x, char y) const{
+bool cCurTown::is_spot(short x, short y) const{
return fields[x][y] & SPECIAL_SPOT;
}
-bool cCurTown::is_special(char x, char y) const{
+bool cCurTown::is_special(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
for(int i = 0; i < 50; i++)
if(x == record()->special_locs[i].x && y == record()->special_locs[i].y)
@@ -236,89 +236,89 @@ bool cCurTown::is_special(char x, char y) const{
return false;
}
-bool cCurTown::is_web(char x, char y) const{
+bool cCurTown::is_web(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & FIELD_WEB;
}
-bool cCurTown::is_crate(char x, char y) const{
+bool cCurTown::is_crate(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & OBJECT_CRATE;
}
-bool cCurTown::is_barrel(char x, char y) const{
+bool cCurTown::is_barrel(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & OBJECT_BARREL;
}
-bool cCurTown::is_fire_barr(char x, char y) const{
+bool cCurTown::is_fire_barr(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & BARRIER_FIRE;
}
-bool cCurTown::is_force_barr(char x, char y) const{
+bool cCurTown::is_force_barr(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & BARRIER_FORCE;
}
-bool cCurTown::is_quickfire(char x, char y) const{
+bool cCurTown::is_quickfire(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & FIELD_QUICKFIRE;
}
-bool cCurTown::is_sm_blood(char x, char y) const{
+bool cCurTown::is_sm_blood(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & SFX_SMALL_BLOOD;
}
-bool cCurTown::is_med_blood(char x, char y) const{
+bool cCurTown::is_med_blood(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & SFX_MEDIUM_BLOOD;
}
-bool cCurTown::is_lg_blood(char x, char y) const{
+bool cCurTown::is_lg_blood(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & SFX_LARGE_BLOOD;
}
-bool cCurTown::is_sm_slime(char x, char y) const{
+bool cCurTown::is_sm_slime(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & SFX_SMALL_SLIME;
}
-bool cCurTown::is_lg_slime(char x, char y) const{
+bool cCurTown::is_lg_slime(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & SFX_LARGE_SLIME;
}
-bool cCurTown::is_ash(char x, char y) const{
+bool cCurTown::is_ash(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & SFX_ASH;
}
-bool cCurTown::is_bones(char x, char y) const{
+bool cCurTown::is_bones(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & SFX_BONES;
}
-bool cCurTown::is_rubble(char x, char y) const{
+bool cCurTown::is_rubble(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & SFX_RUBBLE;
}
-bool cCurTown::is_force_cage(char x, char y) const{
+bool cCurTown::is_force_cage(short x, short y) const{
if(x > record()->max_dim() || y > record()->max_dim()) return false;
return fields[x][y] & BARRIER_CAGE;
}
-bool cCurTown::set_explored(char x, char y, bool b){
+bool cCurTown::set_explored(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b) fields[x][y] |= SPECIAL_EXPLORED;
else fields[x][y] &= ~SPECIAL_EXPLORED;
return true;
}
-bool cCurTown::set_force_wall(char x, char y, bool b){
+bool cCurTown::set_force_wall(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on space, there's no room for field.
if(is_impassable(x,y))
@@ -335,7 +335,7 @@ bool cCurTown::set_force_wall(char x, char y, bool b){
return true;
}
-bool cCurTown::set_fire_wall(char x, char y, bool b){
+bool cCurTown::set_fire_wall(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on space, there's no room for field.
if(is_impassable(x,y))
@@ -354,7 +354,7 @@ bool cCurTown::set_fire_wall(char x, char y, bool b){
return true;
}
-bool cCurTown::set_antimagic(char x, char y, bool b){
+bool cCurTown::set_antimagic(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on space, there's no room for a field.
if(is_impassable(x,y))
@@ -374,7 +374,7 @@ bool cCurTown::set_antimagic(char x, char y, bool b){
return true;
}
-bool cCurTown::set_scloud(char x, char y, bool b){ // stinking cloud
+bool cCurTown::set_scloud(short x, short y, bool b){ // stinking cloud
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on space, there's no room for cloud.
if(is_impassable(x,y))
@@ -391,7 +391,7 @@ bool cCurTown::set_scloud(char x, char y, bool b){ // stinking cloud
return true;
}
-bool cCurTown::set_ice_wall(char x, char y, bool b){
+bool cCurTown::set_ice_wall(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on space, ther's no room for a field.
if(is_impassable(x,y))
@@ -410,7 +410,7 @@ bool cCurTown::set_ice_wall(char x, char y, bool b){
return true;
}
-bool cCurTown::set_blade_wall(char x, char y, bool b){
+bool cCurTown::set_blade_wall(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // if certain things are on space, there's no room for a field.
if(is_impassable(x,y))
@@ -425,7 +425,7 @@ bool cCurTown::set_blade_wall(char x, char y, bool b){
return true;
}
-bool cCurTown::set_sleep_cloud(char x, char y, bool b){
+bool cCurTown::set_sleep_cloud(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // if certain things are on space, there's no room for cloud.
if(is_impassable(x,y))
@@ -440,21 +440,21 @@ bool cCurTown::set_sleep_cloud(char x, char y, bool b){
return true;
}
-bool cCurTown::set_block(char x, char y, bool b){ // currently unused
+bool cCurTown::set_block(short x, short y, bool b){ // currently unused
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b) fields[x][y] |= OBJECT_BLOCK;
else fields[x][y] &= ~OBJECT_BLOCK;
return true;
}
-bool cCurTown::set_spot(char x, char y, bool b){
+bool cCurTown::set_spot(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b) fields[x][y] |= SPECIAL_SPOT;
else fields[x][y] &= ~SPECIAL_SPOT;
return true;
}
-bool cCurTown::set_web(char x, char y, bool b){
+bool cCurTown::set_web(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on the space, there's no room for webs
if(is_impassable(x,y))
@@ -471,7 +471,7 @@ bool cCurTown::set_web(char x, char y, bool b){
return true;
}
-bool cCurTown::set_crate(char x, char y, bool b){
+bool cCurTown::set_crate(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on the space, there's no room for a crate.
if(is_fire_barr(x,y) || is_force_barr(x,y) || is_quickfire(x,y) || is_barrel(x,y))
@@ -482,7 +482,7 @@ bool cCurTown::set_crate(char x, char y, bool b){
return true;
}
-bool cCurTown::set_barrel(char x, char y, bool b){
+bool cCurTown::set_barrel(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on the space, there's no room for a crate.
if(is_fire_barr(x,y) || is_force_barr(x,y) || is_quickfire(x,y) || is_crate(x,y))
@@ -493,7 +493,7 @@ bool cCurTown::set_barrel(char x, char y, bool b){
return true;
}
-bool cCurTown::set_fire_barr(char x, char y, bool b){
+bool cCurTown::set_fire_barr(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on the space, there's no room for a barrier.
if(is_barrel(x,y) || is_force_barr(x,y) || is_quickfire(x,y) || is_crate(x,y))
@@ -515,7 +515,7 @@ bool cCurTown::set_fire_barr(char x, char y, bool b){
return true;
}
-bool cCurTown::set_force_barr(char x, char y, bool b){
+bool cCurTown::set_force_barr(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on the space, there's no room for a barrier.
if(is_fire_barr(x,y) || is_barrel(x,y) || is_quickfire(x,y) || is_crate(x,y))
@@ -537,7 +537,7 @@ bool cCurTown::set_force_barr(char x, char y, bool b){
return true;
}
-bool cCurTown::set_quickfire(char x, char y, bool b){
+bool cCurTown::set_quickfire(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){ // If certain things are on space, there's no room for quickfire.
ter_num_t ter = record()->terrain(x,y);
@@ -577,7 +577,7 @@ bool cCurTown::free_for_sfx(short x, short y) {
return true;
}
-bool cCurTown::set_sm_blood(char x, char y, bool b){
+bool cCurTown::set_sm_blood(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){
if(!free_for_sfx(x,y)) return false;
@@ -594,7 +594,7 @@ bool cCurTown::set_sm_blood(char x, char y, bool b){
return true;
}
-bool cCurTown::set_med_blood(char x, char y, bool b){
+bool cCurTown::set_med_blood(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){
if(!free_for_sfx(x,y)) return false;
@@ -612,7 +612,7 @@ bool cCurTown::set_med_blood(char x, char y, bool b){
return true;
}
-bool cCurTown::set_lg_blood(char x, char y, bool b){
+bool cCurTown::set_lg_blood(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){
if(!free_for_sfx(x,y)) return false;
@@ -629,7 +629,7 @@ bool cCurTown::set_lg_blood(char x, char y, bool b){
return true;
}
-bool cCurTown::set_sm_slime(char x, char y, bool b){
+bool cCurTown::set_sm_slime(short x, short y, bool b){
if(b){
if(!free_for_sfx(x,y)) return false;
if(is_lg_slime(x,y))
@@ -646,7 +646,7 @@ bool cCurTown::set_sm_slime(char x, char y, bool b){
return true;
}
-bool cCurTown::set_lg_slime(char x, char y, bool b){
+bool cCurTown::set_lg_slime(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){
if(!free_for_sfx(x,y)) return false;
@@ -663,7 +663,7 @@ bool cCurTown::set_lg_slime(char x, char y, bool b){
return true;
}
-bool cCurTown::set_ash(char x, char y, bool b){
+bool cCurTown::set_ash(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){
if(!free_for_sfx(x,y)) return false;
@@ -680,7 +680,7 @@ bool cCurTown::set_ash(char x, char y, bool b){
return true;
}
-bool cCurTown::set_bones(char x, char y, bool b){
+bool cCurTown::set_bones(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){
if(!free_for_sfx(x,y)) return false;
@@ -697,7 +697,7 @@ bool cCurTown::set_bones(char x, char y, bool b){
return true;
}
-bool cCurTown::set_rubble(char x, char y, bool b){
+bool cCurTown::set_rubble(short x, short y, bool b){
if(x > record()->max_dim() || y > record()->max_dim()) return false;
if(b){
if(!free_for_sfx(x,y)) return false;
@@ -714,7 +714,7 @@ bool cCurTown::set_rubble(char x, char y, bool b){
return true;
}
-bool cCurTown::set_force_cage(char x, char y, bool b){
+bool cCurTown::set_force_cage(short x, short y, bool b){
// TODO: Consider whether placing a forcecage should erase anything already present, or fail due to something already present
// TODO: Also consider checking for forcecage in some of the other placement functions.
if(x > record()->max_dim() || y > record()->max_dim()) return false;
@@ -723,7 +723,7 @@ bool cCurTown::set_force_cage(char x, char y, bool b){
return true;
}
-//bool cCurTown::set_trim(char x, char y, char t, bool b){
+//bool cCurTown::set_trim(short x, short y, char t, bool b){
// unsigned char bit = 1 << t;
// if(b){
// switch(t){
diff --git a/src/classes/universe.h b/src/classes/universe.h
index 3021dc4a..d19be063 100644
--- a/src/classes/universe.h
+++ b/src/classes/universe.h
@@ -68,59 +68,59 @@ public:
void prep_arena(); // Set up for a combat arena
void place_preset_fields();
- bool is_explored(char x, char y) const;
- bool is_force_wall(char x, char y) const;
- bool is_fire_wall(char x, char y) const;
- bool is_antimagic(char x, char y) const;
- bool is_scloud(char x, char y) const; // stinking cloud
- bool is_ice_wall(char x, char y) const;
- bool is_blade_wall(char x, char y) const;
- bool is_sleep_cloud(char x, char y) const;
- bool is_block(char x, char y) const; // currently unused
- bool is_spot(char x, char y) const;
- bool is_special(char x, char y) const;
- bool is_web(char x, char y) const;
- bool is_crate(char x, char y) const;
- bool is_barrel(char x, char y) const;
- bool is_fire_barr(char x, char y) const;
- bool is_force_barr(char x, char y) const;
- bool is_quickfire(char x, char y) const;
- bool is_sm_blood(char x, char y) const;
- bool is_med_blood(char x, char y) const;
- bool is_lg_blood(char x, char y) const;
- bool is_sm_slime(char x, char y) const;
- bool is_lg_slime(char x, char y) const;
- bool is_ash(char x, char y) const;
- bool is_bones(char x, char y) const;
- bool is_rubble(char x, char y) const;
- bool is_force_cage(char x, char y) const;
-// bool is_trim(char x, char y, char t) const;
- bool set_explored(char x, char y, bool b);
- bool set_force_wall(char x, char y, bool b);
- bool set_fire_wall(char x, char y, bool b);
- bool set_antimagic(char x, char y, bool b);
- bool set_scloud(char x, char y, bool b); // stinking cloud
- bool set_ice_wall(char x, char y, bool b);
- bool set_blade_wall(char x, char y, bool b);
- bool set_sleep_cloud(char x, char y, bool b);
- bool set_block(char x, char y, bool b); // currently unused
- bool set_spot(char x, char y, bool b);
- bool set_web(char x, char y, bool b);
- bool set_crate(char x, char y, bool b);
- bool set_barrel(char x, char y, bool b);
- bool set_fire_barr(char x, char y, bool b);
- bool set_force_barr(char x, char y, bool b);
- bool set_quickfire(char x, char y, bool b);
- bool set_sm_blood(char x, char y, bool b);
- bool set_med_blood(char x, char y, bool b);
- bool set_lg_blood(char x, char y, bool b);
- bool set_sm_slime(char x, char y, bool b);
- bool set_lg_slime(char x, char y, bool b);
- bool set_ash(char x, char y, bool b);
- bool set_bones(char x, char y, bool b);
- bool set_rubble(char x, char y, bool b);
- bool set_force_cage(char x, char y, bool b);
-// bool set_trim(char x, char y, char t, bool b);
+ bool is_explored(short x, short y) const;
+ bool is_force_wall(short x, short y) const;
+ bool is_fire_wall(short x, short y) const;
+ bool is_antimagic(short x, short y) const;
+ bool is_scloud(short x, short y) const; // stinking cloud
+ bool is_ice_wall(short x, short y) const;
+ bool is_blade_wall(short x, short y) const;
+ bool is_sleep_cloud(short x, short y) const;
+ bool is_block(short x, short y) const; // currently unused
+ bool is_spot(short x, short y) const;
+ bool is_special(short x, short y) const;
+ bool is_web(short x, short y) const;
+ bool is_crate(short x, short y) const;
+ bool is_barrel(short x, short y) const;
+ bool is_fire_barr(short x, short y) const;
+ bool is_force_barr(short x, short y) const;
+ bool is_quickfire(short x, short y) const;
+ bool is_sm_blood(short x, short y) const;
+ bool is_med_blood(short x, short y) const;
+ bool is_lg_blood(short x, short y) const;
+ bool is_sm_slime(short x, short y) const;
+ bool is_lg_slime(short x, short y) const;
+ bool is_ash(short x, short y) const;
+ bool is_bones(short x, short y) const;
+ bool is_rubble(short x, short y) const;
+ bool is_force_cage(short x, short y) const;
+// bool is_trim(short x, short y, char t) const;
+ bool set_explored(short x, short y, bool b);
+ bool set_force_wall(short x, short y, bool b);
+ bool set_fire_wall(short x, short y, bool b);
+ bool set_antimagic(short x, short y, bool b);
+ bool set_scloud(short x, short y, bool b); // stinking cloud
+ bool set_ice_wall(short x, short y, bool b);
+ bool set_blade_wall(short x, short y, bool b);
+ bool set_sleep_cloud(short x, short y, bool b);
+ bool set_block(short x, short y, bool b); // currently unused
+ bool set_spot(short x, short y, bool b);
+ bool set_web(short x, short y, bool b);
+ bool set_crate(short x, short y, bool b);
+ bool set_barrel(short x, short y, bool b);
+ bool set_fire_barr(short x, short y, bool b);
+ bool set_force_barr(short x, short y, bool b);
+ bool set_quickfire(short x, short y, bool b);
+ bool set_sm_blood(short x, short y, bool b);
+ bool set_med_blood(short x, short y, bool b);
+ bool set_lg_blood(short x, short y, bool b);
+ bool set_sm_slime(short x, short y, bool b);
+ bool set_lg_slime(short x, short y, bool b);
+ bool set_ash(short x, short y, bool b);
+ bool set_bones(short x, short y, bool b);
+ bool set_rubble(short x, short y, bool b);
+ bool set_force_cage(short x, short y, bool b);
+// bool set_trim(short x, short y, char t, bool b);
bool is_impassable(short x, short y);
void writeTo(std::ostream& file) const;
void readFrom(std::istream& file);
diff --git a/src/oldstructs.cpp b/src/oldstructs.cpp
index a85f5667..78ffee6a 100644
--- a/src/oldstructs.cpp
+++ b/src/oldstructs.cpp
@@ -22,6 +22,11 @@ using namespace legacy;
log << " " << #member << ": " << sizeof(temp_##what . member) << " bytes, offset " \
<< offsetof(what,member) << std::endl
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4101)
+#endif
+
// This is just a function to output all known information about each struct and its members.
void debug_oldstructs(); // Suppress "no prototype" warning
void debug_oldstructs() {
@@ -452,3 +457,7 @@ void debug_oldstructs() {
}
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/pcedit/pc.editors.cpp b/src/pcedit/pc.editors.cpp
index 52b71267..d6cb87bb 100644
--- a/src/pcedit/pc.editors.cpp
+++ b/src/pcedit/pc.editors.cpp
@@ -97,7 +97,7 @@ bool talk_done = false;
long val_for_text;
bool keep_change = false;
short store_h,store_sp,i,store_skp;
-long store_g;
+unsigned short store_g;
short store_train_mode,store_train_pc;
static bool select_pc_event_filter (cDialog& me, std::string item_hit, eKeyMod) {
@@ -230,13 +230,13 @@ static void display_traits_graphics(cDialog& me) {
for(i = 0; i < 10; i++) {
std::string id = "good" + boost::lexical_cast(i + 1);
eTrait trait = eTrait(i);
- dynamic_cast(me[id]).setState((store_pc->traits[trait] > 0) ? led_red : led_off);
+ dynamic_cast(me[id]).setState(store_pc->traits[trait] ? led_red : led_off);
}
for(i = 0; i < 5; i++) {
// TODO: Pacifist
std::string id = "bad" + boost::lexical_cast(i + 1);
eTrait trait = eTrait(i + 10);
- dynamic_cast(me[id]).setState((store_pc->traits[trait] > 0) ? led_red : led_off);
+ dynamic_cast(me[id]).setState(store_pc->traits[trait] ? led_red : led_off);
}
store = store_pc->get_tnl();
diff --git a/src/pcedit/pc.fileio.cpp b/src/pcedit/pc.fileio.cpp
index e89292fc..75d5268b 100644
--- a/src/pcedit/pc.fileio.cpp
+++ b/src/pcedit/pc.fileio.cpp
@@ -63,28 +63,6 @@ void remove_party_from_scen() {
load_base_item_defs();
}
-/*
- * XXX This was referenced but not defined, so I copied the implementation
- * from blxfileio.c. Need to check that it's OK.
- */
-short init_data(short flag) {
- long k = 0;
-
- k = (long) flag;
- k = k * k;
- jl = jl * jl + 84 + k;
- k = k + 51;
- jl = jl * 2 + 1234 + k;
- k = k % 3000;
- jl = jl * 54;
- jl = jl * 2 + 1234 + k;
- k = k * 82;
- k = k % 10000;
- k = k + 10000;
-
- return (short) k;
-}
-
void load_base_item_defs(){
fs::path basePath = progDir/"Scenario Editor"/"Blades of Exile Base"/"bladbase.exs";
scen_items_loaded = load_scenario(basePath, univ.scenario);
diff --git a/src/pcedit/pc.main.cpp b/src/pcedit/pc.main.cpp
index 2e8c6ed4..1971b9cb 100644
--- a/src/pcedit/pc.main.cpp
+++ b/src/pcedit/pc.main.cpp
@@ -235,7 +235,7 @@ void handle_menu_choice(eMenu item_hit) {
break;
case eMenu::LEAVE_TOWN:
- if(univ.party.is_split() > 0) {
+ if(univ.party.is_split()) {
cChoiceDlog("reunite-first").show();
break;
}
@@ -244,7 +244,7 @@ void handle_menu_choice(eMenu item_hit) {
break;
case eMenu::REUNITE_PARTY:
- if(univ.party.is_split() == 0) {
+ if(!univ.party.is_split()) {
cChoiceDlog("not-split").show();
break;
}
diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp
index 25fb0671..e5113779 100644
--- a/src/scenedit/scen.actions.cpp
+++ b/src/scenedit/scen.actions.cpp
@@ -149,7 +149,8 @@ bool handle_action(location the_point,sf::Event /*event*/) {
bool need_redraw = false,option_hit = false,ctrl_hit = false;
location spot_hit;
location cur_point,cur_point2;
- short right_top,right_hit;
+ long right_top;
+ short right_hit;
eScenMode old_mode;
rectangle temp_rect;
//printf("Handling click at {v = %i,h = %i}\n",the_point.v,the_point.h);
@@ -989,7 +990,7 @@ bool handle_action(location the_point,sf::Event /*event*/) {
cur_point2.y -= terrain_rects[255].bottom + 5;
for(i = 0; i < 10; i++)
for(j = 0; j < 6; j++) {
- if((good_palette_buttons[editing_town][j][i] > 0) && !mouse_button_held && (cur_point2.in(palette_buttons[i][j]))
+ if(good_palette_buttons[editing_town][j][i] && !mouse_button_held && cur_point2.in(palette_buttons[i][j])
&& /*((j < 3) || (editing_town)) &&*/ (overall_mode < MODE_MAIN_SCREEN)) {
temp_rect = palette_buttons[i][j];
temp_rect.offset(RIGHT_AREA_UL_X + 5, RIGHT_AREA_UL_Y + terrain_rects[255].bottom + 5);
@@ -1697,27 +1698,6 @@ void change_rect_terrain(rectangle r,ter_num_t terrain_type,short probability,bo
}
}
-void swap_val(unsigned char *val,short a,short b) {
- if(*val == a)
- *val = b;
- else if(*val == b)
- *val = a;
-}
-void change_val_4 (unsigned char *val,short a,short b,short c,short d) {
- if(*val == a)
- *val = b;
- else if(*val == b)
- *val = c;
- else if(*val == c)
- *val = d;
- else if(*val == d)
- *val = a;
-}
-void change_val (unsigned char *val,short a,short b) {
- if(*val == a)
- *val = b;
-}
-
void frill_up_terrain() {
short i,j;
ter_num_t terrain_type;
@@ -1763,7 +1743,7 @@ void unfrill_terrain() {
draw_terrain();
}
-static ter_num_t find_object_part(unsigned char num, unsigned char x, unsigned char y, ter_num_t fallback){
+static ter_num_t find_object_part(unsigned char num, short x, short y, ter_num_t fallback){
for(int i = 0; i < 256; i++){
if(scenario.ter_types[i].obj_num == num &&
scenario.ter_types[i].obj_pos.x == x &&
@@ -2810,7 +2790,7 @@ void adjust_space(location l) {
}
-bool place_item(location spot_hit,short which_item,short property,short always,short odds) {
+bool place_item(location spot_hit,short which_item,bool property,bool always,short odds) {
// odds 0 - 100, with 100 always
short x;
@@ -3239,7 +3219,7 @@ extern size_t num_strs(short mode); // defined in scen.keydlgs.cpp
// mode 0 - scen 1 - out 2 - town 3 - journal
// if just_redo_text not 0, simply need to update text portions
void start_string_editing(short mode,short just_redo_text) {
- short i,pos;
+ long pos;
char str[256];
bool draw_full = false;
@@ -3254,7 +3234,7 @@ void start_string_editing(short mode,short just_redo_text) {
reset_rb();
right_sbar->setMaximum(num_strs(mode) - NRSONPAGE);
}
- for(i = 0; i < num_strs(mode); i++) {
+ for(size_t i = 0; i < num_strs(mode); i++) {
switch(mode) {
case 0:
sprintf((char *) str,"%d - %-30.30s",i,scenario.spec_strs[i].c_str());
@@ -3286,7 +3266,7 @@ void start_string_editing(short mode,short just_redo_text) {
pos = right_sbar->getPosition();
if(draw_full)
redraw_screen();
- else for(i = 0; i < NRSONPAGE; i++)
+ else for(int i = 0; i < NRSONPAGE; i++)
draw_rb_slot(i + pos,0);
set_lb(NLS - 3,1,"Command-click to clear",1);
}
diff --git a/src/scenedit/scen.actions.h b/src/scenedit/scen.actions.h
index d8e51169..de9fe4cf 100644
--- a/src/scenedit/scen.actions.h
+++ b/src/scenedit/scen.actions.h
@@ -20,9 +20,6 @@ bool is_correctable_water(short i,short j);
void shy_change_circle_terrain(location center,short radius,ter_num_t terrain_type,short probability);
void change_circle_terrain(location center,short radius,ter_num_t terrain_type,short probability);
void change_rect_terrain(rectangle r,ter_num_t terrain_type,short probability,bool hollow);
-void swap_val(unsigned char *val,short a,short b);
-void change_val_4 (unsigned char *val,short a,short b,short c,short d);
-void change_val (unsigned char *val,short a,short b);
void frill_up_terrain();
void unfrill_terrain();
void set_terrain(location l,ter_num_t terrain_type);
@@ -39,7 +36,7 @@ bool out_fix_water(location l);
void adjust_space(location l);
bool is_lava(short x,short y);
ter_num_t coord_to_ter(short x,short y);
-bool place_item(location spot_hit,short which_item,short property,short always,short odds);
+bool place_item(location spot_hit,short which_item,bool property,bool always,short odds);
void place_items_in_town();
void set_up_start_screen();
void set_up_main_screen();
diff --git a/src/scenedit/scen.core.cpp b/src/scenedit/scen.core.cpp
index a30ee0fd..c8bfffe9 100644
--- a/src/scenedit/scen.core.cpp
+++ b/src/scenedit/scen.core.cpp
@@ -442,7 +442,7 @@ static bool check_monst_pic(cDialog& me, std::string id, bool losing, cMonster&
}
else {
// TODO: Update this with new value if more monster pictures are added later
- if(cre(store_monst.picture_num,0,200,"Non-customized monster pic must be from 0 to 200.","",&me) > 0) return false;
+ if(cre(store_monst.picture_num,0,200,"Non-customized monster pic must be from 0 to 200.","",&me)) return false;
store_monst.x_width = m_pic_index[store_monst.picture_num].x;
store_monst.y_width = m_pic_index[store_monst.picture_num].y;
diff --git a/src/scenedit/scen.graphics.cpp b/src/scenedit/scen.graphics.cpp
index 4deeeed5..7fa72f41 100644
--- a/src/scenedit/scen.graphics.cpp
+++ b/src/scenedit/scen.graphics.cpp
@@ -389,8 +389,8 @@ void redraw_screen() {
rectangle windRect(mainPtr);
tileImage(mainPtr,windRect,bg[20]);
draw_main_screen();
- if(overall_mode < MODE_MAIN_SCREEN);
- draw_terrain();
+ if(overall_mode < MODE_MAIN_SCREEN)
+ draw_terrain();
mainPtr.display();
}
@@ -467,17 +467,15 @@ void draw_lb_slot (short which,short mode) {
}
void draw_rb() {
- short i,pos;
-
- pos = right_sbar->getPosition();
- for(i = pos; i < pos + NRSONPAGE; i++)
+ long pos = right_sbar->getPosition();
+ for(long i = pos; i < pos + NRSONPAGE; i++)
draw_rb_slot(i,0);
}
// mode 0 normal 1 pressed
void draw_rb_slot (short which,short mode) {
rectangle text_rect;
- short pos;
+ long pos;
pos = right_sbar->getPosition();
if((which < pos) || (which >= pos + NRSONPAGE))
@@ -599,7 +597,7 @@ void draw_terrain(){
short q,r,x,i,small_i;
location which_pt,where_draw;
rectangle draw_rect,clipping_rect = {8,8,332,260};
- unsigned char t_to_draw;
+ ter_num_t t_to_draw;
rectangle source_rect,tiny_to,tiny_to_base = {37,29,44,36},tiny_from,from_rect,to_rect;
rectangle boat_rect = {0,0,36,28};
diff --git a/src/scenedit/scen.keydlgs.cpp b/src/scenedit/scen.keydlgs.cpp
index 5519f163..bf64de1e 100644
--- a/src/scenedit/scen.keydlgs.cpp
+++ b/src/scenedit/scen.keydlgs.cpp
@@ -790,7 +790,7 @@ short get_fresh_spec(short which_mode) {
static bool edit_spec_text_event_filter(cDialog& me, std::string item_hit, short spec_str_mode, short* str1, short* str2) {
std::string str;
- short i;
+ size_t i;
if(item_hit == "okay") {
str = me["str1"].getText();
@@ -1026,7 +1026,7 @@ static bool edit_dialog_text_event_filter(cDialog& me, std::string item_hit, sho
// mode 0 - scen 1 - out 2 - town
void edit_dialog_text(short mode,short *str1,cDialog* parent) {
- short i,j;
+ size_t i,j;
short num_s_strs[3] = {100,90,100};
if(*str1 >= num_s_strs[mode] - 6)
@@ -1068,7 +1068,7 @@ void edit_dialog_text(short mode,short *str1,cDialog* parent) {
}
}
if(*str1 >= 0)
- for(i = *str1; i < *str1 + 6; i++) {
+ for(short i = *str1; i < *str1 + 6; i++) {
switch(mode) {
case 0:
scenario.spec_strs[i] = "";
diff --git a/src/scenedit/scen.main.cpp b/src/scenedit/scen.main.cpp
index 152447aa..e531754f 100644
--- a/src/scenedit/scen.main.cpp
+++ b/src/scenedit/scen.main.cpp
@@ -129,27 +129,14 @@ int main(int, char* argv[]) {
}
}
-//
-// Initialize everything for the program, make sure we can run
-//
-
-//MW specified argument and return type.
void Initialize(void) {
-
-
- //
// To make the Random sequences truly random, we need to make the seed start
// at a different number. An easy way to do this is to put the current time
// and date into the seed. Since it is always incrementing the starting seed
// will always be different. Don’t for each call of Random, or the sequence
// will no longer be random. Only needed once, here in the init.
- //
- //unsigned long time;
- //GetDateTime(&time);
- //SetQDGlobalsRandomSeed(time);
srand(time(NULL));
- //
// Make a new window for drawing in, and it must be a color window.
// The window is full screen size, made smaller to make it more visible.
//
diff --git a/src/scenedit/scen.townout.cpp b/src/scenedit/scen.townout.cpp
index a5079cca..f99a391d 100644
--- a/src/scenedit/scen.townout.cpp
+++ b/src/scenedit/scen.townout.cpp
@@ -132,15 +132,15 @@ static void put_placed_monst_adv_in_dlog(cDialog& me) {
static bool get_placed_monst_adv_in_dlog(cDialog& me) {
store_placed_monst2.time_flag = dynamic_cast(me["time"]).getSelected()[4] - '1';
store_placed_monst2.monster_time = me["extra1"].getTextAsNum();
- if(cre(store_placed_monst2.monster_time,0,1000,"Given day must be from 0 to 1000.","",&me) > 0) return false;
+ if(cre(store_placed_monst2.monster_time,0,1000,"Given day must be from 0 to 1000.","",&me)) return false;
store_placed_monst2.time_code = me["extra2"].getTextAsNum();
- if(cre(store_placed_monst2.time_code,0,10,"Event code must be 0 (for no event) or from 1 to 10.","",&me) > 0) return false;
+ if(cre(store_placed_monst2.time_code,0,10,"Event code must be 0 (for no event) or from 1 to 10.","",&me)) return false;
store_placed_monst2.special_on_kill = me["death"].getTextAsNum();
- if(cre(store_placed_monst2.special_on_kill,-1,99,"Town special node number must be from 0 to 99 (or -1 for no special).","",&me) > 0) return false;
+ if(cre(store_placed_monst2.special_on_kill,-1,99,"Town special node number must be from 0 to 99 (or -1 for no special).","",&me)) return false;
store_placed_monst2.spec1 = me["sdfx"].getTextAsNum();
- if(cre(store_placed_monst2.spec1,-1,299,"First part of special flag must be -1 (if this is to be ignored) or from 0 to 299.","",&me) > 0) return false;
+ if(cre(store_placed_monst2.spec1,-1,299,"First part of special flag must be -1 (if this is to be ignored) or from 0 to 299.","",&me)) return false;
store_placed_monst2.spec2 = me["sdfy"].getTextAsNum();
- if(cre(store_placed_monst2.spec2,-1,9,"Second part of special flag must be -1 (if this is to be ignored) or from 0 to 9.","",&me) > 0) return false;
+ if(cre(store_placed_monst2.spec2,-1,9,"Second part of special flag must be -1 (if this is to be ignored) or from 0 to 9.","",&me)) return false;
std::string group = dynamic_cast(me["group"]).getSelected();
if(group == "group10") store_placed_monst2.spec_enc_code = 10;
@@ -848,7 +848,7 @@ static bool check_talk_key(cDialog& me, std::string item_hit, bool losing) {
std::string key = me[item_hit].getText();
bool passes = true;
if(key.length() != 4) passes = false;
- for(int i = 0; i < 4; i++) {
+ for(size_t i = 0; i < 4; i++) {
if(i < key.length() && !islower(key[i]))
passes = false;
}
@@ -1108,7 +1108,7 @@ location pick_out(location default_loc) {
bool new_town(short which_town) {
// ignore parent in Mac version
std::cout << "Town creation currently disabled.\n";
- short basic_dlog_hit,i,j,store_dialog_answer;
+ short i,j;
cChoiceDlog new_dlg("new-town", {"okay", "cancel"});
new_dlg->getControl("num").setTextToNum(which_town);
diff --git a/src/tools/cursors.win.cpp b/src/tools/cursors.win.cpp
index b031b115..0fedd709 100644
--- a/src/tools/cursors.win.cpp
+++ b/src/tools/cursors.win.cpp
@@ -24,8 +24,8 @@ static void GetMaskBitmaps(const sf::Image& srcImage, HBITMAP& hAndMaskBitmap, H
// Scan each pixel of the source bitmap and create the masks
sf::Color mainBitPixel;
- for(int x = 0; x < srcImage.getSize().x; ++x) {
- for(int y = 0; y < srcImage.getSize().y; ++y) {
+ for(size_t x = 0; x < srcImage.getSize().x; ++x) {
+ for(size_t y = 0; y < srcImage.getSize().y; ++y) {
mainBitPixel = srcImage.getPixel(x, y);
if(mainBitPixel.a == 0) {
SetPixel(hAndMaskDC, x, y, RGB(255, 255, 255));