From 26971cf0c8f57c73960bafd09cb3d1de2e01588e Mon Sep 17 00:00:00 2001 From: Sylae Corell Date: Wed, 30 Jul 2014 11:03:01 -0600 Subject: [PATCH 1/6] Some more gcc deprecation cleanups --- Win32/game/boe.fileio.cpp | 13 ++----------- Win32/game/boe.infodlg.cpp | 12 ++++++------ Win32/game/boe.infodlg.h | 6 +++--- Win32/game/boe.itemdata.cpp | 1 - Win32/game/boe.text.cpp | 4 ++-- Win32/game/boe.text.h | 4 ++-- Win32/game/classes/location.h | 12 ++++++------ Win32/game/tools/dlogtool.cpp | 2 +- Win32/game/tools/dlogtool.h | 6 +++--- 9 files changed, 25 insertions(+), 35 deletions(-) diff --git a/Win32/game/boe.fileio.cpp b/Win32/game/boe.fileio.cpp index b6e7d53b5..d68dae269 100644 --- a/Win32/game/boe.fileio.cpp +++ b/Win32/game/boe.fileio.cpp @@ -76,7 +76,7 @@ path[i+1]='\0'; // close the argument string after the last '\' void file_initialize() { -static char * szFilter[] = +static char const * szFilter[] = { "Classic BoE Save Files (*.SAV)\0*.sav\0" "Experimental BoE Save Files (*.savx)\0*.savx\0" @@ -702,7 +702,6 @@ void save_file(short mode) //mode 0 - normal 1 - save as party_record_type *party_ptr; setup_save_type *setup_ptr; pc_record_type *pc_ptr; - current_town_type *town_ptr; char *party_encryptor; @@ -1004,14 +1003,6 @@ void save_file(short mode) //mode 0 - normal 1 - save as } if (town_save == true) { - town_ptr = &c_town; - /* - len = sizeof(current_town_type); - if (WriteFile(file_id, town_ptr, sizeof(current_town_type), &bytes, NULL) == false) - { - CloseHandle(file_id); - return; - }*/ /** saving c_town **/ @@ -1888,7 +1879,7 @@ void oops_error(short error) } //called recursively if a sub-directory is founded -void ListFiles(char *path, HWND listbox){ +void ListFiles(char const *path, HWND listbox){ short len; HANDLE find_file_id; diff --git a/Win32/game/boe.infodlg.cpp b/Win32/game/boe.infodlg.cpp index 5b85cccd5..4d17a1faa 100644 --- a/Win32/game/boe.infodlg.cpp +++ b/Win32/game/boe.infodlg.cpp @@ -1205,9 +1205,9 @@ void display_strings_event_filter (short item_hit) // str_label_1 & str_label_2 used for saving button for journal // 1000 + x scen 2000 + x out 3000 + x town -void display_strings(char *text1, char *text2,short str_label_1,short str_label_2,short str_label_1b, +void display_strings(char const *text1, char const *text2,short str_label_1,short str_label_2,short str_label_1b, short str_label_2b, - char *title,short sound_num,short graphic_num,short parent_num) + char const *title,short sound_num,short graphic_num,short parent_num) { SetCursor(sword_curs); @@ -1226,9 +1226,9 @@ void display_strings(char *text1, char *text2,short str_label_1,short str_label_ csp(store_which_string_dlog,store_which_string_dlog,graphic_num); - csit(store_which_string_dlog,4,(char *) text1); + csit(store_which_string_dlog,4,text1); if (text2 != NULL) { - csit(store_which_string_dlog,5,(char *) text2); + csit(store_which_string_dlog,5,text2); } if (strlen(title) > 0) csit(store_which_string_dlog,6,title); @@ -1243,7 +1243,7 @@ void display_strings(char *text1, char *text2,short str_label_1,short str_label_ final_process_dialog(store_which_string_dlog); } -void give_error(char *text1, char *text2,short parent_num) +void give_error(char const *text1, char const *text2,short parent_num) { display_strings(text1,text2,-1,-1,-1,-1,"Error!",57,716,parent_num); } @@ -1257,6 +1257,6 @@ void display_strings_with_nums(short a1,short a2, short b1, short b2, GetIndString(str1,a1,a2); if ((b1 > 0) && (b2 > 0)) GetIndString(str2,b1,b2); - display_strings((char *) str1,(char *) str2,-1,-1,-1,-1, + display_strings(str1, str2,-1,-1,-1,-1, title, sound_num, graphic_num, parent_num); } diff --git a/Win32/game/boe.infodlg.h b/Win32/game/boe.infodlg.h index dfb8a2af3..43f88a533 100644 --- a/Win32/game/boe.infodlg.h +++ b/Win32/game/boe.infodlg.h @@ -38,10 +38,10 @@ void anax_string(short val1,short val2); void give_help(short help1,short help2,short parent_num); void put_spec_item_info (short which_i); void display_strings_event_filter (short item_hit); -void display_strings(char *text1, char *text2,short str_label_1,short str_label_2,short str_label_1b, +void display_strings(char const *text1, char const *text2,short str_label_1,short str_label_2,short str_label_1b, short str_label_2b, - char *title,short sound_num,short graphic_num,short parent_num); -void give_error(char *text1, char *text2,short parent_num); + char const *title,short sound_num,short graphic_num,short parent_num); +void give_error(char const *text1, char const *text2,short parent_num); void display_strings_with_nums(short a1,short a2, short b1, short b2, char *title,short sound_num,short graphic_num,short parent_num); diff --git a/Win32/game/boe.itemdata.cpp b/Win32/game/boe.itemdata.cpp index ceb2b3ed2..15626523b 100644 --- a/Win32/game/boe.itemdata.cpp +++ b/Win32/game/boe.itemdata.cpp @@ -89,7 +89,6 @@ item_record_type get_weapon(short loot) item_record_type get_armor(short loot) { - short r1; item_record_type armor; if (loot == 0) diff --git a/Win32/game/boe.text.cpp b/Win32/game/boe.text.cpp index b9f0e9073..2a99948eb 100644 --- a/Win32/game/boe.text.cpp +++ b/Win32/game/boe.text.cpp @@ -1185,13 +1185,13 @@ short print_terrain(location space) if (is_combat()) which_terrain = combat_terrain[space.x][space.y]; get_ter_name(store_string2,which_terrain); sprintf((char *) store_string, " %s", store_string2); - add_string_to_buf((char *) store_string); + add_string_to_buf( store_string); return (short) which_terrain; } -void add_string_to_buf(char *string) +void add_string_to_buf(char const *string) { if(strcmp(string,"") == 0) return; diff --git a/Win32/game/boe.text.h b/Win32/game/boe.text.h index 3a56cf213..139fbcdc2 100644 --- a/Win32/game/boe.text.h +++ b/Win32/game/boe.text.h @@ -1,6 +1,6 @@ #ifndef _TEXT_H #define _TEXT_H - + #include // RECT, HDC etc. #include "classes/location.h" // location #include "classes/pc.h" // pc_record_type @@ -42,7 +42,7 @@ void monst_damaged_mes(short which_m,short how_much,short how_much_spec); void monst_killed_mes(short which_m); void print_nums(short a,short b,short c); short print_terrain(location space); -void add_string_to_buf(char *string); +void add_string_to_buf(char const *string); void print_buf () ; void through_sending(); void Display_String(char *str); diff --git a/Win32/game/classes/location.h b/Win32/game/classes/location.h index f4224bc6d..4aeb6a43e 100644 --- a/Win32/game/classes/location.h +++ b/Win32/game/classes/location.h @@ -1,24 +1,24 @@ #ifndef _LOCATION_H #define _LOCATION_H - + struct location { - char x, y; - + unsigned char x, y; + /* functions */ location() : x(0), y(0) { } location(int ix, int iy) { x = ix; y = iy; } location toGlobal(); /* convert local coordinates to global*/ location toLocal(); /* convert global coordinates to local*/ location randomShift(); - + short countWalls() const; /* count number of walls around */ short handleLever(); /* call dialog and eventually pull lever */ void crumbleWall(); bool isDoor() const; - + void pickLock(short pcNum); void bashDoor(short pcNum); }; - + #endif diff --git a/Win32/game/tools/dlogtool.cpp b/Win32/game/tools/dlogtool.cpp index 41b675bd3..18dcbe9d8 100644 --- a/Win32/game/tools/dlogtool.cpp +++ b/Win32/game/tools/dlogtool.cpp @@ -968,7 +968,7 @@ void cd_get_text_edit_str(short, char *str) else str[0] = 0; } -void cd_set_item_text(short dlog_num, short item_num, char *str) +void cd_set_item_text(short dlog_num, short item_num, char const *str) { short k,dlg_index,item_index; if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) diff --git a/Win32/game/tools/dlogtool.h b/Win32/game/tools/dlogtool.h index f6b6e2a21..5d6fd564c 100644 --- a/Win32/game/tools/dlogtool.h +++ b/Win32/game/tools/dlogtool.h @@ -1,6 +1,6 @@ #ifndef _DLOGTOOL_H #define _DLOGTOOL_H - + #include "../globvar.h" //#include "boe.graphutil.h" @@ -20,7 +20,7 @@ short cd_process_keystroke(HWND window,WPARAM wparam, LPARAM lparam,short *item) void cd_attach_key(short dlog_num,short item_num,char key); void cd_set_pict(short dlog_num, short item_num, short pict_num); void cd_activate_item(short dlog_num, short item_num, short status); -void cd_set_item_text(short dlog_num, short item_num, char *str); +void cd_set_item_text(short dlog_num, short item_num, char const *str); void cd_set_item_num(short dlog_num, short item_num, short num); void cd_set_led(short dlog_num,short item_num,short state); void cd_text_frame(short dlog_num,short item_num,short frame); @@ -50,7 +50,7 @@ inline void cd_set_text_edit_str(short, char *str) { if (edit_box != NULL) SetWindowText(edit_box,str); } inline void cdsin(short dlog_num, short item_num, short num) { cd_set_item_num(dlog_num, item_num, num); } -inline void csit(short dlog_num, short item_num, char *str) +inline void csit(short dlog_num, short item_num, char const *str) { cd_set_item_text( dlog_num, item_num, str); } inline void csp(short dlog_num, short item_num, short pict_num) { cd_set_pict( dlog_num, item_num, pict_num); } From 9a8f37b8174c9693df9684b80711394ab78a6174 Mon Sep 17 00:00:00 2001 From: Sylae Corell Date: Wed, 30 Jul 2014 11:07:36 -0600 Subject: [PATCH 2/6] boe.actions.cpp is now mostly warning-free --- Win32/game/boe.actions.cpp | 2 -- Win32/game/boe.items.cpp | 2 +- Win32/game/boe.items.h | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Win32/game/boe.actions.cpp b/Win32/game/boe.actions.cpp index 7e5614dd9..7264de0fc 100644 --- a/Win32/game/boe.actions.cpp +++ b/Win32/game/boe.actions.cpp @@ -2954,12 +2954,10 @@ void set_up_lights() { short i, j, rad; location where, l; - short num_lights = 0; Boolean where_lit[64][64]; short max_dim[3] = {64, 48, 32}; // Town sizes from Scenario Editor blscened.cpp:82 // Find bonfires, braziers, etc. - num_lights = 0; for(i = 0; i < 64; i++) for(j = 0; j < 64; j++) where_lit[i][j] = 0; diff --git a/Win32/game/boe.items.cpp b/Win32/game/boe.items.cpp index 0921a75db..4fd5b9964 100644 --- a/Win32/game/boe.items.cpp +++ b/Win32/game/boe.items.cpp @@ -602,7 +602,7 @@ void select_pc_event_filter (short item_hit) else dialog_answer = item_hit - 3; } -short char_select_pc(short active_only,short free_inv_only,char *title) +short char_select_pc(short active_only,short free_inv_only,char const *title) //active_only; // 0 - no 1 - yes 2 - disarm trap { short i; diff --git a/Win32/game/boe.items.h b/Win32/game/boe.items.h index eab73b139..7f126ff3c 100644 --- a/Win32/game/boe.items.h +++ b/Win32/game/boe.items.h @@ -20,7 +20,7 @@ short display_item(location from_loc,short pc_num,short mode, bool check_contain void fancy_choice_dialog_event_filter (short item_hit); short fancy_choice_dialog(short which_dlog,short parent); void select_pc_event_filter (short item_hit); -short char_select_pc(short active_only,short free_inv_only,char *title); +short char_select_pc(short active_only,short free_inv_only,char const *title); short select_pc(short active_only,short free_inv_only); void get_num_of_items_event_filter (short item_hit); short get_num_of_items(short max_num); From 297eae6a944af7c00aa718bc2932c8b66947e6af Mon Sep 17 00:00:00 2001 From: Sylae Corell Date: Wed, 30 Jul 2014 11:55:31 -0600 Subject: [PATCH 3/6] our friend Deprecated conversion is no more :) --- Win32/game/boe.dlgutil.cpp | 6 +++--- Win32/game/boe.graphics.cpp | 13 +++--------- Win32/game/boe.graphutil.cpp | 4 ++-- Win32/game/boe.graphutil.h | 4 ++-- Win32/game/boe.infodlg.cpp | 10 ++++----- Win32/game/boe.infodlg.h | 2 +- Win32/game/boe.monster.cpp | 3 +-- Win32/game/boe.newgraph.cpp | 8 +++---- Win32/game/boe.newgraph.h | 6 +++--- Win32/game/boe.party.cpp | 12 +++++------ Win32/game/boe.text.cpp | 4 ++-- Win32/game/boe.text.h | 2 +- Win32/game/global.cpp | 2 +- Win32/game/global.h | 2 +- Win32/game/globvar.cpp | 18 ++++++++-------- Win32/game/globvar.h | 40 +++++++++++++++++------------------ Win32/game/tools/dlogtool.cpp | 2 +- Win32/game/tools/dlogtool.h | 2 +- 18 files changed, 64 insertions(+), 76 deletions(-) diff --git a/Win32/game/boe.dlgutil.cpp b/Win32/game/boe.dlgutil.cpp index bac890476..f2b96d827 100644 --- a/Win32/game/boe.dlgutil.cpp +++ b/Win32/game/boe.dlgutil.cpp @@ -90,7 +90,7 @@ void end_shop_mode() sprintf(one_back2,""); strnum1 = strnum2 = oldstrnum1 = oldstrnum2 = 0; - place_talk_str((char *)old_str1,"",0,dummy_rect); + place_talk_str(old_str1,"",0,dummy_rect); } else { DeleteObject(talk_gworld); @@ -1433,8 +1433,8 @@ void put_scen_info() { short i; char place_str[256]; - char *ratings[] = {"G","PG","R","NC-17"}; - char *difficulty[] = {"Low","Medium","High","Very High"}; + char const *ratings[] = {"G","PG","R","NC-17"}; + char const *difficulty[] = {"Low","Medium","High","Very High"}; for (i = 0; i < 3; i++) if(store_scen_page_on * 3 + i < store_num_scen){ diff --git a/Win32/game/boe.graphics.cpp b/Win32/game/boe.graphics.cpp index 488bcef0f..d091ea931 100644 --- a/Win32/game/boe.graphics.cpp +++ b/Win32/game/boe.graphics.cpp @@ -288,7 +288,7 @@ void draw_startup_anim() void draw_start_button(short which_position,short which_button) { RECT from_rect,to_rect; - char *button_labels[] = + char const *button_labels[] = { "Load Game", "Make New Party", @@ -734,7 +734,6 @@ void draw_buttons(short mode) //mode; // 0 - regular 1 - button action { RECT source_rect = {0,0,258,37}, dest_rec; /**/ - HBITMAP buttons_to_draw; Boolean spec_draw = false; if (mode == 1) { @@ -742,8 +741,6 @@ void draw_buttons(short mode) mode -= 100; } - buttons_to_draw = buttons_gworld; - source_rect = win_to_rects[1]; OffsetRect(&source_rect,-1 * source_rect.left, -1 * source_rect.top); if (is_combat()) { @@ -960,7 +957,7 @@ void draw_terrain(short mode) location sector_p_in,view_loc; char can_draw; unsigned char spec_terrain; - Boolean off_terrain = false,draw_trim = true; + Boolean draw_trim = true; short i,j,short_spec_terrain; if (mode == 2) { @@ -1020,7 +1017,6 @@ void draw_terrain(short mode) where_draw = (is_out()) ? party.p_loc : center; where_draw.x += q - 4; where_draw.y += r - 4; - off_terrain = false; draw_trim = true; if ((is_out() == false) && ((where_draw.x < 0) || (where_draw.x > town_size[town_type] - 1) @@ -1555,11 +1551,9 @@ void pre_boom_space(location where,short mode,short type,short damage,short soun // 3 - pole 4 - club 5 - fireball hit 6 - squish 7 - cold // 8 - acid 9 - claw 10 - bite 11 - slime 12 - zap 13 - missile hit { - short sound_key; short sound_to_play[20] = {97,69,70,71,72, 73,55,75,42,86, 87,88,89,98,0, 0,0,0,0,0}; - sound_key = type / 10; type = type % 10; if ((mode != 100) && (party_can_see(where) == 6)) @@ -1602,7 +1596,7 @@ void pre_boom_space(location where,short mode,short type,short damage,short soun /**/ RECT terrain_from; long dummy; - short del_len,sound_key; + short del_len; char dam_str[20]; short x_adj = 0,y_adj = 0,which_m; // RECT mixed_square = {353,169,381,205}; @@ -1610,7 +1604,6 @@ void pre_boom_space(location where,short mode,short type,short damage,short soun short sound_to_play[20] = {97,69,70,71,72, 73,55,75,42,86, 87,88,89,98,0, 0,0,0,0,0}; - sound_key = type / 10; type = type % 10; where_draw.x = where.x - center.x + 4; diff --git a/Win32/game/boe.graphutil.cpp b/Win32/game/boe.graphutil.cpp index 7799ae640..f5b3a8342 100644 --- a/Win32/game/boe.graphutil.cpp +++ b/Win32/game/boe.graphutil.cpp @@ -359,12 +359,12 @@ HBITMAP load_pict(short pict_num,HDC) /* GK */ -HBITMAP ReadBMP(char * fileName) +HBITMAP ReadBMP(char const * fileName) { return (HBITMAP) LoadImage(0, fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); } -HBITMAP ReadScenFile(char* filename){ //like ReadBMP but in the current scenario folder only. +HBITMAP ReadScenFile(char const* filename){ //like ReadBMP but in the current scenario folder only. short store_val; char str[256]= "scenarios/"; diff --git a/Win32/game/boe.graphutil.h b/Win32/game/boe.graphutil.h index b59f99ea1..a39624fef 100644 --- a/Win32/game/boe.graphutil.h +++ b/Win32/game/boe.graphutil.h @@ -41,7 +41,7 @@ HBITMAP load_pict(short pict_num,HDC); void paint_pattern(HBITMAP dest,short which_mode,RECT dest_rect,short which_pattern); /* GK */ -extern HBITMAP ReadBMP(char * fileName); -extern HBITMAP ReadScenFile(char* filename); +extern HBITMAP ReadBMP(char const * fileName); +extern HBITMAP ReadScenFile(char const* filename); #endif diff --git a/Win32/game/boe.infodlg.cpp b/Win32/game/boe.infodlg.cpp index 4d17a1faa..f3140543c 100644 --- a/Win32/game/boe.infodlg.cpp +++ b/Win32/game/boe.infodlg.cpp @@ -236,7 +236,7 @@ void put_item_info() char desc_str[256]; short i; item_record_type s_i; - char *item_types[] = {"","1-Handed weapon","2-Handed weapon","","Bow","Arrows","Thrown missile", + char const *item_types[] = {"","1-Handed weapon","2-Handed weapon","","Bow","Arrows","Thrown missile", "Potion/Magic Item","Scroll/Magic Item","Wand","Tool","","Shield","Armor","Helm", "Gloves","Shield","Boots","Ring","Necklace", "Weapon Poison","Gem, Stone, Etc.","Pants","Crossbow","Bolts","Missile Weapon"}; @@ -610,7 +610,7 @@ Boolean display_alchemy_event_filter (short item_hit) void display_alchemy() { short i; - char *alch_names[] = + char const *alch_names[] = { "Weak Curing Potion (1)", "Weak Healing Potion (1)", @@ -710,8 +710,8 @@ void pick_race_abil_event_filter(short item_hit) void pick_race_abil(pc_record_type *pc,short mode,short parent_num) //mode; // 0 - edit 1 - just display 2 - can't change race { - char *start_str1 = "Click on button by name for description."; - char *start_str2 = "Click on advantage button to add/remove."; + char const *start_str1 = "Click on button by name for description."; + char const *start_str2 = "Click on advantage button to add/remove."; store_trait_mode = mode; store_pc = pc; @@ -1249,7 +1249,7 @@ void give_error(char const *text1, char const *text2,short parent_num) } void display_strings_with_nums(short a1,short a2, short b1, short b2, - char *title,short sound_num,short graphic_num,short parent_num) + char const *title,short sound_num,short graphic_num,short parent_num) { char str1[256] = "", str2[256] = ""; diff --git a/Win32/game/boe.infodlg.h b/Win32/game/boe.infodlg.h index 43f88a533..f7d8277c2 100644 --- a/Win32/game/boe.infodlg.h +++ b/Win32/game/boe.infodlg.h @@ -43,6 +43,6 @@ void display_strings(char const *text1, char const *text2,short str_label_1,shor char const *title,short sound_num,short graphic_num,short parent_num); void give_error(char const *text1, char const *text2,short parent_num); void display_strings_with_nums(short a1,short a2, short b1, short b2, - char *title,short sound_num,short graphic_num,short parent_num); + char const *title,short sound_num,short graphic_num,short parent_num); #endif diff --git a/Win32/game/boe.monster.cpp b/Win32/game/boe.monster.cpp index 6fa74c48a..34910fbd3 100644 --- a/Win32/game/boe.monster.cpp +++ b/Win32/game/boe.monster.cpp @@ -1284,11 +1284,10 @@ Boolean summon_monster(unsigned char which,location where,short duration,short g // to put monster { location loc; - short which_m,spot; + short spot; if ((is_town()) || (monsters_going)) { // Ooooh ... mondo kludge. Need to find caster's attitude to give it to monst. - which_m = monst_there(where); loc = find_clear_spot(where,0); if (loc.x == 0) return false; diff --git a/Win32/game/boe.newgraph.cpp b/Win32/game/boe.newgraph.cpp index f16ff31fe..7bd54a1c2 100644 --- a/Win32/game/boe.newgraph.cpp +++ b/Win32/game/boe.newgraph.cpp @@ -110,7 +110,6 @@ void apply_light_mask() HDC hdc; HBITMAP store_bmp; - HBRUSH old_brush; if (PSD[SDF_NO_FRILLS] > 0) return; @@ -155,7 +154,6 @@ void apply_light_mask() hdc = CreateCompatibleDC(main_dc); SetBkMode(hdc,TRANSPARENT); store_bmp = (HBITMAP) SelectObject(hdc,terrain_screen_gworld); - old_brush = (HBRUSH) SelectObject(hdc,GetStockObject(BLACK_BRUSH)); for (i = 2; i < 11; i++) for (j = 2; j < 11; j++) { @@ -684,7 +682,7 @@ void draw_shop_graphics(short draw_mode,RECT clip_area_rect) short cur_cost,what_magic_shop,what_magic_shop_item; char cur_name[256]; char cur_info_str[256]; - char *cost_strs[] = + char const *cost_strs[] = { "Extremely Cheap", "Very Reasonable", "Pretty Average", @@ -871,7 +869,7 @@ void refresh_shopping() } } -void click_talk_rect(char *str_to_place,char *str_to_place2,RECT c_rect) +void click_talk_rect(char const *str_to_place,char const *str_to_place2,RECT c_rect) { long dum; @@ -988,7 +986,7 @@ void get_item_interesting_string(item_record_type item,char *message) } -void place_talk_str(char *str_to_place,char *str_to_place2,short color,RECT c_rect) +void place_talk_str(char const *str_to_place,char const *str_to_place2,short color,RECT c_rect) // color 0 - regular 1 - darker { RECT area_rect; diff --git a/Win32/game/boe.newgraph.h b/Win32/game/boe.newgraph.h index 7697cb697..fdf0b3927 100644 --- a/Win32/game/boe.newgraph.h +++ b/Win32/game/boe.newgraph.h @@ -1,6 +1,6 @@ #ifndef _NEWGRAPH_H #define _NEWGRAPH_H - + typedef struct { char word[15]; RECT word_rect; @@ -26,8 +26,8 @@ item_record_type store_mage_spells(short which_s) ; item_record_type store_priest_spells(short which_s); item_record_type store_alchemy(short which_s); void get_item_interesting_string(item_record_type item,char *message); -void click_talk_rect(char *str_to_place,char *str_to_place2,RECT c_rect); -void place_talk_str(char *str_to_place,char *str_to_place2,short color,RECT c_rect); +void click_talk_rect(char const *str_to_place,char const *str_to_place2,RECT c_rect); +void place_talk_str(char const *str_to_place,char const *str_to_place2,short color,RECT c_rect); short scan_for_response(char *str); void refresh_talking(); diff --git a/Win32/game/boe.party.cpp b/Win32/game/boe.party.cpp index d84429798..0786ccf79 100644 --- a/Win32/game/boe.party.cpp +++ b/Win32/game/boe.party.cpp @@ -2029,11 +2029,11 @@ void put_spell_list() void pick_spell_event_filter (short item_hit) { - char *choose_target = " Now pick a target."; - char *no_target = " No target needed."; - char *bad_target = " Can't cast on him/her."; - char *got_target = " Target selected."; - char *bad_spell = " Spell not available."; + char const *choose_target = " Now pick a target."; + char const *no_target = " No target needed."; + char const *bad_target = " Can't cast on him/her."; + char const *got_target = " Target selected."; + char const *bad_spell = " Spell not available."; Boolean spell_toast = false,dialog_done = false; switch (item_hit) { @@ -2423,12 +2423,10 @@ void alch_choice_event_filter (short item_hit) short alch_choice(short pc_num) { short difficulty[20] = {1,1,1,3,3, 4,5,5,7,9, 9,10,12,12,9, 14,19,10,16,20}; - short store_alchemy_pc; char get_text[256]; SetCursor(sword_curs); - store_alchemy_pc = pc_num; cd_create_dialog(1047,mainPtr); for (i = 0; i < 20; i++) { diff --git a/Win32/game/boe.text.cpp b/Win32/game/boe.text.cpp index 2a99948eb..4215c22b7 100644 --- a/Win32/game/boe.text.cpp +++ b/Win32/game/boe.text.cpp @@ -282,7 +282,7 @@ void put_item_screen(short screen_num,short suppress_buttons) break; case 7: // On jobs page SelectObject(hdc,bold_font); - win_draw_string(hdc,upper_frame_rect,"Your current jobs:",0,10); + win_draw_string(hdc,upper_frame_rect,(char *)"Your current jobs:",0,10); /* SelectObject(hdc,font); SetTextColor(hdc,colors[0]); win_draw_string(hdc,item_buttons[0][0],"Test",0,10);*/ @@ -1350,7 +1350,7 @@ short string_length(char *str,HDC hdc) } -void char_win_draw_string(HDC dest_window,RECT dest_rect,char *str,short mode,short line_height) +void char_win_draw_string(HDC dest_window,RECT dest_rect,char const *str,short mode,short line_height) { char store_s[256]; diff --git a/Win32/game/boe.text.h b/Win32/game/boe.text.h index 139fbcdc2..b3405a562 100644 --- a/Win32/game/boe.text.h +++ b/Win32/game/boe.text.h @@ -50,7 +50,7 @@ RECT coord_to_rect(short i,short j); void c2p(char *str) ; void p2c(char *str); short string_length(char *str,HDC hdc); -void char_win_draw_string(HDC dest_window,RECT dest_rect,char *str,short mode,short line_height); +void char_win_draw_string(HDC dest_window,RECT dest_rect,char const *str,short mode,short line_height); void win_draw_string(HDC dest_window,RECT dest_rect,char *str,short mode,short line_height); short calc_day(); Boolean day_reached(unsigned char which_day, unsigned char which_event); diff --git a/Win32/game/global.cpp b/Win32/game/global.cpp index 9c2467ba6..45cb7f313 100644 --- a/Win32/game/global.cpp +++ b/Win32/game/global.cpp @@ -41,7 +41,7 @@ POINT MAKEPOINT(LONG lParam) return point; } -void DebugQuit(char * msg) +void DebugQuit(char const * msg) { MessageBox(0, msg, "DebugQuit", MB_OK); PostQuitMessage(EXIT_FAILURE); diff --git a/Win32/game/global.h b/Win32/game/global.h index c1980d304..8f5bf55c6 100644 --- a/Win32/game/global.h +++ b/Win32/game/global.h @@ -20,7 +20,7 @@ typedef unsigned char BYTE; POINT MAKEPOINT(LONG lparam); extern HINSTANCE store_hInstance; -void DebugQuit(char * msg); +void DebugQuit(char const * msg); struct RECT16 { diff --git a/Win32/game/globvar.cpp b/Win32/game/globvar.cpp index cc7b43ca3..4c31086f8 100644 --- a/Win32/game/globvar.cpp +++ b/Win32/game/globvar.cpp @@ -42,7 +42,7 @@ out_wandering_type store_wandering_special; short store_shop_type; short debug_ok = 0; short store_selling_values[8] = {0,0,0,0,0,0,0,0}; -char *dir_string[] = {"North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest"}; +char const *dir_string[] = {"North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest"}; char get_new_terrain(); item_record_type start_items[6] = { @@ -182,7 +182,7 @@ short monst_mage_cost[27] = {1,1,1,1,2, 2,2,2,2,4, 2,4,4,3,4, 4,4,5,5,5, 5,6,6,6 short monst_mage_area_effect[27] = {0,0,0,0,0, 0,0,0,1,0, 1,1,0,1,0, 0,0,0,1,0, 1,0,0,0,0, 0,0}; short monst_priest_cost[26] = {1,1,1,1,2, 2,2,4,2,3, 3,3,4,4,4, 5,5,5,10,6, 6,10,8,8,8, 8}; short monst_priest_area_effect[26] = {0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 1}; -char *d_string[] = +char const *d_string[] = { "North", "NorthEast", @@ -372,7 +372,7 @@ char store_store_name[256]; RECT bottom_help_rects[4] = {{6,356,250,368},{6,374,270,386},{6,386,250,398},{6,398,250,410}}; RECT shop_frame = {10,62,269,352}; RECT shop_done_rect = {212,388,275,411}; /**/ -char *heal_types[] = {"Heal Damage","Cure Poison","Cure Disease","Cure Paralysis", +char const *heal_types[] = {"Heal Damage","Cure Poison","Cure Disease","Cure Paralysis", "Uncurse Items","Cure Stoned Character","Raise Dead","Resurrection","Cure Dumbfounding"}; short heal_costs[9] = {50,30,80,100,250,500,1000,3000,100}; long cost_mult[7] = {5,7,10,13,16,20,25}; @@ -417,7 +417,7 @@ short button_type[150] = {1,1,4,5,1,1,0,0,1,1, 2,2,2,2,2,2,2,2,1,1, 1,1,1,1,1,1,1,1,0,0, 0,0,0,0,0,0,0,0,0,0}; -char *button_strs[150] = {"Done ","Ask"," "," ","Keep", "Cancel","+","-","Buy","Leave", +char const *button_strs[150] = {"Done ","Ask"," "," ","Keep", "Cancel","+","-","Buy","Leave", "Get","1","2","3","4","5","6","Cast"," "," ", " "," "," ","Buy","Sell","Other Spells","Buy x10"," "," ","Save", "Race","Train","Items","Spells","Heal Party","1","2","3","4","5", @@ -764,7 +764,7 @@ const char *mage_s_name[] = "Force Barrier", "Quickfire", "Death Arrows"}; -char *priest_s_name[] = {"Minor Bless","Minor Heal","Weaken Poison","Turn Undead","Location", +char const *priest_s_name[] = {"Minor Bless","Minor Heal","Weaken Poison","Turn Undead","Location", "Sanctuary","Symbiosis","Minor Manna","Ritual - Sanctify","Stumble", "Bless","Cure Poison","Curse","Light","Wound", "Summon Spirit","Move Mountains","Charm Foe","Disease","Awaken", @@ -778,7 +778,7 @@ char *priest_s_name[] = {"Minor Bless","Minor Heal","Weaken Poison","Turn Undead "Guardian","Mass Charm","Protective Circle","Pestilence", "Revive All","Ravage Spirit","Resurrect","Divine Thud", "Avatar","Wall of Blades","Word of Recall","Major Cleansing"}; -char *alch_names[] = {"Weak Curing Potion (1)","Weak Healing Potion (1)","Weak Poison (1)", +char const *alch_names[] = {"Weak Curing Potion (1)","Weak Healing Potion (1)","Weak Poison (1)", "Weak Speed Potion (3)","Medium Poison (3)", "Medium Heal Potion (4)","Strong Curing (5)","Medium Speed Potion (5)", "Graymold Salve (7)","Weak Energy Potion (9)", @@ -786,7 +786,7 @@ char *alch_names[] = {"Weak Curing Potion (1)","Weak Healing Potion (1)","Weak P "Resurrection Balm (9)","Medium Energy Ptn. (14)","Knowledge Brew (19)" , "Strong Strength (10)","Bliss (16)","Strong Energy Ptn. (20)" }; -char *alch_names_short[] = {"Weak Curing Potion","Weak Healing Potion","Weak Poison", +char const *alch_names_short[] = {"Weak Curing Potion","Weak Healing Potion","Weak Poison", "Weak Speed Potion","Medium Poison", "Medium Heal Potion","Strong Curing","Medium Speed Potion", "Graymold Salve","Weak Energy Potion", @@ -866,13 +866,13 @@ Boolean string_added = false; short store_text_x = 0, store_text_y = 0; short current_item_button[6] = {-1,-1,-1,-1,-1,-1}; short pc_button_state[6] = {-1,-1,-1,-1,-1,-1}; -char *m_mage_sp[] = {"Spark","Minor Haste","Strength","Flame Cloud","Flame", +char const *m_mage_sp[] = {"Spark","Minor Haste","Strength","Flame Cloud","Flame", "Minor Poison","Slow","Dumbfound","Stinking Cloud","Summon Beast", "Conflagration","Fireball","Weak Summoning","Web","Poison", "Ice Bolt","Slow Group","Major Haste","Firestorm","Summoning", "Shockstorm","Major Poison","Kill","Daemon","Major Blessing", "Major Summoning","Shockwave"}; -char *m_priest_sp[] = {"Minor Bless","Light Heal","Wrack","Stumble","Bless", +char const *m_priest_sp[] = {"Minor Bless","Light Heal","Wrack","Stumble","Bless", "Curse","Wound","Summon Spirit","Disease","Heal", "Holy Scourge","Smite","Curse All","Sticks to Snakes","Martyr's Shield", "Bless All","Major Heal","Flamestrike","Summon Host","Revive Self", diff --git a/Win32/game/globvar.h b/Win32/game/globvar.h index f65549018..73c000ab4 100644 --- a/Win32/game/globvar.h +++ b/Win32/game/globvar.h @@ -1,6 +1,6 @@ #ifndef _GLOBVAR_H #define _GLOBVAR_H - + #include #include "global.h" #include "boe.newgraph.h" @@ -37,7 +37,7 @@ extern short store_shop_type; extern short debug_ok; extern short store_selling_values[8]; -extern char *dir_string[8]; +extern char const *dir_string[8]; extern char get_new_terrain(); extern creature_start_type save_monster_type; @@ -177,7 +177,7 @@ extern short hit_chance[51]; extern short abil_range[40]; extern short abil_odds[40]; extern short s_cost[2][62] ; - + extern short mage_range[80]; extern short priest_range[62]; extern short monst_mage_spell[55]; @@ -187,7 +187,7 @@ extern short monst_mage_area_effect[27]; extern short monst_priest_cost[26]; extern short monst_priest_area_effect[26]; -extern char *d_string[8]; +extern char const *d_string[8]; extern short pc_marked_damage[6]; extern short monst_marked_damage[T_M]; @@ -209,7 +209,7 @@ extern effect_pat_type single; extern effect_pat_type t; extern effect_pat_type small_square; extern effect_pat_type square; - + extern effect_pat_type open_square; extern effect_pat_type radius2; extern effect_pat_type radius3; @@ -228,7 +228,7 @@ extern Boolean talk_end_forced; extern char old_str1[256]; extern char old_str2[256]; extern char one_back1[256]; -extern char one_back2[256]; +extern char one_back2[256]; extern RECT talk_area_rect, word_place_rect,talk_help_rect; /**/ extern char title_string[50]; @@ -246,12 +246,12 @@ extern RECT bottom_help_rects[4]; extern RECT shop_frame; extern RECT shop_done_rect; /**/ -extern char *heal_types[9]; +extern char const *heal_types[9]; extern short heal_costs[9]; extern long cost_mult[7]; extern short cur_display_mode; -extern short terrain_pic[256]; +extern short terrain_pic[256]; extern short store_scen_page_on,store_num_scen; @@ -275,7 +275,7 @@ extern HWND store_parent; extern short available_dlog_buttons[NUM_DLOG_B]; extern short button_type[150]; -extern char *button_strs[150]; +extern char const *button_strs[150]; extern short button_left_adj[150]; extern char button_def_key[150]; @@ -337,7 +337,7 @@ extern HBITMAP startup_button_orig,startup_button_g,anim_mess ; extern Boolean done_fancy_startup_once ; -extern short terrain_there[9][9]; +extern short terrain_there[9][9]; extern RECT win_from_rects[6]; extern RECT win_to_rects[6]; @@ -472,7 +472,7 @@ extern location light_locs[40]; extern short num_lights; extern char d_s[60]; -extern short charm_odds[20]; +extern short charm_odds[20]; extern creature_start_type null_start_type; @@ -487,10 +487,10 @@ extern short skill_bonus[21]; extern short spell_level[62]; extern short spell_cost[2][62]; extern const char *mage_s_name[]; - -extern char *priest_s_name[]; -extern char *alch_names[]; -extern char *alch_names_short[]; + +extern char const *priest_s_name[]; +extern char const *alch_names[]; +extern char const *alch_names_short[]; extern short spell_w_cast[2][62]; // 0 - everywhere 1 - combat only 2 - town only 3 - town & outdoor only 4 - town & combat only 5 - outdoor only extern Boolean get_mage[30]; @@ -520,7 +520,7 @@ extern Boolean keep_change ; extern short store_skills[20],store_h,store_sp,i,store_skp,which_skill; extern long store_g; extern short store_train_mode,store_train_pc; - + extern HBITMAP pcs_gworld; // Dialog vars @@ -545,7 +545,7 @@ extern short boom_gr[8] ; extern short skill_max[20]; extern short abil_chart[200]; - + extern RECT startup_button[6]; extern short buf_pointer , lines_to_print, num_added_since_stop ; @@ -568,8 +568,8 @@ extern short store_text_x , store_text_y ; extern short current_item_button[6]; extern short pc_button_state[6]; -extern char *m_mage_sp[]; -extern char *m_priest_sp[]; +extern char const *m_mage_sp[]; +extern char const *m_priest_sp[]; // extra devices for maps extern HBRUSH hbrush[6]; @@ -585,7 +585,7 @@ extern HBITMAP map_bitmap[25]; extern unsigned char map_pats[256];// 250 extern unsigned char anim_map_pats[18]; - + extern location town_map_adj ; extern short town_force,store_min,store_max,store_shop; extern location town_force_loc; diff --git a/Win32/game/tools/dlogtool.cpp b/Win32/game/tools/dlogtool.cpp index 18dcbe9d8..d99aee28b 100644 --- a/Win32/game/tools/dlogtool.cpp +++ b/Win32/game/tools/dlogtool.cpp @@ -1067,7 +1067,7 @@ void cd_text_frame(short dlog_num,short item_num,short frame) cd_draw_item(dlog_num,item_num); } -void cd_add_label(short dlog_num, short item_num, char *label, short label_flag) +void cd_add_label(short dlog_num, short item_num, char const *label, short label_flag) { short dlg_index,item_index,label_loc = -1; short i; diff --git a/Win32/game/tools/dlogtool.h b/Win32/game/tools/dlogtool.h index 5d6fd564c..e60966222 100644 --- a/Win32/game/tools/dlogtool.h +++ b/Win32/game/tools/dlogtool.h @@ -24,7 +24,7 @@ void cd_set_item_text(short dlog_num, short item_num, char const *str); void cd_set_item_num(short dlog_num, short item_num, short num); void cd_set_led(short dlog_num,short item_num,short state); void cd_text_frame(short dlog_num,short item_num,short frame); -void cd_add_label(short dlog_num, short item_num, char *label, short label_flag); +void cd_add_label(short dlog_num, short item_num, char const *label, short label_flag); void cd_key_label(short dlog_num, short item_num,short loc); void cd_draw_item(short dlog_num,short item_num); void cd_initial_draw(short dlog_num); From f839ef7d7aac6f6931b26b2dffa55105eb6ccf1e Mon Sep 17 00:00:00 2001 From: Sylae Corell Date: Wed, 30 Jul 2014 11:58:42 -0600 Subject: [PATCH 4/6] Making sure we don't pass a negative key to an array --- Win32/game/global.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Win32/game/global.h b/Win32/game/global.h index 8f5bf55c6..415ea4df6 100644 --- a/Win32/game/global.h +++ b/Win32/game/global.h @@ -102,13 +102,13 @@ struct out_wandering_type struct outdoor_record_type { unsigned char terrain[48][48]; - location special_locs[18]; - unsigned char special_id[18]; - location exit_locs[8]; - char exit_dests[8]; - location sign_locs[8]; + location special_locs[18]; + unsigned char special_id[18]; + location exit_locs[8]; + unsigned char exit_dests[8]; + location sign_locs[8]; out_wandering_type wandering[4],special_enc[4]; - location wandering_locs[4]; + location wandering_locs[4]; RECT16 info_rect[8]; unsigned char strlens[180]; special_node_type specials[60]; @@ -124,7 +124,7 @@ typedef struct { unsigned char time_flag; unsigned char extra1,extra2; short spec1, spec2; - char spec_enc_code, time_code; + unsigned char spec_enc_code, time_code; short monster_time,personality; short special_on_kill,facial_pic; } creature_start_type; From 728395caa7bb88994c0b210e458c69aefbcdfd73 Mon Sep 17 00:00:00 2001 From: Sylae Corell Date: Wed, 30 Jul 2014 12:08:10 -0600 Subject: [PATCH 5/6] removing unused variables --- Win32/game/boe.main.cpp | 3 +-- Win32/game/boe.monster.cpp | 17 +++++++---------- Win32/game/boe.party.cpp | 3 +-- Win32/game/boe.specials.cpp | 11 +++++------ Win32/game/boe.text.cpp | 4 ---- Win32/game/boe.town.cpp | 7 ++----- Win32/game/classes/pc.cpp | 3 +-- 7 files changed, 17 insertions(+), 31 deletions(-) diff --git a/Win32/game/boe.main.cpp b/Win32/game/boe.main.cpp index 24cb21f58..2bc65a972 100644 --- a/Win32/game/boe.main.cpp +++ b/Win32/game/boe.main.cpp @@ -308,7 +308,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmd LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - HDC hdc; PAINTSTRUCT ps; POINT press; HMENU menu; @@ -455,7 +454,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if ((block_erase == true) && (hwnd == mainPtr)) { block_erase = false; } - hdc = BeginPaint(hwnd,&ps); + BeginPaint(hwnd,&ps); EndPaint(hwnd,&ps); if (hwnd != mainPtr) diff --git a/Win32/game/boe.monster.cpp b/Win32/game/boe.monster.cpp index 34910fbd3..4e9534622 100644 --- a/Win32/game/boe.monster.cpp +++ b/Win32/game/boe.monster.cpp @@ -236,7 +236,6 @@ void do_monsters() { short i,j,r1,target; location l1,l2; - Boolean acted_yet = false; if (overall_mode == MODE_TOWN) for (i = 0; i < T_M; i++) @@ -260,14 +259,13 @@ void do_monsters() if ((c_town.monst.dudes[i].active == 2) || ((c_town.monst.dudes[i].active != 0) && (c_town.monst.dudes[i].attitude % 2 != 1))) { - acted_yet = false; if (((c_town.monst.dudes[i].attitude == 0) || (monst_target[i] == 6)) && (c_town.hostile == 0)) { if (c_town.monst.dudes[i].mobile == true) { // OK, it doesn't see the party or // isn't nasty, and the town isn't totally hostile. if ((c_town.monst.dudes[i].attitude % 2 != 1) || (get_ran(1,0,1) == 0)) { - acted_yet = rand_move(i); + rand_move(i); } - else acted_yet = seek_party(i,c_town.monst.dudes[i].m_loc,c_town.p_loc); + else seek_party(i,c_town.monst.dudes[i].m_loc,c_town.p_loc); } } if ((c_town.monst.dudes[i].attitude > 0) || (c_town.hostile == 1)) { @@ -277,15 +275,15 @@ void do_monsters() if ((c_town.monst.dudes[i].m_d.morale < 0) && (c_town.monst.dudes[i].m_d.spec_skill != MONSTER_MINDLESS) && (c_town.monst.dudes[i].m_d.m_type != MONSTER_TYPE_UNDEAD)) { - acted_yet = flee_party(i,l1,l2); + flee_party(i,l1,l2); if (get_ran(1,0,10) < 6) c_town.monst.dudes[i].m_d.morale++; } else if (monst_hate_spot(i,&l2) == true) - acted_yet = seek_party(i,l1,l2); + seek_party(i,l1,l2); else if (((c_town.monst.dudes[i].m_d.mu == 0) && (c_town.monst.dudes[i].m_d.mu == 0)) || (can_see(l1,l2,0) > 3)) - acted_yet = seek_party(i,l1,l2); + seek_party(i,l1,l2); } } } @@ -317,14 +315,13 @@ void do_monsters() if (overall_mode == MODE_OUTDOORS) { for (i = 0; i < 10; i++) if (party.out_c[i].exists == true) { - acted_yet = false; l1 = party.out_c[i].m_loc; l2 = party.p_loc; r1 = get_ran(1,1,6); if (r1 == 3) - acted_yet = rand_move(i); - else acted_yet = seek_party(i,l1,l2); + rand_move(i); + else seek_party(i,l1,l2); } } } diff --git a/Win32/game/boe.party.cpp b/Win32/game/boe.party.cpp index 0786ccf79..437581bdc 100644 --- a/Win32/game/boe.party.cpp +++ b/Win32/game/boe.party.cpp @@ -1574,7 +1574,7 @@ void do_priest_spell(short pc_num,short spell_num) //priest spells : 100 + spell number void cast_town_spell(location where) { - short adjust,r1,targ,store; + short adjust,r1,targ; location loc; unsigned char ter; @@ -1697,7 +1697,6 @@ void cast_town_spell(location where) update_explored(c_town.p_loc); } else { - store = get_ran(1,0,1); play_sound(41); add_string_to_buf(" Didn't work. "); } diff --git a/Win32/game/boe.specials.cpp b/Win32/game/boe.specials.cpp index 977dd2ac2..59f57de78 100644 --- a/Win32/game/boe.specials.cpp +++ b/Win32/game/boe.specials.cpp @@ -93,7 +93,7 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho //short mode; // 0 - out 1 - town 2 - combat { unsigned char ter; - short r1,i,choice,door_pc,ter_special,ter_flag1,ter_flag2,dam_type = 0,pic_type = 0,ter_pic = 0; + short r1,i,choice,door_pc,ter_special,ter_flag1,ter_flag2,dam_type = 0,ter_pic = 0; Boolean can_enter = true; location out_where,from_loc,to_loc; short s1 = 0,s2 = 0,s3 = 0; @@ -253,7 +253,7 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho break; if (ter_special == TER_SPEC_DOES_FIRE_DAMAGE) { add_string_to_buf(" It's hot!"); - dam_type = DAMAGE_FIRE; pic_type = 0; + dam_type = DAMAGE_FIRE; if (party.stuff_done[SDF_LAVAWALK] > 0) { add_string_to_buf(" It doesn't affect you."); break; @@ -261,11 +261,11 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho } if (ter_special == TER_SPEC_DOES_COLD_DAMAGE) { add_string_to_buf(" You feel cold!"); - dam_type = DAMAGE_COLD; pic_type = 4; + dam_type = DAMAGE_COLD; } if (ter_special == TER_SPEC_DOES_MAGIC_DAMAGE) { add_string_to_buf(" Something shocks you!"); - dam_type = DAMAGE_MAGIC; pic_type = 1; + dam_type = DAMAGE_MAGIC; } r1 = get_ran(ter_flag2,dam_type,ter_flag1); if (mode < 2) @@ -449,7 +449,7 @@ void check_fields(location where_check,short mode,short which_pc) void use_item(short pc,short item) { Boolean take_charge = true,inept_ok = false; - short abil,level,i,j,item_use_code,str,type,which_stat,r1; + short abil,i,j,item_use_code,str,type,which_stat,r1; char to_draw[60]; location user_loc; //creature_data_type *which_m; @@ -463,7 +463,6 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}}}; abil = adven[pc].items[item].ability; - level = adven[pc].items[item].item_level; item_use_code = abil_chart[abil]; if (item_use_code >= 10) { diff --git a/Win32/game/boe.text.cpp b/Win32/game/boe.text.cpp index 4215c22b7..e7de9a729 100644 --- a/Win32/game/boe.text.cpp +++ b/Win32/game/boe.text.cpp @@ -41,12 +41,10 @@ void put_pc_screen() HDC hdc; COLORREF colors[6] = {RGB(0,0,0),RGB(255,0,0),RGB(128,0,0),RGB(0,160,0),RGB(0,0,255),RGB(255,255,255)}; HBITMAP store_bmp; - Boolean right_buttons_same = true; for (i = 0; i < 6; i++) if (((adven[i].main_status != MAIN_STATUS_ABSENT) && (pc_button_state[i] != 1)) || ((adven[i].main_status == MAIN_STATUS_ABSENT) && (pc_button_state[i] != 0))) - right_buttons_same = false; // First refresh gworld with the pc info //rect_draw_some_item (orig_pc_info_screen_gworld, erase_rect, pc_info_screen_gworld, erase_rect, 0, 0); @@ -1217,7 +1215,6 @@ void print_buf () short num_lines_printed = 0,ctrl_val; short line_to_print; short start_print_point; - Boolean end_loop = false; RECT store_text_rect = {0,0,256,138},dest_rect,erase_rect = {1,1,255,137}; /**/ RECT from_rect,to_rect; HDC hdc; @@ -1265,7 +1262,6 @@ void print_buf () } if ((num_lines_printed == LINES_IN_TEXT_WIN - 1) && (printing_long == true)) { - end_loop = false; line_to_print= buf_pointer; } diff --git a/Win32/game/boe.town.cpp b/Win32/game/boe.town.cpp index ecb1b7459..4c17ec1ff 100644 --- a/Win32/game/boe.town.cpp +++ b/Win32/game/boe.town.cpp @@ -34,7 +34,7 @@ void start_town_mode(short which_town, short entry_dir) char message[60]; short j,k,town_number; - short at_which_save_slot,former_town; + short former_town; location loc; unsigned char temp; Boolean monsters_loaded = false, town_toast = false; @@ -110,8 +110,6 @@ void start_town_mode(short which_town, short entry_dir) c_town.monst.which_town = town_number; c_town.monst.friendly = 0; - at_which_save_slot = party.at_which_save_slot; - for (i = 0; i < 4; i++) if (town_number == party.creature_save[i].which_town) { c_town.monst = party.creature_save[i]; @@ -1022,7 +1020,7 @@ void erase_specials() void erase_out_specials() { - short i,j,k,l,m,out_num; + short i,j,k,l,m; special_node_type sn; short sd1,sd2; @@ -1062,7 +1060,6 @@ void erase_out_specials() for (k = 0; k < 18; k++) //GK if (outdoors[i][j].special_id[k] >= 0) { - out_num = scenario.out_width * (party.outdoor_corner.y + j) + party.outdoor_corner.x + i; sn = outdoors[i][j].specials[outdoors[i][j].special_id[k]]; sd1 = sn.sd1; sd2 = sn.sd2; diff --git a/Win32/game/classes/pc.cpp b/Win32/game/classes/pc.cpp index f19ea18c9..08ff71241 100644 --- a/Win32/game/classes/pc.cpp +++ b/Win32/game/classes/pc.cpp @@ -17,7 +17,7 @@ void pc_record_type::kill(short type) { short i = 24; - bool dummy, no_save = false, no_luck = false; + bool no_save = false, no_luck = false; location item_loc; if (type >= 20) @@ -62,7 +62,6 @@ void pc_record_type::kill(short type) if (overall_mode != MODE_OUTDOORS) for (i = 0; i < 24; i++) if (items[i].variety != ITEM_TYPE_NO_ITEM) { - dummy = place_item(items[i],item_loc,true); items[i].variety = ITEM_TYPE_NO_ITEM; } if ((type == 2) || (type == 3)) From bfdcc2368d4088bf8d0f5579f466d185bec341a3 Mon Sep 17 00:00:00 2001 From: Sylae Corell Date: Wed, 30 Jul 2014 12:12:27 -0600 Subject: [PATCH 6/6] Cleaning up this set of conditionals --- Win32/game/boe.monster.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Win32/game/boe.monster.cpp b/Win32/game/boe.monster.cpp index 4e9534622..5b885b3a9 100644 --- a/Win32/game/boe.monster.cpp +++ b/Win32/game/boe.monster.cpp @@ -334,15 +334,15 @@ Boolean monst_hate_spot(short which_m,location *good_loc) if ((misc_i[loc.x][loc.y] & 224) || (c_town.explored[loc.x][loc.y] & 64) // hate regular fields || ((c_town.explored[loc.x][loc.y] & 32) && (c_town.monst.dudes[which_m].m_d.radiate_1 != MONSTER_RADIATE_ICE_FIELDS) - && (c_town.monst.dudes[which_m].m_d.immunities & 32 == 0)) // hate ice wall? + && (c_town.monst.dudes[which_m].m_d.immunities & (32 == 0))) // hate ice wall? || ((c_town.explored[loc.x][loc.y] & 4) && (c_town.monst.dudes[which_m].m_d.radiate_1 != MONSTER_RADIATE_FIRE_FIELDS) - && (c_town.monst.dudes[which_m].m_d.immunities & 8 == 0)) // hate fire wall? + && (c_town.monst.dudes[which_m].m_d.immunities & (8 == 0))) // hate fire wall? || ((c_town.explored[loc.x][loc.y] & 16) && (c_town.monst.dudes[which_m].m_d.radiate_1 != MONSTER_RADIATE_STINKING_CLOUDS) - && (c_town.monst.dudes[which_m].m_d.immunities & 3 == 0)) // hate stink cloud? + && (c_town.monst.dudes[which_m].m_d.immunities & (3 == 0))) // hate stink cloud? || ((c_town.explored[loc.x][loc.y] & 128) && (c_town.monst.dudes[which_m].m_d.radiate_1 != MONSTER_RADIATE_SLEEP_FIELDS) - && (c_town.monst.dudes[which_m].m_d.immunities & 3 == 0)) // hate sleep cloud? + && (c_town.monst.dudes[which_m].m_d.immunities & (3 == 0))) // hate sleep cloud? || ((c_town.explored[loc.x][loc.y] & 2) && (c_town.monst.dudes[which_m].m_d.radiate_1 != MONSTER_RADIATE_SHOCK_FIELDS) - && (c_town.monst.dudes[which_m].m_d.immunities & 3 == 0)) // hate shock cloud? + && (c_town.monst.dudes[which_m].m_d.immunities & (3 == 0))) // hate shock cloud? || (((c_town.monst.dudes[which_m].m_d.mu > 0) || (c_town.monst.dudes[which_m].m_d.cl > 0)) && (c_town.explored[loc.x][loc.y] & 8))) // hate antimagic? {