From 43e4bcc048dcc28550388880ecc764dcd83da317 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sun, 11 Jan 2015 16:43:23 -0500 Subject: [PATCH] Fix several more warnings - As a side-effect, weapons with key skills other than the conventional three (edged, bashing, pole) are now fully supported (though the scenario editor UI doesn't yet support them) --- src/boe.actions.cpp | 1 - src/boe.combat.cpp | 6 ++++ src/boe.items.cpp | 2 +- src/boe.menus.mac.mm | 1 + src/boe.party.cpp | 3 +- src/boe.text.cpp | 2 +- src/classes/special.cpp | 2 ++ src/dialogxml/dialog.cpp | 2 +- src/dialogxml/field.cpp | 1 + src/dialogxml/stack.cpp | 2 +- src/pcedit/pc.editors.cpp | 11 +------- src/scenedit/scen.actions.cpp | 1 - src/scenedit/scen.core.cpp | 2 +- src/scenedit/scen.keydlgs.h | 1 + src/tools/graphtool.cpp | 1 - src/tools/porting.cpp | 52 ----------------------------------- src/tools/specials_parse.cpp | 4 +-- 17 files changed, 20 insertions(+), 74 deletions(-) diff --git a/src/boe.actions.cpp b/src/boe.actions.cpp index 44eb16b2..52896236 100644 --- a/src/boe.actions.cpp +++ b/src/boe.actions.cpp @@ -1423,7 +1423,6 @@ void handle_monster_actions(bool& need_redraw, bool& need_reprint) { need_redraw = false; } //pause(2); - short store_cur_pc = current_pc; if(combat_next_step()) need_redraw = true; } diff --git a/src/boe.combat.cpp b/src/boe.combat.cpp index d2bd72a7..9362a853 100644 --- a/src/boe.combat.cpp +++ b/src/boe.combat.cpp @@ -650,6 +650,9 @@ void pc_attack(short who_att,short target) { case eSkill::POLE_WEAPONS: damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,3); break; + default: // TODO: Not sure what sound to play for unconventional weapons, but let's just go with the generic "ouch" for now + damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON, 0); + break; } // poison if(univ.party[who_att].status[eStatus::POISONED_WEAPON] > 0 && univ.party[who_att].weap_poisoned == weap1) { @@ -716,6 +719,9 @@ void pc_attack(short who_att,short target) { case eSkill::POLE_WEAPONS: damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,3); break; + default: // TODO: Not sure what sound to play for unconventional weapons, but let's just go with the generic "ouch" for now + damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON, 0); + break; } if((univ.party[who_att].items[weap2].ability == eItemAbil::POISONED_WEAPON) && (get_ran(1,0,1) == 1)) { diff --git a/src/boe.items.cpp b/src/boe.items.cpp index 1c13544a..39ade4f4 100644 --- a/src/boe.items.cpp +++ b/src/boe.items.cpp @@ -1013,7 +1013,7 @@ bool pc_gworld_loaded = false; // Returns true is a theft committed //pc_num; // < 6 - this pc only 6 - any pc //short mode; // 0 - adjacent 1 - all in sight -bool display_item(location from_loc,short pc_num,short mode, bool check_container) { +bool display_item(location from_loc,short /*pc_num*/,short mode, bool check_container) { // short item_array[130]; std::vector item_array; short i; diff --git a/src/boe.menus.mac.mm b/src/boe.menus.mac.mm index ae0045d0..9192b49a 100644 --- a/src/boe.menus.mac.mm +++ b/src/boe.menus.mac.mm @@ -284,6 +284,7 @@ void menu_activate() { @implementation MenuHandler -(void) monstMenu:(id) sender { cMonster* monst = [[sender representedObject] monst]; + (void) monst; // Mark variable as unused handle_monster_info_menu([monster_info_menu indexOfItem: sender] - 1); } diff --git a/src/boe.party.cpp b/src/boe.party.cpp index d58ed63a..5590cb67 100644 --- a/src/boe.party.cpp +++ b/src/boe.party.cpp @@ -113,7 +113,7 @@ short store_pc_graphic; // Until that time, the party scen vals are uninited // Then, it inits the party properly for starting the scenario based // on the loaded scenario -void init_party_scen_data() { +static void init_party_scen_data() { short i,j,k,l; bool stored_item = false; short store_help; @@ -1470,7 +1470,6 @@ void cast_town_spell(location where) { } adjust = can_see_light(univ.town.p_loc,where,sight_obscurity); - eSkill spell_type = (*town_spell).type; if(!spell_freebie) univ.party[who_cast].cur_sp -= (*town_spell).cost; ter = univ.town->terrain(where.x,where.y); diff --git a/src/boe.text.cpp b/src/boe.text.cpp index 241d77a8..e48f55d5 100644 --- a/src/boe.text.cpp +++ b/src/boe.text.cpp @@ -586,7 +586,7 @@ short total_encumberance(short pc_num) { return store; } -rectangle get_stat_effect_rect(eStatus which_effect) { +static rectangle get_stat_effect_rect(eStatus which_effect) { int code = (int) which_effect; rectangle base = {0,0,12,12}; base.offset(12 * (code % 3), 12 * (code / 3)); diff --git a/src/classes/special.cpp b/src/classes/special.cpp index a88a6195..4a79ce66 100644 --- a/src/classes/special.cpp +++ b/src/classes/special.cpp @@ -427,6 +427,8 @@ static std::string get_node_string(std::string base, eSpecType type, int which) return get_str(base + "-rect", strnum); case eSpecCat::OUTDOOR: return get_str(base + "-outdoor", strnum); + case eSpecCat::INVALID: + return "error"; } return ""; } diff --git a/src/dialogxml/dialog.cpp b/src/dialogxml/dialog.cpp index 98edbbc5..d4ba2224 100644 --- a/src/dialogxml/dialog.cpp +++ b/src/dialogxml/dialog.cpp @@ -175,7 +175,7 @@ template<> pair cDialog::parse(Element& who /*pict*/){ return p; } -string dlogStringFilter(string toFilter) { +static string dlogStringFilter(string toFilter) { string filtered; bool found_nl = false; for(char c : toFilter) { diff --git a/src/dialogxml/field.cpp b/src/dialogxml/field.cpp index 9ea64427..2b20d3d2 100644 --- a/src/dialogxml/field.cpp +++ b/src/dialogxml/field.cpp @@ -357,6 +357,7 @@ void cTextField::handleInput(cKey key) { contents.insert(contents.begin() + insertionPoint, char(key.c)); selectionPoint = ++insertionPoint; } else switch(key.k) { + case key_enter: break; // Shouldn't be receiving this anyway // TODO: Implement all the other special keys case key_left: case key_word_left: if(haveSelection && !select) { diff --git a/src/dialogxml/stack.cpp b/src/dialogxml/stack.cpp index 23aae675..83aaef65 100644 --- a/src/dialogxml/stack.cpp +++ b/src/dialogxml/stack.cpp @@ -13,7 +13,7 @@ void cStack::attachClickHandler(click_callback_t f) throw(xHandlerNotSupported) onClick = f; } -void cStack::attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported) { +void cStack::attachFocusHandler(focus_callback_t) throw(xHandlerNotSupported) { throw xHandlerNotSupported(true); } diff --git a/src/pcedit/pc.editors.cpp b/src/pcedit/pc.editors.cpp index d6cb87bb..be548081 100644 --- a/src/pcedit/pc.editors.cpp +++ b/src/pcedit/pc.editors.cpp @@ -147,15 +147,6 @@ short select_pc(short active_only,short free_inv_only) { else return char_select_pc(active_only,free_inv_only,"Select a character:"); } -static short party_total_level() { - short i,j = 0; - - for(i = 0; i < 6; i++) - if(univ.party[i].main_status == eMainStatus::ALIVE) - j += univ.party[i].level; - return j; -} - static void put_pc_spells(cDialog& me, const short store_trait_mode) { short i; @@ -243,7 +234,7 @@ static void display_traits_graphics(cDialog& me) { me["xp"].setTextToNum(store); } -static bool pick_race_select_led(cDialog& me, std::string item_hit, bool losing, const short store_trait_mode) { +static bool pick_race_select_led(cDialog& me, std::string item_hit, bool, const short store_trait_mode) { int abil_str = 0; cPlayer *pc; diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index 049b6e28..b290cc4b 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -432,7 +432,6 @@ bool handle_action(location the_point,sf::Event /*event*/) { i = (the_point.x - TER_RECT_UL_X - 8) / scale; j = (the_point.y - TER_RECT_UL_Y - 8) / scale; if(scale > 4) { - short dim = editing_town ? town->max_dim() : 48; if(cen_x + 5 > 256 / scale) spot_hit.x = cen_x + 5 - 256/scale + i; else spot_hit.x = i; diff --git a/src/scenedit/scen.core.cpp b/src/scenedit/scen.core.cpp index 98f2bd0e..075c1f6c 100644 --- a/src/scenedit/scen.core.cpp +++ b/src/scenedit/scen.core.cpp @@ -132,7 +132,7 @@ bool check_range(cDialog& me,std::string id,bool losing,long min_val,long max_va } // TODO: I have two functions that do this. (The other one is choose_graphic.) -bool pick_picture(ePicType type, cDialog& parent, std::string result_fld, std::string pic_fld, pic_num_t modifier){ +static bool pick_picture(ePicType type, cDialog& parent, std::string result_fld, std::string pic_fld, pic_num_t modifier){ pic_num_t cur_sel = 0; if(result_fld != ""){ cControl& fld_ctrl = parent[result_fld]; diff --git a/src/scenedit/scen.keydlgs.h b/src/scenedit/scen.keydlgs.h index b5d25e63..27cbf0e8 100644 --- a/src/scenedit/scen.keydlgs.h +++ b/src/scenedit/scen.keydlgs.h @@ -30,4 +30,5 @@ void edit_scen_intro(); bool edit_area_rect_str(short which_str,short mode); void make_cursor_sword() ; void edit_dialog_text(short mode,short *str1,cDialog* parent); +size_t num_strs(short str_mode); diff --git a/src/tools/graphtool.cpp b/src/tools/graphtool.cpp index d4f1173c..1314236e 100644 --- a/src/tools/graphtool.cpp +++ b/src/tools/graphtool.cpp @@ -330,7 +330,6 @@ void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,std::stri if(mode == eTextMode::WRAP) { moveTo = location(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + adjust_y + 9); for(i = 0; text_len(i) != text_len(i + 1) && i < str_len;i++) { - int iLen = text_len(i), lineLen = text_len(last_line_break); if(((text_len(i) - text_len(last_line_break) > (dest_rect.width() - 6)) && (last_word_break >= last_line_break)) || (str[i] == '|')) { if(str[i] == '|') { diff --git a/src/tools/porting.cpp b/src/tools/porting.cpp index e1e49a7a..81fe7654 100644 --- a/src/tools/porting.cpp +++ b/src/tools/porting.cpp @@ -41,58 +41,6 @@ void port_town(legacy::town_record_type* dummy_town_ptr){ } -static void port_dummy_t_d(short size,char *buffer) { - short i; - legacy::big_tr_type *d1; - legacy::ave_tr_type *d2; - legacy::tiny_tr_type *d3; - - if(cur_scen_is_mac != mac_is_intel) - return; - - switch(size) { - case 0: - d1 = (legacy::big_tr_type *) buffer; - for(i =0 ; i < 16; i++) - flip_rect(&d1->room_rect[i]); - for(i =0 ; i < 60; i++) { - flip_short(&d1->creatures[i].spec1); - flip_short(&d1->creatures[i].spec2); - flip_short(&d1->creatures[i].monster_time); - flip_short(&d1->creatures[i].personality); - flip_short(&d1->creatures[i].special_on_kill); - flip_short(&d1->creatures[i].facial_pic); - } - break; - case 1: - d2 = (legacy::ave_tr_type *) buffer; - for(i =0 ; i < 16; i++) - flip_rect(&d2->room_rect[i]); - for(i =0 ; i < 40; i++) { - flip_short(&d2->creatures[i].spec1); - flip_short(&d2->creatures[i].spec2); - flip_short(&d2->creatures[i].monster_time); - flip_short(&d2->creatures[i].personality); - flip_short(&d2->creatures[i].special_on_kill); - flip_short(&d2->creatures[i].facial_pic); - } - break; - case 2: - d3 = (legacy::tiny_tr_type *) buffer; - for(i =0 ; i < 16; i++) - flip_rect(&d3->room_rect[i]); - for(i =0 ; i < 30; i++) { - flip_short(&d3->creatures[i].spec1); - flip_short(&d3->creatures[i].spec2); - flip_short(&d3->creatures[i].monster_time); - flip_short(&d3->creatures[i].personality); - flip_short(&d3->creatures[i].special_on_kill); - flip_short(&d3->creatures[i].facial_pic); - } - break; - } -} - void port_talk_nodes(legacy::talking_record_type* dummy_talk_ptr) { short i; diff --git a/src/tools/specials_parse.cpp b/src/tools/specials_parse.cpp index 1293bf85..e0ba231f 100644 --- a/src/tools/specials_parse.cpp +++ b/src/tools/specials_parse.cpp @@ -82,11 +82,11 @@ SpecialParser::SpecialParser() { #undef _ -auto SpecialParser::on_error(const Rule::scanner_t& scan, spirit::parser_error error) -> ErrStatus { +auto SpecialParser::on_error(const Rule::scanner_t&, spirit::parser_error) -> ErrStatus { return ErrStatus(ErrStatus::fail); } -void init_specials_parse() { +static void init_specials_parse() { opcode.add((*eSpecType::NONE).opcode().c_str(), eSpecType::NONE); // Fill in all the opcodes and check for missing types. // There's really no need to check all the way to the max of the underlying type.