diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index 649022fa..ce9e06ea 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -977,7 +977,7 @@ bool handle_action(sf::Event event) { for(int i = 0; i < 7; i++) if(the_point.in(bottom_buttons[i])) { button_hit = i; - if (spell_forced == false) + if (!spell_forced) main_button_click(bottom_buttons[i]); } break; @@ -988,7 +988,7 @@ bool handle_action(sf::Event event) { for(int i = 0; i < 8; i++) if(the_point.in(town_buttons[i])) { button_hit = i; - if (spell_forced == false) + if (!spell_forced) main_button_click(town_buttons[i]); } break; @@ -1001,7 +1001,7 @@ bool handle_action(sf::Event event) { for(int i = 0; i < 9; i++) if(the_point.in(combat_buttons[i])) { button_hit = i; - if (spell_forced == false) + if (!spell_forced) main_button_click(combat_buttons[i]); } break; @@ -1263,7 +1263,7 @@ bool handle_action(sf::Event event) { give_pc_info(i); break; case 4: // trade places - if (prime_time() == false) + if (!prime_time()) add_string_to_buf("Trade places: Finish what you're doing first."); else if (is_combat()) add_string_to_buf("Trade places: Can't do this in combat."); @@ -2489,7 +2489,7 @@ void increase_age()//// dump_gold(1); special_increase_age(); - //if (debug_on == false) + //if (!debug_on) push_things(); if (is_town()) { @@ -2502,7 +2502,7 @@ void increase_age()//// current_switch = 6; // If a change, draw stat screen - if (update_stat == true) + if (update_stat) put_pc_screen(); adjust_spell_menus(); } @@ -2598,7 +2598,7 @@ void handle_death() else if(choice == "load") { fs::path file_to_load = nav_get_party(); if(!file_to_load.empty()) load_party(file_to_load); - if (party_toast() == false) { + if (!party_toast()) { if(overall_mode != MODE_STARTUP) post_load(), finish_load_party(); return; @@ -2630,11 +2630,11 @@ void start_new_game() else if(kb::isKeyPressed(kb::LControl) || kb::isKeyPressed(kb::RControl)) init_party(2); else init_party(0); - //while (creation_done == false) { + //while (!creation_done) { edit_party(); - /* if ((i > 0) || (in_startup_mode == false)) + /* if ((i > 0) || !in_startup_mode) creation_done = true; - if ((i == 0) && (in_startup_mode == false)) + if ((i == 0) && !in_startup_mode) return; } */ @@ -2796,7 +2796,7 @@ bool outd_move_party(location destination,bool forced) ter_num_t ter; keep_going = check_special_terrain(destination,eSpecCtx::OUT_MOVE,0,&spec_num,&check_f); - if (check_f == true) + if (check_f) forced = true; if (in_scen_debug && ghost_mode) forced = true; @@ -2804,7 +2804,7 @@ bool outd_move_party(location destination,bool forced) forced = true; // If not blocked and not put in town by a special, process move - if ((keep_going == true) && (overall_mode == MODE_OUTDOORS)) { + if (keep_going && overall_mode == MODE_OUTDOORS) { real_dest.x = destination.x - univ.party.p_loc.x; real_dest.y = destination.y - univ.party.p_loc.y; @@ -2853,26 +2853,26 @@ bool outd_move_party(location destination,bool forced) -// if (forced == true) +// if (forced) // for (i = 0; i < 10; i++) -// if (same_point(destination,party.out_c[i].m_loc) == true) +// if (same_point(destination,party.out_c[i].m_loc)) // party.out_c[i].exists = false; ter = univ.out[real_dest.x][real_dest.y]; if (univ.party.in_boat >= 0) { - if ((outd_is_blocked(real_dest) == false) //&& (outd_is_special(real_dest) == false) + if (!outd_is_blocked(real_dest) //&& !outd_is_special(real_dest) // not in towns - && ((scenario.ter_types[ter].boat_over == false) + && (!scenario.ter_types[ter].boat_over || ((real_dest.x != univ.party.p_loc.x) && (real_dest.y != univ.party.p_loc.y))) && scenario.ter_types[ter].special != eTerSpec::TOWN_ENTRANCE) { add_string_to_buf("You leave the boat."); univ.party.in_boat = -1; } else if (((real_dest.x != univ.party.p_loc.x) && (real_dest.y != univ.party.p_loc.y)) - || ((forced == false) && (out_boat_there(destination) < 30))) + || (!forced && (out_boat_there(destination) < 30))) return false; - else if ((outd_is_blocked(real_dest) == false) - && (scenario.ter_types[ter].boat_over == true) + else if (!outd_is_blocked(real_dest) + && scenario.ter_types[ter].boat_over && scenario.ter_types[ter].special != eTerSpec::TOWN_ENTRANCE) { // TODO: It kinda looks like there should be a check for eTerSpec::BRIDGE here? // Note: Maybe not though, since this is where boating over lava was once hard-coded...? @@ -2883,12 +2883,12 @@ bool outd_move_party(location destination,bool forced) univ.party.in_boat = -1; } } - else if (scenario.ter_types[ter].boat_over == true) + else if (scenario.ter_types[ter].boat_over) forced = true; } if (((boat_num = out_boat_there(real_dest)) < 30) && (univ.party.in_boat < 0) && (univ.party.in_horse < 0)) { - if (flying() == true) { + if (flying()) { add_string_to_buf("You land first. "); PSD[SDF_PARTY_FLIGHT] = 0; } @@ -2909,7 +2909,7 @@ bool outd_move_party(location destination,bool forced) return true; } else if (((horse_num = out_horse_there(real_dest)) < 30) && (univ.party.in_boat < 0) && (univ.party.in_horse < 0)) { - if (flying() == true) { + if (flying()) { add_string_to_buf("Land before mounting horses."); return false; } @@ -2931,10 +2931,9 @@ bool outd_move_party(location destination,bool forced) return true; } - else if ((outd_is_blocked(real_dest) == false) || (forced == true) + else if (!outd_is_blocked(real_dest) || forced // Check if can fly over - || ((flying() == true) && - (scenario.ter_types[ter].fly_over == true)) ) { + || (flying() && scenario.ter_types[ter].fly_over)) { if(univ.party.in_horse >= 0) { if(scenario.ter_types[ter].special == eTerSpec::DAMAGING || scenario.ter_types[ter].special == eTerSpec::DANGEROUS) { ASB("Your horses quite sensibly refuse."); @@ -3019,14 +3018,14 @@ bool town_move_party(location destination,short forced)//// if (monst_there(destination) > univ.town->max_monst()) keep_going = check_special_terrain(destination,eSpecCtx::TOWN_MOVE,0,&spec_num,&check_f); - if (check_f == true) + if (check_f) forced = true; if (spec_num == 50) forced = true; ter = univ.town->terrain(destination.x,destination.y); - if (keep_going == true) { + if (keep_going) { if (univ.party.in_boat >= 0) { if ((!is_blocked(destination)) && (!is_special(destination)) // If to bridge, exit if heading diagonal, keep going if heading horiz or vert @@ -3041,7 +3040,7 @@ bool town_move_party(location destination,short forced)//// else if(!is_blocked(destination) && scenario.ter_types[ter].boat_over && scenario.ter_types[ter].special == eTerSpec::BRIDGE) { if(cChoiceDlog("boat-bridge.xml",{"under","land"}).show() == "under") forced = true; - else if (is_blocked(destination) == false) { + else if (!is_blocked(destination)) { add_string_to_buf("You leave the boat. "); univ.party.in_boat = -1; } @@ -3052,12 +3051,12 @@ bool town_move_party(location destination,short forced)//// return false; } // water or lava - else if (scenario.ter_types[ter].boat_over == true) + else if (scenario.ter_types[ter].boat_over) forced = true; } if (((boat_there = town_boat_there(destination)) < 30) && (univ.party.in_boat < 0)) { - if (univ.party.boats[boat_there].property == true) { + if (univ.party.boats[boat_there].property) { add_string_to_buf(" Not your boat. "); return false; } @@ -3072,7 +3071,7 @@ bool town_move_party(location destination,short forced)//// return true; } else if (((horse_there = town_horse_there(destination)) < 30) && (univ.party.in_horse < 0)) { - if (univ.party.horses[horse_there].property == true) { + if (univ.party.horses[horse_there].property) { add_string_to_buf(" Not your horses. "); return false; } @@ -3087,13 +3086,13 @@ bool town_move_party(location destination,short forced)//// return true; } - else if ((is_blocked(destination) == false) || (forced == 1)) { + else if (!is_blocked(destination) || forced) { if (univ.party.in_horse >= 0) { if(scenario.ter_types[ter].special == eTerSpec::DAMAGING) { ASB("Your horses quite sensibly refuse."); return false; } - if (scenario.ter_types[ter].block_horse == true) { + if (scenario.ter_types[ter].block_horse) { ASB("You can't take horses there!"); return false; } @@ -3123,7 +3122,7 @@ bool town_move_party(location destination,short forced)//// return true; } else { - if (is_door(destination) == true) + if (is_door(destination)) sprintf ((char *) create_line, "Door locked: %s ",dir_string[set_direction(univ.town.p_loc, destination)]); else sprintf ((char *) create_line, "Blocked: %s ",dir_string[set_direction(univ.town.p_loc, destination)]); add_string_to_buf((char *) create_line); @@ -3150,7 +3149,7 @@ short nearest_monster() short i = 100,j,s; for (j = 0; j < 10; j++) - if (univ.party.out_c[j].exists == true) { + if (univ.party.out_c[j].exists) { s = dist(univ.party.p_loc,univ.party.out_c[j].m_loc); i = min(i,s); } diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index 5126e89e..cf58b134 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -368,7 +368,7 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,ter_num_t in_which_terr else if ((univ.town.monst[i].mu > 0) || (univ.town.monst[i].cl > 0)) univ.town.monst[i].cur_loc.y -= 4;//max(12,univ.town.monst[i].m_loc.y - 4); num_tries = 0; - while (((monst_can_be_there(univ.town.monst[i].cur_loc,i) == false) || + while ((!monst_can_be_there(univ.town.monst[i].cur_loc,i) || univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y) == 180 || (pc_there(univ.town.monst[i].cur_loc) < 6)) && (num_tries++ < 50)) { @@ -428,16 +428,16 @@ bool pc_combat_move(location destination) //// if(monst_hit > univ.town->max_monst()) keep_going = check_special_terrain(destination,eSpecCtx::COMBAT_MOVE,current_pc,&spec_num,&check_f); - if (check_f == true) + if (check_f) forced = true; if(in_scen_debug && ghost_mode) forced = true; - if (keep_going == true) { + if (keep_going) { dir = set_direction(univ.party[current_pc].combat_pos, destination); - if ((loc_off_act_area(destination) == true) && (which_combat_type == 1)) { + if ((loc_off_act_area(destination)) && (which_combat_type == 1)) { add_string_to_buf("Move: Can't leave town during combat."); print_buf(); return true; @@ -500,8 +500,8 @@ bool pc_combat_move(location destination) //// monst_exist = univ.town.monst[i].active; s1 = current_pc; - if ((monst_exist > 0) && (monst_adjacent(univ.party[current_pc].combat_pos,i) == true) - && (monst_adjacent(destination,i) == false) && + if ((monst_exist > 0) && (monst_adjacent(univ.party[current_pc].combat_pos,i)) + && !monst_adjacent(destination,i) && (univ.town.monst[i].attitude % 2 == 1) && univ.town.monst[i].status[eStatus::ASLEEP] <= 0 && univ.town.monst[i].status[eStatus::PARALYZED] <= 0) { @@ -837,7 +837,7 @@ void place_target(location target) short i; if (num_targets_left > 0) { - if (loc_off_act_area(target) == true) { + if (loc_off_act_area(target)) { add_string_to_buf(" Space not in town. "); return; } @@ -956,7 +956,7 @@ void do_combat_cast(location target)//// if ((adjust = can_see_light(univ.party[current_pc].combat_pos,target,sight_obscurity)) > 4) { add_string_to_buf(" Can't see target. "); } - else if (loc_off_act_area(target) == true) { + else if (loc_off_act_area(target)) { add_string_to_buf(" Space not in town. "); } else if (dist(univ.party[current_pc].combat_pos,target) > (*spell_being_cast).range) @@ -966,8 +966,8 @@ void do_combat_cast(location target)//// else if (univ.town.is_antimagic(target.x,target.y)) add_string_to_buf(" Target in antimagic field."); else { - if (ap_taken == false) { - if (freebie == false) + if(!ap_taken) { + if(!freebie) take_ap(5); ap_taken = true; draw_terrain(2); @@ -1118,7 +1118,7 @@ void do_combat_cast(location target)//// switch (spell_being_cast) { case eSpell::SIMULACRUM: r2 = get_ran(3,1,4) + stat_adj(current_pc,eSkill::INTELLIGENCE); - if (summon_monster(store_sum_monst,target,r2,2) == false) + if(!summon_monster(store_sum_monst,target,r2,2)) add_string_to_buf(" Summon failed."); break; case eSpell::SUMMON_BEAST: @@ -1154,23 +1154,23 @@ void do_combat_cast(location target)//// case eSpell::SUMMON_SPIRIT: r2 = get_ran(2,1,5) + stat_adj(current_pc,eSkill::INTELLIGENCE); - if (summon_monster(125,target,r2,2) == false) + if(!summon_monster(125,target,r2,2)) add_string_to_buf(" Summon failed."); break; case eSpell::STICKS_TO_SNAKES: r1 = get_ran(1,0,7); r2 = get_ran(2,1,5) + stat_adj(current_pc,eSkill::INTELLIGENCE); - if (summon_monster((r1 == 1) ? 100 : 99,target,r2,2) == false) + if(!summon_monster((r1 == 1) ? 100 : 99,target,r2,2)) add_string_to_buf(" Summon failed."); break; case eSpell::SUMMON_HOST: // host r2 = get_ran(2,1,4) + stat_adj(current_pc,eSkill::INTELLIGENCE); - if (summon_monster((i == 0) ? 126 : 125,target,r2,2) == false) + if (!summon_monster((i == 0) ? 126 : 125,target,r2,2)) add_string_to_buf(" Summon failed."); break; case eSpell::SUMMON_GUARDIAN: // guardian r2 = get_ran(6,1,4) + stat_adj(current_pc,eSkill::INTELLIGENCE); - if (summon_monster(122,target,r2,2) == false) + if (!summon_monster(122,target,r2,2)) add_string_to_buf(" Summon failed."); break; } @@ -1403,22 +1403,22 @@ void load_missile() //// short i,bow = 24,arrow = 24,thrown = 24,crossbow = 24,bolts = 24,no_ammo = 24; for (i = 0; i < 24; i++) { - if ((univ.party[current_pc].equip[i] == true) && + if ((univ.party[current_pc].equip[i]) && (univ.party[current_pc].items[i].variety == eItemType::THROWN_MISSILE)) thrown = i; - if ((univ.party[current_pc].equip[i] == true) && + if ((univ.party[current_pc].equip[i]) && (univ.party[current_pc].items[i].variety == eItemType::BOW)) bow = i; - if ((univ.party[current_pc].equip[i] == true) && + if ((univ.party[current_pc].equip[i]) && (univ.party[current_pc].items[i].variety == eItemType::ARROW)) arrow = i; - if ((univ.party[current_pc].equip[i] == true) && + if ((univ.party[current_pc].equip[i]) && (univ.party[current_pc].items[i].variety == eItemType::CROSSBOW)) crossbow = i; - if ((univ.party[current_pc].equip[i] == true) && + if ((univ.party[current_pc].equip[i]) && (univ.party[current_pc].items[i].variety == eItemType::BOLTS)) bolts = i; - if ((univ.party[current_pc].equip[i] == true) && + if ((univ.party[current_pc].equip[i]) && (univ.party[current_pc].items[i].variety == eItemType::MISSILE_NO_AMMO)) no_ammo = i; } @@ -1615,7 +1615,7 @@ bool combat_next_step() short store_pc; // will print current pc name is active pc changes store_pc = current_pc; - while (pick_next_pc() == true) { + while (pick_next_pc()) { combat_run_monst(); set_pc_moves(); if((combat_active_pc < 6) && (univ.party[combat_active_pc].ap == 0)){ @@ -1625,7 +1625,7 @@ bool combat_next_step() } to_return = true; // Safety valve - if (party_toast() == true) + if (party_toast()) return true; } pick_next_pc(); @@ -1633,7 +1633,7 @@ bool combat_next_step() to_return = true; // TODO: Windows version checks for overall_mode being MODE_OUTDOORS or MODE_TOWN - that's not necessary, right? center = univ.party[current_pc].combat_pos; - //if (ensure_redraw == true) + //if (ensure_redraw) // draw_terrain(0); adjust_spell_menus(); @@ -1652,7 +1652,7 @@ bool combat_next_step() add_string_to_buf(create_line); print_buf(); } - if ((current_pc != store_pc) || (to_return == true)) { + if ((current_pc != store_pc) || (to_return)) { put_pc_screen(); set_stat_window(current_pc); } @@ -1776,7 +1776,7 @@ void combat_run_monst() handle_disease(); handle_acid(); - if (update_stat == true) + if (update_stat) put_pc_screen(); } @@ -1817,7 +1817,7 @@ void do_monster_turn() cur_monst->active = 2; for (j = 0; j < univ.town->max_monst(); j++) - if (monst_near(j,cur_monst->cur_loc,5,1) == true) { + if (monst_near(j,cur_monst->cur_loc,5,1)) { cur_monst->active = 2; } } @@ -1868,7 +1868,7 @@ void do_monster_turn() } if(cur_monst->status[eStatus::ASLEEP] > 0 || cur_monst->status[eStatus::PARALYZED] > 0) cur_monst->ap = 0; - if (in_scen_debug == true) + if (in_scen_debug) cur_monst->ap = 0; center_on_monst = false; @@ -1886,7 +1886,7 @@ void do_monster_turn() for (i = 0; i < num_monst; i++) { // Begin main monster loop, do monster actions // If party dead, no point - if (party_toast() == true) + if (party_toast()) return; futzing = 0; // assume monster is fresh @@ -1930,18 +1930,18 @@ void do_monster_turn() // Now if in town and monster about to attack, do a redraw, so we see monster // in right place - if ((target != 6) && (is_town() == true) && (redraw_not_yet_done == true) - && (party_can_see_monst(i) == true)) { + if ((target != 6) && (is_town()) && (redraw_not_yet_done) + && (party_can_see_monst(i))) { draw_terrain(0); redraw_not_yet_done = false; } // Draw w. monster in center, if can see - if ((cur_monst->ap > 0) && (is_combat() == true) + if ((cur_monst->ap > 0) && (is_combat()) // First make sure it has a target and is close, if not, don't bother && (cur_monst->attitude > 0) && (cur_monst->picture_num > 0) && ((target != 6) || (cur_monst->attitude % 2 == 1)) - && (party_can_see_monst(i) == true) ) { + && (party_can_see_monst(i)) ) { center_on_monst = true; center = cur_monst->cur_loc; draw_terrain(0); @@ -1960,14 +1960,14 @@ void do_monster_turn() if ((target != 6) && (cur_monst->ap > 1) && (futzing == 0)) { l = closest_pc_loc(cur_monst->cur_loc); if (((cur_monst->mu > 0) || (cur_monst->cl > 0)) && - (dist(cur_monst->cur_loc,l) < 5) && (monst_adjacent(l,i) == false)) + (dist(cur_monst->cur_loc,l) < 5) && !monst_adjacent(l,i)) current_monst_tactic = 1; // this means flee if ( (((cur_monst->spec_skill > 0) && (cur_monst->spec_skill < 4)) || (cur_monst->spec_skill == 20)) && // Archer? (dist(cur_monst->cur_loc,targ_space) < 6) && - (monst_adjacent(targ_space,i) == false)) + !monst_adjacent(targ_space,i)) current_monst_tactic = 1; // this means flee } @@ -1986,19 +1986,19 @@ void do_monster_turn() short targ = univ.town.monst[i].target; if(targ < 6 && univ.party[targ].main_status == eMainStatus::ALIVE && cur_monst->mobility == 1) { acted_yet = flee_party (i,cur_monst->cur_loc,targ_space); - if (acted_yet == true) take_m_ap(1,cur_monst); + if (acted_yet) take_m_ap(1,cur_monst); } } if ((target != 6) && (cur_monst->attitude > 0) - && (monst_can_see(i,targ_space) == true) - && (can_see_monst(targ_space,i) == true)) { // Begin spec. attacks + && (monst_can_see(i,targ_space)) + && (can_see_monst(targ_space,i))) { // Begin spec. attacks // sprintf((char *)create_line,"%d: %d %d %d",i,cur_monst->breath,cur_monst->mu,cur_monst->cl); // add_string_to_buf((char *)create_line); // Breathe (fire) if ( (cur_monst->breath > 0) - && (get_ran(1,1,8) < 4) && (acted_yet == false)) { + && (get_ran(1,1,8) < 4) && !acted_yet) { //print_nums(cur_monst->breath,cur_monst->breath_type,dist(cur_monst->m_loc,targ_space) ); if ((target != 6) && (dist(cur_monst->cur_loc,targ_space) <= 8)) { @@ -2010,8 +2010,8 @@ void do_monster_turn() } // Mage spell if ((cur_monst->mu > 0) && (get_ran(1,1,10) < ((cur_monst->cl > 0) ? 6 : 9) ) - && (acted_yet == false)) { - if (((monst_adjacent(targ_space,i) == false) || (get_ran(1,0,2) < 2) || (cur_monst->number >= 160) + && !acted_yet) { + if ((!monst_adjacent(targ_space,i) || (get_ran(1,0,2) < 2) || (cur_monst->number >= 160) || (cur_monst->level > 9)) && (dist(cur_monst->cur_loc,targ_space) <= 10)) { acted_yet = monst_cast_mage(cur_monst,target); @@ -2021,8 +2021,8 @@ void do_monster_turn() } } // Priest spell - if ((cur_monst->cl > 0) && (get_ran(1,1,8) < 7) && (acted_yet == false)) { - if (((monst_adjacent(targ_space,i) == false) || (get_ran(1,0,2) < 2) || (cur_monst->level > 9)) + if ((cur_monst->cl > 0) && (get_ran(1,1,8) < 7) && !acted_yet) { + if ((!monst_adjacent(targ_space,i) || (get_ran(1,0,2) < 2) || (cur_monst->level > 9)) && (dist(cur_monst->cur_loc,targ_space) <= 10)) { acted_yet = monst_cast_priest(cur_monst,target); had_monst = true; @@ -2033,9 +2033,9 @@ void do_monster_turn() // Missile if ((abil_range[cur_monst->spec_skill] > 0) // breathing gas short range - && (get_ran(1,1,8) < abil_odds[cur_monst->spec_skill]) && (acted_yet == false)) { + && (get_ran(1,1,8) < abil_odds[cur_monst->spec_skill]) && !acted_yet) { // Don't fire when adjacent, unless non-gaze magical attack - if (((monst_adjacent(targ_space,i) == false) || + if ((!monst_adjacent(targ_space,i) || ((cur_monst->spec_skill > 7) && (cur_monst->spec_skill != 20) && (cur_monst->spec_skill != 33))) // missile range @@ -2059,8 +2059,8 @@ void do_monster_turn() // Attack pc if(univ.town.monst[i].target < 6 && univ.party[univ.town.monst[i].target].main_status == eMainStatus::ALIVE - && (monst_adjacent(targ_space,i) == true) && (cur_monst->attitude % 2 == 1) - && (acted_yet == false)) { + && (monst_adjacent(targ_space,i)) && (cur_monst->attitude % 2 == 1) + && !acted_yet) { monster_attack_pc(i,univ.town.monst[i].target); take_m_ap(4,cur_monst); acted_yet = true; @@ -2068,15 +2068,15 @@ void do_monster_turn() } // Attack monst if ((univ.town.monst[i].target >= 100) && (univ.town.monst[univ.town.monst[i].target - 100].active > 0) - && (monst_adjacent(targ_space,i) == true) && (cur_monst->attitude > 0) - && (acted_yet == false)) { + && (monst_adjacent(targ_space,i)) && (cur_monst->attitude > 0) + && !acted_yet) { monster_attack_monster(i,univ.town.monst[i].target - 100); take_m_ap(4,cur_monst); acted_yet = true; had_monst = true; } - if (acted_yet == true) { + if (acted_yet) { print_buf(); if (j == 0) pause(8); @@ -2084,9 +2084,9 @@ void do_monster_turn() } if (overall_mode == MODE_COMBAT) { - if ((acted_yet == false) && (cur_monst->mobility == 1)) { // move monst + if (!acted_yet && (cur_monst->mobility == 1)) { // move monst move_target = (univ.town.monst[i].target != 6) ? univ.town.monst[i].target : closest_pc(cur_monst->cur_loc); - if (monst_hate_spot(i,&move_targ) == true) // First, maybe move out of dangerous space + if (monst_hate_spot(i,&move_targ)) // First, maybe move out of dangerous space seek_party (i,cur_monst->cur_loc,move_targ); else { // spot is OK, so go nuts if ((cur_monst->attitude % 2 == 1) && (move_target < 6)) // Monsters seeking party do so @@ -2118,12 +2118,12 @@ void do_monster_turn() } take_m_ap(1,cur_monst); } - if ((acted_yet == false) && (cur_monst->mobility == 0)) { // drain action points + if (!acted_yet && (cur_monst->mobility == 0)) { // drain action points take_m_ap(1,cur_monst); futzing++; } } - else if (acted_yet == false) { + else if (!acted_yet) { take_m_ap(1,cur_monst); futzing++; } @@ -2132,7 +2132,7 @@ void do_monster_turn() if ((overall_mode >= MODE_COMBAT) && (overall_mode < MODE_TALKING)) for (k = 0; k < 6; k++) if(univ.party[k].main_status == eMainStatus::ALIVE && !monst_adjacent(univ.party[k].combat_pos,i) - && (pc_adj[k] == true) && (cur_monst->attitude % 2 == 1) && (cur_monst->active > 0) && + && (pc_adj[k]) && (cur_monst->attitude % 2 == 1) && (cur_monst->active > 0) && univ.party[k].status[eStatus::INVISIBLE] == 0) { combat_posing_monster = current_working_monster = k; pc_attack(k,i); @@ -2156,17 +2156,17 @@ void do_monster_turn() place_spell_pattern(square,cur_monst->cur_loc,CLOUD_STINK,7); if ((cur_monst->radiate_1 == 10) && (get_ran(1,1,100) < 5)){ if (summon_monster(cur_monst->radiate_2, - cur_monst->cur_loc,130,cur_monst->attitude) == true) + cur_monst->cur_loc,130,cur_monst->attitude)) {monst_spell_note(cur_monst->number,33); play_sound(61);} } if ((cur_monst->radiate_1 == 11) && (get_ran(1,1,100) < 20)){ if (summon_monster(cur_monst->radiate_2, - cur_monst->cur_loc,130,cur_monst->attitude) == true) + cur_monst->cur_loc,130,cur_monst->attitude)) {monst_spell_note(cur_monst->number,33); play_sound(61);} } if ((cur_monst->radiate_1 == 12) && (get_ran(1,1,100) < 50)){ if (summon_monster(cur_monst->radiate_2, - cur_monst->cur_loc,130,cur_monst->attitude) == true) + cur_monst->cur_loc,130,cur_monst->attitude)) {monst_spell_note(cur_monst->number,33); play_sound(61);} } if ((cur_monst->radiate_1 == 14) && !special_called && party_can_see_monst(i)) { @@ -2180,7 +2180,7 @@ void do_monster_turn() combat_posing_monster = current_working_monster = -1; // Redraw monster after it goes if ((cur_monst->attitude > 0) && (cur_monst->active > 0) && (cur_monst->ap == 0) - && (is_combat()) && (cur_monst->picture_num > 0) && (party_can_see_monst(i) == true)) { + && (is_combat()) && (cur_monst->picture_num > 0) && (party_can_see_monst(i) )) { center = cur_monst->cur_loc; draw_terrain(0); @@ -2201,7 +2201,7 @@ void do_monster_turn() for (i = 0; i < num_monst; i++) { // Begin monster time stuff loop // If party dead, no point - if (party_toast() == true) + if (party_toast()) return; cur_monst = &univ.town.monst[i]; @@ -2210,7 +2210,7 @@ void do_monster_turn() cur_monst->active = 0; // clean up if (cur_monst->active != 0) { // Take care of monster effects if(cur_monst->status[eStatus::ACID] > 0) { // Acid - if (printed_acid == false) { + if (!printed_acid) { add_string_to_buf("Acid: "); printed_acid = true; } @@ -2230,7 +2230,7 @@ void do_monster_turn() move_to_zero(cur_monst->status[eStatus::WEBS]); if(cur_monst->status[eStatus::POISON] > 0) { // Poison - if (printed_poison == false) { + if (!printed_poison) { add_string_to_buf("Poisoned monsters: "); printed_poison = true; } @@ -2239,7 +2239,7 @@ void do_monster_turn() cur_monst->status[eStatus::POISON]--; } if(cur_monst->status[eStatus::DISEASE] > 0) { // Disease - if (printed_disease == false) { + if (!printed_disease) { add_string_to_buf("Diseased monsters: "); printed_disease = true; } @@ -2267,7 +2267,7 @@ void do_monster_turn() // If in town, need to restore center if (overall_mode < MODE_COMBAT) center = univ.town.p_loc; - if (had_monst == true) + if (had_monst) put_pc_screen(); for (i = 0; i < 6; i++) univ.party[i].parry = 0; @@ -2290,7 +2290,7 @@ void monster_attack_pc(short who_att,short target) // Draw attacker frames if ((is_combat()) - && ((center_on_monst == true) || (monsters_going == false))) { + && ((center_on_monst) || !monsters_going)) { if (attacker->spec_skill != 11) frame_space(attacker->cur_loc,0,attacker->x_width,attacker->y_width); frame_space(univ.party[target].combat_pos,1,1,1); @@ -2501,7 +2501,7 @@ void monster_attack_monster(short who_att,short attackee) // Draw attacker frames if ((is_combat()) - && ((center_on_monst == true) || (monsters_going == false))) { + && (center_on_monst || !monsters_going)) { if (attacker->spec_skill != 11) frame_space(attacker->cur_loc,0,attacker->x_width,attacker->y_width); frame_space(target->cur_loc,1,1,1); @@ -2544,7 +2544,7 @@ void monster_attack_monster(short who_att,short attackee) sound_type = get_monst_sound(attacker,i); dam_type += DAMAGE_MARKED; - if (damage_monst(attackee,7,r2,0,dam_type,sound_type) == true) { + if (damage_monst(attackee,7,r2,0,dam_type,sound_type)) { damaged_message(store_hp - target->health, attacker->a[i].type); @@ -2664,7 +2664,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor if (target >= 100) m_target = &univ.town.monst[target - 100]; - if (((overall_mode >= MODE_COMBAT) && (overall_mode <= MODE_TALKING)) && (center_on_monst == true)) { + if (((overall_mode >= MODE_COMBAT) && (overall_mode <= MODE_TALKING)) && (center_on_monst)) { frame_space(source,0,univ.town.monst[m_num].x_width,univ.town.monst[m_num].y_width); if (target >= 100) frame_space(targ_space,1,m_target->x_width,m_target->y_width); @@ -2913,7 +2913,7 @@ bool monst_breathe(cCreature *caster,location targ_space,short dam_type)//// location l; draw_terrain(2); - if ((is_combat()) && (center_on_monst == true)) { + if ((is_combat()) && (center_on_monst)) { frame_space(caster->cur_loc,0,caster->x_width,caster->y_width); } //if (dam_type < 2) @@ -3147,8 +3147,8 @@ bool monst_cast_mage(cCreature *caster,short targ)//// x = get_ran(4,1,4); for (i = 0; i < j; i++){ play_sound(-61); - if (summon_monster(r1,caster->cur_loc, - ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude) == false) { + if(!summon_monster(r1,caster->cur_loc, + ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude)) { add_string_to_buf(" Summon failed."); i = j;} } break; @@ -3444,8 +3444,8 @@ bool monst_cast_priest(cCreature *caster,short targ) ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude); for (i = 0; i < 4; i++) { play_sound(-61); - if (summon_monster(125,caster->cur_loc, - ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude) == false) + if(!summon_monster(125,caster->cur_loc, + ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude)) i = 4; } break; @@ -3611,14 +3611,14 @@ short count_levels(location where,short radius) short i,store = 0; for (i = 0; i < univ.town->max_monst(); i++) - if (monst_near(i,where,radius,0) == true) { + if (monst_near(i,where,radius,0)) { if (univ.town.monst[i].attitude % 2 == 1) store = store - univ.town.monst[i].level; else store = store + univ.town.monst[i].level; } if (is_combat()) { for (i = 0; i < 6; i++) - if (pc_near(i,where,radius) == true) + if (pc_near(i,where,radius)) store = store + 10; } if (is_town()) @@ -4098,11 +4098,11 @@ void hit_space(location target,short dam,eDamageType type,short report,short hit } for (i = 0; i < univ.town->max_monst(); i++) - if ((hit_monsters == true) && (univ.town.monst[i].active != 0) && (stop_hitting == false)) + if ((hit_monsters) && (univ.town.monst[i].active != 0) && !stop_hitting) if (monst_on_space(target,i)) { - if (processing_fields == true) + if (processing_fields) damage_monst(i, 6, dam, 0, type,0); - else damage_monst(i, (monsters_going == true) ? 7 : current_pc, dam, 0, type,0); + else damage_monst(i, (monsters_going) ? 7 : current_pc, dam, 0, type,0); stop_hitting = (hit_all == 1) ? false : true; } @@ -4121,7 +4121,7 @@ void hit_space(location target,short dam,eDamageType type,short report,short hit stop_hitting = (hit_all == 1) ? false : true; } - if ((report == 1) && (hit_all == 0) && (stop_hitting == false)) + if ((report == 1) && (hit_all == 0) && !stop_hitting) add_string_to_buf(" Missed."); } @@ -4137,7 +4137,7 @@ void do_poison() if(univ.party[i].main_status == eMainStatus::ALIVE) if(univ.party[i].status[eStatus::POISON] > 0) some_poison = true; - if (some_poison == true) { + if (some_poison) { add_string_to_buf("Poison: "); for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) @@ -4168,7 +4168,7 @@ void handle_disease() if(univ.party[i].status[eStatus::DISEASE] > 0) disease = true; - if (disease == true) { + if (disease) { add_string_to_buf("Disease: "); for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) @@ -4216,7 +4216,7 @@ void handle_acid() if(univ.party[i].status[eStatus::ACID] > 0) some_acid = true; - if (some_acid == true) { + if (some_acid) { add_string_to_buf("Acid: "); for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) @@ -4257,7 +4257,7 @@ bool hit_end_c_button() } } - if (end_ok == true) + if (end_ok) end_combat(); return end_ok; } @@ -4324,7 +4324,7 @@ bool combat_cast_mage_spell() else { - if (spell_forced == false) + if(!spell_forced) spell_num = pick_spell(current_pc,eSkill::MAGE_SPELLS); else { if(!repeat_cast_ok(eSkill::MAGE_SPELLS)) @@ -4517,7 +4517,7 @@ bool combat_cast_priest_spell() add_string_to_buf(" Not in antimagic field."); return false; } - if (spell_forced == false) + if(!spell_forced) spell_num = pick_spell(current_pc,eSkill::PRIEST_SPELLS); else { if(!repeat_cast_ok(eSkill::PRIEST_SPELLS)) diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index 9b72f1f9..75491d08 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -254,9 +254,9 @@ void handle_sale(short what_chosen,short cost) break; case 5: base_item = store_alchemy(what_chosen - 500); - if (univ.party.alchemy[base_item.item_level] == true) + if (univ.party.alchemy[base_item.item_level]) ASB("You already know that recipe."); - else if (take_gold(cost,false) == false) + else if (!take_gold(cost,false)) ASB("Not enough gold."); else { play_sound(62); @@ -266,7 +266,7 @@ void handle_sale(short what_chosen,short cost) break; case 6: //base_item = food_types[what_chosen - 600]; - //if (take_gold(cost,false) == false) + //if (!take_gold(cost,false)) // ASB("Not enough gold."); //else { // play_sound(-38); ASB("You buy food."); @@ -275,7 +275,7 @@ void handle_sale(short what_chosen,short cost) break; case 7: what_chosen -= 700; - if (take_gold(cost,false) == false) + if (!take_gold(cost,false)) ASB("Not enough gold."); else { ASB("You pay the healer."); @@ -295,7 +295,7 @@ void handle_sale(short what_chosen,short cost) break; case 4: for (i = 0; i < 24; i++) - if ((univ.party[current_pc].equip[i] == true) && + if ((univ.party[current_pc].equip[i]) && (univ.party[current_pc].items[i].cursed)) univ.party[current_pc].items[i].cursed = univ.party[current_pc].items[i].unsellable = false; break; @@ -315,9 +315,9 @@ void handle_sale(short what_chosen,short cost) giveError("Error: The scenario tried to sell you an invalid mage spell!"); break; } - if (univ.party[current_pc].mage_spells[base_item.item_level] == true) + if (univ.party[current_pc].mage_spells[base_item.item_level]) ASB("You already have this spell."); - else if (take_gold(cost,false) == false) + else if (!take_gold(cost,false)) ASB("Not enough gold."); else { play_sound(62); @@ -333,9 +333,9 @@ void handle_sale(short what_chosen,short cost) giveError("Error: The scenario tried to sell you an invalid priest spell!"); break; } - if (univ.party[current_pc].priest_spells[base_item.item_level] == true) + if (univ.party[current_pc].priest_spells[base_item.item_level]) ASB("You already have this spell."); - else if (take_gold(cost,false) == false) + else if (!take_gold(cost,false)) ASB("Not enough gold."); else { play_sound(62); @@ -748,7 +748,7 @@ void handle_talk_event(location p) place_string2 = ""; break; case 4: - if (day_reached((unsigned char) a,0) == true) { + if (day_reached((unsigned char) a,0)) { strnum1 = strnum2; place_string1 = place_string2; } @@ -756,7 +756,7 @@ void handle_talk_event(location p) strnum2 = 0; break; case 5: - if (day_reached((unsigned char) a,(unsigned char) b) == true) { + if (day_reached((unsigned char) a,(unsigned char) b)) { strnum1 = strnum2; place_string1 = place_string2; } @@ -837,7 +837,7 @@ void handle_talk_event(location p) strnum2 = 0; break; case 19: - if ((sd_legit(b,c) == true) && (PSD[b][c] == d)) { + if ((sd_legit(b,c)) && (PSD[b][c] == d)) { place_string1 = "You've already learned that."; strnum1 = -1; } @@ -848,7 +848,7 @@ void handle_talk_event(location p) else { univ.party.gold -= a; put_pc_screen(); - if (sd_legit(b,c) == true) + if (sd_legit(b,c)) PSD[b][c] = d; else giveError("Invalid Stuff Done flag called in conversation."); } @@ -865,7 +865,7 @@ void handle_talk_event(location p) } else { for (i = b; i <= b + c; i++) - if ((i >= 0) && (i < 30) && (univ.party.boats[i].property == true)) { + if ((i >= 0) && (i < 30) && (univ.party.boats[i].property)) { univ.party.gold -= a; put_pc_screen(); univ.party.boats[i].property = false; @@ -891,7 +891,7 @@ void handle_talk_event(location p) } else { for (i = b; i <= b + c; i++) - if ((i >= 0) && (i < 30) && (univ.party.horses[i].property == true)) { + if ((i >= 0) && (i < 30) && (univ.party.horses[i].property)) { univ.party.gold -= a; put_pc_screen(); univ.party.horses[i].property = false; @@ -961,7 +961,7 @@ void handle_talk_event(location p) // TODO: Any reason not to call something like kill_monst? univ.town.monst[store_m_num].active = 0; // Special killing effects - if (sd_legit(univ.town.monst[store_m_num].spec1,univ.town.monst[store_m_num].spec2) == true) + if (sd_legit(univ.town.monst[store_m_num].spec1,univ.town.monst[store_m_num].spec2)) PSD[univ.town.monst[store_m_num].spec1][univ.town.monst[store_m_num].spec2] = 1; talk_end_forced = true; break; @@ -1103,8 +1103,8 @@ static bool prefs_event_filter (cDialog& me, std::string id, eKeyMod) did_cancel = true; } - if (done_yet== true) { - if (did_cancel == false) { + if (done_yet) { + if (!did_cancel) { std::string cur_display_mode = dynamic_cast(me["display"]).getSelected(); // TODO: Make an enum for the display mode if(cur_display_mode == "mid") display_mode = 0; diff --git a/osx/boe.fileio.cpp b/osx/boe.fileio.cpp index 52389c0f..a601c9ac 100644 --- a/osx/boe.fileio.cpp +++ b/osx/boe.fileio.cpp @@ -144,7 +144,7 @@ void finish_load_party(){ // Set up field booleans for (int j = 0; j < univ.town->max_dim(); j++) for (int k = 0; k < univ.town->max_dim(); k++) { - if (univ.town.is_quickfire(j,k) == true) + if (univ.town.is_quickfire(j,k)) univ.town.quickfire_present = true; if(scenario.ter_types[univ.town->terrain(j,k)].special == eTerSpec::CONVEYOR) univ.town.belt_present = true; @@ -163,8 +163,8 @@ void finish_load_party(){ add_string_to_buf("Load: Game loaded. "); // Set sounds, map saving, and speed - if (((play_sounds == true) && (PSD[SDF_NO_SOUNDS] == 1)) || - ((play_sounds == false) && (PSD[SDF_NO_SOUNDS] == 0))) { + if (((play_sounds) && (PSD[SDF_NO_SOUNDS] == 1)) || + (!play_sounds && (PSD[SDF_NO_SOUNDS] == 0))) { flip_sound(); } give_delays = PSD[SDF_NO_FRILLS]; @@ -271,7 +271,7 @@ void shift_universe_left() for (i = 0; i < 10; i++) { if (univ.party.out_c[i].m_loc.x > 48) univ.party.out_c[i].exists = false; - if (univ.party.out_c[i].exists == true) + if (univ.party.out_c[i].exists) univ.party.out_c[i].m_loc.x += 48; } @@ -306,7 +306,7 @@ void shift_universe_right() for (i = 0; i < 10; i++) { if (univ.party.out_c[i].m_loc.x < 48) univ.party.out_c[i].exists = false; - if (univ.party.out_c[i].exists == true) + if (univ.party.out_c[i].exists) univ.party.out_c[i].m_loc.x -= 48; } load_outdoors(loc(univ.party.outdoor_corner.x + 1,univ.party.outdoor_corner.y),univ.out.outdoors[1][0]); @@ -340,7 +340,7 @@ void shift_universe_up() for (i = 0; i < 10; i++) { if (univ.party.out_c[i].m_loc.y > 48) univ.party.out_c[i].exists = false; - if (univ.party.out_c[i].exists == true) + if (univ.party.out_c[i].exists) univ.party.out_c[i].m_loc.y += 48; } load_outdoors(loc(univ.party.outdoor_corner.x,univ.party.outdoor_corner.y),univ.out.outdoors[0][0]); @@ -376,7 +376,7 @@ void shift_universe_down() for (i = 0; i < 10; i++) { if (univ.party.out_c[i].m_loc.y < 48) univ.party.out_c[i].exists = false; - if (univ.party.out_c[i].exists == true) + if (univ.party.out_c[i].exists) univ.party.out_c[i].m_loc.y = univ.party.out_c[i].m_loc.y - 48; } load_outdoors(loc(univ.party.outdoor_corner.x,univ.party.outdoor_corner.y + 1),univ.out.outdoors[0][1]); @@ -441,7 +441,7 @@ void build_outdoors() erase_out_specials(); for (i = 0; i < 10; i++) - if (univ.party.out_c[i].exists == true) + if (univ.party.out_c[i].exists) if ((univ.party.out_c[i].m_loc.x < 0) || (univ.party.out_c[i].m_loc.y < 0) || (univ.party.out_c[i].m_loc.x > 95) || (univ.party.out_c[i].m_loc.y > 95)) univ.party.out_c[i].exists = false; @@ -531,7 +531,7 @@ void fix_boats() short i; for (i = 0; i < 30; i++) - if ((univ.party.boats[i].exists == true) && (univ.party.boats[i].which_town == 200)) { + if ((univ.party.boats[i].exists) && (univ.party.boats[i].which_town == 200)) { if (univ.party.boats[i].sector.x == univ.party.outdoor_corner.x) univ.party.boats[i].loc.x = univ.party.boats[i].loc_in_sec.x; else if (univ.party.boats[i].sector.x == univ.party.outdoor_corner.x + 1) @@ -544,7 +544,7 @@ void fix_boats() else univ.party.boats[i].loc.y = 500; } for (i = 0; i < 30; i++) - if ((univ.party.horses[i].exists == true) && (univ.party.horses[i].which_town == 200)) { + if ((univ.party.horses[i].exists) && (univ.party.horses[i].which_town == 200)) { if (univ.party.horses[i].sector.x == univ.party.outdoor_corner.x) univ.party.horses[i].loc.x = univ.party.horses[i].loc_in_sec.x; else if (univ.party.horses[i].sector.x == univ.party.outdoor_corner.x + 1) @@ -638,7 +638,7 @@ bool load_scenario_header(fs::path file/*,short header_entry*/){ file_ok = true; mac_header = false; } - if (file_ok == false) { + if (!file_ok) { //scen_headers[header_entry].flag1 = 0; //scen_headers.pop_back(); fclose(file_id); diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index b71d6cca..edc65805 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -292,7 +292,7 @@ void draw_startup(short but_type) r4 = {-1000,579,1000,2500}; short i; - if (startup_loaded == false) + if (!startup_loaded) return; to_rect = startup_from[0]; @@ -482,7 +482,7 @@ void main_button_click(RECT button_rect) draw_buttons(1); mainPtr.display(); - if (play_sounds == true) + if (play_sounds) play_sound(37); else sf::sleep(time_in_ticks(5)); draw_buttons(0); @@ -498,7 +498,7 @@ void arrow_button_click(RECT button_rect) refresh_stat_areas(1); mainPtr.display(); - if (play_sounds == true) + if (play_sounds) play_sound(37); else sf::sleep(time_in_ticks(5)); undo_clip(mainPtr); @@ -508,7 +508,7 @@ void arrow_button_click(RECT button_rect) void reload_startup()//// { - if (startup_loaded == true) + if (startup_loaded) return; mini_map.setVisible(false); @@ -522,7 +522,7 @@ void reload_startup()//// void end_startup() { - if (startup_loaded == false) + if (!startup_loaded) return; startup_gworld.create(1,1); @@ -731,14 +731,14 @@ void draw_text_bar(short mode) } } - if ((is_combat()) && (current_pc < 6) && (monsters_going == false)) { + if ((is_combat()) && (current_pc < 6) && !monsters_going) { std::ostringstream sout; sout << univ.party[current_pc].name << " (ap: " << univ.party[current_pc].ap << ')'; combat_string = sout.str(); put_text_bar((char *) combat_string.c_str()); remember_tiny_text = 500; } - if ((is_combat()) && (monsters_going == true)) // Print bar for 1st monster with >0 ap - + if ((is_combat()) && (monsters_going)) // Print bar for 1st monster with >0 ap - // that is monster that is going for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst[i].active > 0) && (univ.town.monst[i].ap > 0)) { @@ -762,7 +762,7 @@ void put_text_bar(char *str) { // TODO: Not sure what the line height should be, so I just picked something win_draw_string(text_bar_gworld, to_rect, str, eTextMode::LEFT_TOP, style); - if (monsters_going == false) { + if (!monsters_going) { to_rect.left = 205; to_rect.top = 14; if (PSD[SDF_PARTY_STEALTHY] > 0) { @@ -920,7 +920,7 @@ void draw_terrain(short mode) else if (is_combat()) { spec_terrain = univ.town->terrain(where_draw.x,where_draw.y); can_draw = (((is_explored(where_draw.x,where_draw.y)) || - (which_combat_type == 0) || (monsters_going == true) || (overall_mode != MODE_COMBAT)) + (which_combat_type == 0) || (monsters_going) || (overall_mode != MODE_COMBAT)) && (party_can_see(where_draw) < 6)) ? 1 : 0; } else { @@ -928,7 +928,7 @@ void draw_terrain(short mode) can_draw = is_explored(where_draw.x,where_draw.y); if (can_draw > 0) { - if (pt_in_light(univ.town.p_loc,where_draw) == false) + if (!pt_in_light(univ.town.p_loc,where_draw)) can_draw = 0; } if ((overall_mode == MODE_LOOK_TOWN) && (can_draw == 0)) @@ -1029,7 +1029,7 @@ void draw_terrain(short mode) draw_monsters(); } - if ((overall_mode < MODE_COMBAT) || (overall_mode == MODE_LOOK_OUTDOORS) || ((overall_mode == MODE_LOOK_TOWN) && (point_onscreen(univ.town.p_loc,center) == true)) + if ((overall_mode < MODE_COMBAT) || (overall_mode == MODE_LOOK_OUTDOORS) || ((overall_mode == MODE_LOOK_TOWN) && (point_onscreen(univ.town.p_loc,center))) || (overall_mode == MODE_RESTING)) draw_party_symbol(center); else if (overall_mode != MODE_LOOK_TOWN) @@ -1141,8 +1141,8 @@ void place_trim(short q,short r,location where,ter_num_t ter_type) } if(is_wall(ter_type) && !at_top && !at_bot && !at_left && !at_right){ - //if (((ter_type >= 100) && (ter_type <= 137)) && (at_top == false) && - // (at_bot == false) && (at_left == false) && (at_right == false)) { + //if (((ter_type >= 100) && (ter_type <= 137)) && !at_top && + // !at_bot && !at_left && !at_right) { ter_num_t to_left = coord_to_ter(where.x - 1,where.y); ter_num_t above = coord_to_ter(where.x,where.y - 1); ter_num_t to_right = coord_to_ter(where.x + 1,where.y); @@ -1194,7 +1194,7 @@ void draw_trim(short q,short r,short which_trim,ter_num_t ground_ter) //short which_mode; // 0 top 1 bottom 2 left 3 right 4 up left 5 up right 6 down right 7 down left { /* TODO: Windows has a check for frills being enabled: - if ((frills_on == false) || (((current_ground == 2) || (current_ground == 36)) && (PSD[SDF_COMPATIBILITY_FULL_TRIMS] == 0))) + if (!frills_on || (((current_ground == 2) || (current_ground == 36)) && (PSD[SDF_COMPATIBILITY_FULL_TRIMS] == 0))) return; */ // which_trim @@ -1238,7 +1238,7 @@ void draw_trim(short q,short r,short which_trim,ter_num_t ground_ter) } sf::Color test_color = {0,0,0}, store_color; - if (frills_on == false) + if (!frills_on) return; // if current ground is grass, forget trim @@ -1508,13 +1508,13 @@ void boom_space(location where,short mode,short type,short damage,short sound) //sound_key = type / 10; //type = type % 10; -// if ((cartoon_happening == true) && (anim_step < 140)) +// if ((cartoon_happening) && (anim_step < 140)) // return; if ((mode != 100) && (party_can_see(where) == 6)) return; if ((type < 0) || (type > 4)) return; - if ((boom_anim_active == true) && (type != 3)) + if ((boom_anim_active) && (type != 3)) return; if ((PSD[SDF_NO_FRILLS] > 0) && fast_bang) return; @@ -1522,7 +1522,7 @@ void boom_space(location where,short mode,short type,short damage,short sound) return; // Redraw terrain in proper position - if ((((point_onscreen(center,where) == false) && (overall_mode >= MODE_COMBAT)) || (overall_mode == MODE_OUTDOORS)) + if (((!point_onscreen(center,where) && (overall_mode >= MODE_COMBAT)) || (overall_mode == MODE_OUTDOORS)) ) { play_sound(sound_to_play[sound]); @@ -1581,7 +1581,7 @@ void boom_space(location where,short mode,short type,short damage,short sound) if (fast_bang == 0 && !skip_boom_delay) { del_len = PSD[SDF_GAME_SPEED] * 3 + 4; - if (play_sounds == false) + if (!play_sounds) sf::sleep(time_in_ticks(del_len)); } redraw_terrain(); @@ -1603,7 +1603,7 @@ void draw_pointing_arrows() RECT{346,100,354,108},RECT{346,170,354,178},RECT{140,274,148,282},RECT{212,274,220,282}}; short i; - if ((monsters_going == true) || /*(overall_mode <= MODE_TOWN) ||*/ (overall_mode <= MODE_COMBAT) + if ((monsters_going) || /*(overall_mode <= MODE_TOWN) ||*/ (overall_mode <= MODE_COMBAT) || (overall_mode == MODE_LOOK_OUTDOORS)) return; for (i = 0; i < 4; i++) { @@ -1633,11 +1633,11 @@ void draw_targets(location center) RECT source_rect = {74,36,85,47},dest_rect; short i = 0; - if (party_toast() == true) + if (party_toast()) return; for (i = 0; i < 8; i++) - if ((spell_targets[i].x != 120) && (point_onscreen(center,spell_targets[i]) == true)) { + if ((spell_targets[i].x != 120) && (point_onscreen(center,spell_targets[i]))) { dest_rect = coord_to_rect(spell_targets[i].x - center.x + 4,spell_targets[i].y - center.y + 4); //OffsetRect(&dest_rect,5,5); //InsetRect(&dest_rect,8,12); @@ -1651,7 +1651,7 @@ void frame_space(location where,short mode,short width,short height) location where_put; RECT to_frame; - if (point_onscreen(center,where) == false) + if (!point_onscreen(center,where)) return; where_put.x = 4 + where.x - center.x; @@ -1692,7 +1692,7 @@ void draw_targeting_line(location where_curs) on_screen_terrain_area.offset(ul); if (where_curs.in(on_screen_terrain_area)) { - // && (point_onscreen(center,univ.party[current_pc].combat_pos) == true)){ + // && (point_onscreen(center,univ.party[current_pc].combat_pos))){ i = (where_curs.x - 23 - ul.x) / 28; j = (where_curs.y - 23 - ul.y) / 36; which_space.x = center.x + (short) i - 4; diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index d5563a4a..7d990e8f 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -169,8 +169,8 @@ void draw_monsters() //// if (is_out()) for (i = 0; i < 10; i++) - if (univ.party.out_c[i].exists == true) { - if ((point_onscreen(univ.party.p_loc, univ.party.out_c[i].m_loc) == true) && + if (univ.party.out_c[i].exists) { + if ((point_onscreen(univ.party.p_loc, univ.party.out_c[i].m_loc)) && (can_see_light(univ.party.p_loc, univ.party.out_c[i].m_loc,sight_obscurity) < 5)) { where_draw.x = univ.party.out_c[i].m_loc.x - univ.party.p_loc.x + 4; where_draw.y = univ.party.out_c[i].m_loc.y - univ.party.p_loc.y + 4; @@ -334,9 +334,9 @@ void draw_pcs(location center,short mode) RECT source_rect,active_pc_rect; location where_draw; - if (party_toast() == true) + if (party_toast()) return; - if (can_draw_pcs == false) + if (!can_draw_pcs) return; for (i = 0; i < 6; i++) @@ -355,7 +355,7 @@ void draw_pcs(location center,short mode) Draw_Some_Item(pc_gworld, source_rect, terrain_screen_gworld, where_draw, 1, 0); } - if ((current_pc == i) && (mode == 1) && (monsters_going == false)) { + if ((current_pc == i) && (mode == 1) && !monsters_going) { active_pc_rect.top = 18 + where_draw.y * 36; active_pc_rect.left = 18 + where_draw.x * 28; active_pc_rect.bottom = 54 + where_draw.y * 36; @@ -418,7 +418,7 @@ void draw_outd_boats(location center) short i; for (i = 0; i < 30; i++) - if ((point_onscreen(center, univ.party.boats[i].loc) == true) && (univ.party.boats[i].exists == true) && + if ((point_onscreen(center, univ.party.boats[i].loc)) && (univ.party.boats[i].exists) && (univ.party.boats[i].which_town == 200) && (can_see_light(center, univ.party.boats[i].loc,sight_obscurity) < 5) && (univ.party.in_boat != i)) { where_draw.x = univ.party.boats[i].loc.x - center.x + 4; @@ -428,7 +428,7 @@ void draw_outd_boats(location center) Draw_Some_Item(vehicle_gworld, calc_rect(0,0), terrain_screen_gworld, where_draw, 1, 0); } for (i = 0; i < 30; i++) - if ((point_onscreen(center, univ.party.horses[i].loc) == true) && (univ.party.horses[i].exists == true) && + if ((point_onscreen(center, univ.party.horses[i].loc)) && (univ.party.horses[i].exists) && (univ.party.horses[i].which_town == 200) && (can_see_light(center, univ.party.horses[i].loc,sight_obscurity) < 5) && (univ.party.in_horse != i)) { where_draw.x = univ.party.horses[i].loc.x - center.x + 4; @@ -449,9 +449,9 @@ void draw_town_boat(location center) for (i = 0; i < 30; i++) if ((univ.party.boats[i].which_town == univ.town.num) && - ((point_onscreen(center, univ.party.boats[i].loc) == true) && + ((point_onscreen(center, univ.party.boats[i].loc)) && (can_see_light(center, univ.party.boats[i].loc,sight_obscurity) < 5) && (univ.party.in_boat != i) - && (pt_in_light(center,univ.party.boats[i].loc) == true))) { + && (pt_in_light(center,univ.party.boats[i].loc)))) { where_draw.x = univ.party.boats[i].loc.x - center.x + 4; where_draw.y = univ.party.boats[i].loc.y - center.y + 4; //source_rect = boat_rects[0]; @@ -460,9 +460,9 @@ void draw_town_boat(location center) } for (i = 0; i < 30; i++) if ((univ.party.horses[i].which_town == univ.town.num) && - ((point_onscreen(center, univ.party.horses[i].loc) == true) && + ((point_onscreen(center, univ.party.horses[i].loc)) && (can_see_light(center, univ.party.horses[i].loc,sight_obscurity) < 5) && (univ.party.in_horse != i) - && (pt_in_light(center,univ.party.horses[i].loc) == true))) { + && (pt_in_light(center,univ.party.horses[i].loc)))) { where_draw.x = univ.party.horses[i].loc.x - center.x + 4; where_draw.y = univ.party.horses[i].loc.y - center.y + 4; //source_rect = boat_rects[0]; @@ -540,9 +540,9 @@ void draw_party_symbol(location center) { location target(4,4); short i = 0; - if (can_draw_pcs == false) + if (!can_draw_pcs) return; - if (party_toast() == true) + if (party_toast()) return; if ((is_town()) && (univ.town.p_loc.x > 70)) return; @@ -645,7 +645,7 @@ bool is_fluid(ter_num_t ter_type)//// // Is this a beach that gets shore plopped down next to it? bool is_shore(ter_num_t ter_type)//// { - if (is_fluid(ter_type) == true) + if (is_fluid(ter_type)) return false; if(scenario.ter_types[ter_type].trim_type == eTrimType::WATERFALL) return false; @@ -710,45 +710,45 @@ char get_fluid_trim(location where,ter_num_t ter_type) } // Set up trim for fluids - if (is_fluid(ter_type) == true) { - if (at_left == false) { + if (is_fluid(ter_type)) { + if (!at_left) { store = coord_to_ter(where.x - 1,where.y); - if (is_shore(store) == true) + if (is_shore(store)) to_return |= 64; } - if (at_right == false) { + if (!at_right) { store = coord_to_ter(where.x + 1,where.y); - if (is_shore(store) == true) + if (is_shore(store)) to_return |= 4; } - if (at_top == false) { + if (!at_top) { store = coord_to_ter(where.x,where.y - 1); - if (is_shore(store) == true) + if (is_shore(store)) to_return |= 1; } - if (at_bot == false) { + if (!at_bot) { store = coord_to_ter(where.x,where.y + 1); - if (is_shore(store) == true) + if (is_shore(store)) to_return |= 16; } - if ((at_left == false) && (at_top == false)) { + if ((!at_left) && (!at_top)) { store = coord_to_ter(where.x - 1,where.y - 1); - if (is_shore(store) == true) + if (is_shore(store)) to_return |= 128; } - if ((at_right == false) && (at_bot == false)) { + if ((!at_right) && (!at_bot)) { store = coord_to_ter(where.x + 1,where.y + 1); - if (is_shore(store) == true) + if (is_shore(store)) to_return |= 8; } - if ((at_right == false) && (at_top == false)) { + if ((!at_right) && (!at_top)) { store = coord_to_ter(where.x + 1,where.y - 1); - if (is_shore(store) == true) + if (is_shore(store)) to_return |= 2; } - if ((at_left == false) && (at_bot == false)) { + if ((!at_left) && (!at_bot)) { store = coord_to_ter(where.x - 1,where.y + 1); - if (is_shore(store) == true) + if (is_shore(store)) to_return |= 32; } } diff --git a/osx/boe.infodlg.cpp b/osx/boe.infodlg.cpp index c9a3668b..200dc59c 100644 --- a/osx/boe.infodlg.cpp +++ b/osx/boe.infodlg.cpp @@ -494,7 +494,7 @@ void display_monst(short array_pos,cCreature *which_m,short mode) monstInfo.attachClickHandlers(event_filter, {"immune1", "immune2", "immune3", "immune4"}); monstInfo.attachClickHandlers(event_filter, {"immune5", "immune6", "immune7", "immune8"}); - if (full_roster == false) { + if (!full_roster) { monstInfo["left"].hide(); monstInfo["right"].hide(); } @@ -603,7 +603,7 @@ static void display_pc_info(cDialog& me, const short pc) { // Fight bonuses for (i = 0; i < 24; i++) if ((univ.party[pc].items[i].variety == eItemType::ONE_HANDED || univ.party[pc].items[i].variety == eItemType::TWO_HANDED) && - (univ.party[pc].equip[i] == true)) { + (univ.party[pc].equip[i])) { if (weap1 == 24) weap1 = i; else weap2 = i; @@ -995,7 +995,7 @@ static void give_help(short help1,short help2,cDialog* parent) help_forced = true; help1 -= 200; } - if ((PSD[SDF_NO_INSTANT_HELP] > 0) && (help_forced == false)) + if ((PSD[SDF_NO_INSTANT_HELP] > 0) && !help_forced) return; if (univ.party.help_received[help1] > 0) return; diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index b0bc9213..351eadea 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -84,7 +84,7 @@ void sort_pc_items(short pc_num) bool no_swaps = false,store_equip; short i; - while (no_swaps == false) { + while (!no_swaps) { no_swaps = true; for (i = 0; i < 23; i++) if (item_priority[univ.party[pc_num].items[i + 1].variety] < @@ -135,7 +135,7 @@ bool give_to_pc(short pc_num,cItemRec item,short print_result,bool allow_overl } if(!allow_overload && item.item_weight() > amount_pc_can_carry(pc_num) - pc_carry_weight(pc_num)) { - if (print_result == true) { + if (print_result) { beep(); // TODO: This is a game event, so it should have a game sound, not a system alert. ASB("Item too heavy to carry."); } @@ -157,7 +157,7 @@ bool give_to_pc(short pc_num,cItemRec item,short print_result,bool allow_overl if (!item.ident) sprintf((char *) announce_string," %s gets %s.",univ.party[pc_num].name.c_str(),item.name.c_str()); else sprintf((char *) announce_string," %s gets %s.",univ.party[pc_num].name.c_str(),item.full_name.c_str()); - if (print_result == true) + if (print_result) add_string_to_buf((char *)announce_string); } @@ -215,7 +215,7 @@ void give_gold(short amount,bool print_result)//// { if (amount < 0) return; univ.party.gold = univ.party.gold + amount; - if (print_result == true) + if (print_result) put_pc_screen(); } @@ -224,7 +224,7 @@ bool take_gold(short amount,bool print_result) if (univ.party.gold < amount) return false; univ.party.gold = univ.party.gold - amount; - if (print_result == true) + if (print_result) put_pc_screen(); return true; } @@ -235,7 +235,7 @@ short get_prot_level(short pc_num,eItemAbil abil) { for (i = 0; i < 24; i++) if(univ.party[pc_num].items[i].variety != eItemType::NO_ITEM && (univ.party[pc_num].items[i].ability == abil) - && (univ.party[pc_num].equip[i] == true)) + && (univ.party[pc_num].equip[i])) return univ.party[pc_num].items[i].ability_strength; return -1; @@ -245,7 +245,7 @@ short pc_has_abil_equip(short pc_num,eItemAbil abil) { short i = 0; while((univ.party[pc_num].items[i].variety == eItemType::NO_ITEM || univ.party[pc_num].items[i].ability != abil - || (univ.party[pc_num].equip[i] == false)) && (i < 24)) + || !univ.party[pc_num].equip[i]) && (i < 24)) i++; return i; @@ -335,7 +335,7 @@ void give_food(short amount,bool print_result)//// { if (amount < 0) return; univ.party.food = univ.party.food + amount; - if (print_result == true) + if (print_result) put_pc_screen(); } @@ -346,13 +346,13 @@ short take_food(short amount,bool print_result) diff = amount - univ.party.food; if (diff > 0) { univ.party.food = 0; - if (print_result == true) + if (print_result) put_pc_screen(); return diff; } univ.party.food = univ.party.food - amount; - if (print_result == true) + if (print_result) put_pc_screen(); return 0; } @@ -388,7 +388,7 @@ short pc_ok_to_buy(short pc_num,short cost,cItemRec item) //// return 4; } } - if (take_gold(cost,false) == false) + if (!take_gold(cost,false)) return 3; return 1; @@ -420,7 +420,7 @@ void take_item(short pc_num,short which_item) univ.party[pc_num].items[23] = cItemRec(); univ.party[pc_num].equip[23] = false; - if ((stat_window == pc_num) && (do_print == true)) + if ((stat_window == pc_num) && (do_print)) put_item_screen(stat_window,1); } @@ -512,7 +512,7 @@ void equip_item(short pc_num,short item_num) else { // unequip - if (univ.party[pc_num].equip[item_num] == true) { + if (univ.party[pc_num].equip[item_num]) { if (univ.party[pc_num].equip[item_num] && univ.party[pc_num].items[item_num].cursed) add_string_to_buf("Equip: Item is cursed. "); else { @@ -530,7 +530,7 @@ void equip_item(short pc_num,short item_num) add_string_to_buf("Equip: Can't equip this item."); else { for (i = 0; i < 24; i++) - if (univ.party[pc_num].equip[i] == true) { + if (univ.party[pc_num].equip[i]) { if (univ.party[pc_num].items[i].variety == univ.party[pc_num].items[item_num].variety) num_equipped_of_this_type++; num_hands_occupied = num_hands_occupied + num_hands_to_use.count(univ.party[pc_num].items[i].variety); @@ -541,7 +541,7 @@ void equip_item(short pc_num,short item_num) // Now if missile is already equipped, no more missiles if (equip_item_type > 0) { for (i = 0; i < 24; i++) - if ((univ.party[pc_num].equip[i] == true) && (excluding_types[univ.party[pc_num].items[i].variety] == equip_item_type)) { + if ((univ.party[pc_num].equip[i]) && (excluding_types[univ.party[pc_num].items[i].variety] == equip_item_type)) { add_string_to_buf("Equip: You have something of"); add_string_to_buf(" this type equipped."); return; @@ -604,7 +604,7 @@ void drop_item(short pc_num,short item_num,location where_drop) take_given_item = false; item_store.charges = how_many; } - if (is_container(loc) == true) + if (is_container(loc)) item_store.contained = true; if (!place_item(item_store,loc,false)) { add_string_to_buf("Drop: Too many items on ground"); @@ -635,7 +635,7 @@ bool place_item(cItemRec item,location where,bool forced) reset_item_max(); return true; } - if (forced == false) + if (!forced) return false; destroy_an_item(); for (i = 0; i < NUM_TOWN_ITEMS; i++) @@ -689,13 +689,13 @@ void give_thing(short pc_num, short item_num) else { item_store = univ.party[pc_num].items[item_num]; who_to = char_select_pc(1,1,"Give item to who?"); - if ((overall_mode == MODE_COMBAT) && (adjacent(univ.party[pc_num].combat_pos,univ.party[who_to].combat_pos) == false)) { + if ((overall_mode == MODE_COMBAT) && !adjacent(univ.party[pc_num].combat_pos,univ.party[who_to].combat_pos)) { add_string_to_buf("Give: Must be adjacent."); who_to = 6; } if ((who_to < 6) && (who_to != pc_num) - && ((overall_mode != MODE_COMBAT) || (adjacent(univ.party[pc_num].combat_pos,univ.party[who_to].combat_pos) == true))) { + && ((overall_mode != MODE_COMBAT) || (adjacent(univ.party[pc_num].combat_pos,univ.party[who_to].combat_pos)))) { if ((item_store.type_flag > 0) && (item_store.charges > 1)) { how_many = get_num_of_items(item_store.charges); if (how_many == 0) @@ -705,7 +705,7 @@ void give_thing(short pc_num, short item_num) univ.party[pc_num].items[item_num].charges -= how_many; item_store.charges = how_many; } - if (give_to_pc(who_to,item_store,0) == true) { + if (give_to_pc(who_to,item_store,0)) { if (take_given_item) take_item(pc_num,item_num); } @@ -738,7 +738,7 @@ void combine_things(short pc_num) ASB("(Can have at most 125 of any item."); } else univ.party[pc_num].items[i].charges += univ.party[pc_num].items[j].charges; - if (univ.party[pc_num].equip[j] == true) { + if (univ.party[pc_num].equip[j]) { univ.party[pc_num].equip[i] = true; univ.party[pc_num].equip[j] = false; } @@ -790,18 +790,18 @@ short get_item(location place,short pc_num,bool check_container) for (i = 0; i < NUM_TOWN_ITEMS; i++) if(univ.town.items[i].variety != eItemType::NO_ITEM) - if (((adjacent(place,univ.town.items[i].item_loc) == true) || - ((mass_get == 1) && (check_container == false) && + if (((adjacent(place,univ.town.items[i].item_loc)) || + (mass_get == 1 && !check_container && ((dist(place,univ.town.items[i].item_loc) <= 4) || ((is_combat()) && (which_combat_type == 0))) && (can_see_light(place,univ.town.items[i].item_loc,sight_obscurity) < 5))) - && ((!univ.town.items[i].contained) || (check_container == true))) { + && ((!univ.town.items[i].contained) || (check_container))) { taken = 1; if (univ.town.items[i].value < 2) univ.town.items[i].ident = true; item_near = true; } - if (item_near == true) + if (item_near) if (display_item(place,pc_num,mass_get,check_container) > 0) { // 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) @@ -1058,8 +1058,8 @@ bool display_item(location from_loc,short pc_num,short mode, bool check_containe for (i = 0; i < NUM_TOWN_ITEMS; i++) if(univ.town.items[i].variety != eItemType::NO_ITEM) { - if (((adjacent(from_loc,univ.town.items[i].item_loc) == true) || - ((mode == 1) && (check_container == false) && + if (((adjacent(from_loc,univ.town.items[i].item_loc)) || + (mode == 1 && !check_container && ((dist(from_loc,univ.town.items[i].item_loc) <= 4) || ((is_combat()) && (which_combat_type == 0))) && (can_see_light(from_loc,univ.town.items[i].item_loc,sight_obscurity) < 5))) && (univ.town.items[i].contained == check_container) && @@ -1189,7 +1189,7 @@ void custom_pic_dialog(std::string title, pic_num_t bigpic) { // if (parent < 2) { // SetPort(GetWindowPort(mainPtr)); // BeginUpdate(mainPtr); -// if (in_startup_mode == false) +// if (!in_startup_mode) // refresh_screen(0); // else draw_startup(0); // EndUpdate(mainPtr); diff --git a/osx/boe.locutils.cpp b/osx/boe.locutils.cpp index 78b8d03b..d3c3fec3 100644 --- a/osx/boe.locutils.cpp +++ b/osx/boe.locutils.cpp @@ -288,8 +288,8 @@ void update_explored(location dest) make_explored(dest.x,dest.y); for (look2.x = max(0,dest.x - 4); look2.x < min(univ.town->max_dim(),dest.x + 5); look2.x++) for (look2.y = max(0,dest.y - 4); look2.y < min(univ.town->max_dim(),dest.y + 5); look2.y++) - if (is_explored(look2.x,look2.y) == false) - if ((can_see_light(dest, look2,sight_obscurity) < 5) && (pt_in_light(dest,look2) == true)) + if (!is_explored(look2.x,look2.y)) + if ((can_see_light(dest, look2,sight_obscurity) < 5) && (pt_in_light(dest,look2))) make_explored(look2.x,look2.y); } } @@ -302,13 +302,13 @@ bool is_blocked(location to_check) ter_num_t ter; if (is_out()) { - if (impassable(univ.out[to_check.x][to_check.y]) == true) { + if (impassable(univ.out[to_check.x][to_check.y])) { return true; } if (to_check == univ.party.p_loc) return true; for (i = 0; i < 20; i++) - if ((univ.party.out_c[i].exists) == true) + if ((univ.party.out_c[i].exists)) if (univ.party.out_c[i].m_loc == to_check) return true; return false; @@ -320,7 +320,7 @@ bool is_blocked(location to_check) //// // Terrain blocking? - if (impassable(ter) == true) { + if (impassable(ter)) { return true; } @@ -374,7 +374,7 @@ short monst_there(location where) // returns 90 if no short i; for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst[i].active != 0) && (monst_on_space(where,i) == true)) + if ((univ.town.monst[i].active != 0) && (monst_on_space(where,i))) return i; return 90; } @@ -389,8 +389,8 @@ bool monst_can_be_there(location loc,short m_num) for (i = 0; i < univ.town.monst[m_num].x_width; i++) for (j = 0; j < univ.town.monst[m_num].y_width; j++) { destination.x = loc.x + i; destination.y = loc.y + j; - if ((is_blocked(destination) == true) - || (loc_off_act_area(destination) == true)) { + if ((is_blocked(destination)) + || (loc_off_act_area(destination))) { univ.town.monst[m_num].cur_loc.x -= 100; return false; } @@ -408,7 +408,7 @@ bool monst_adjacent(location loc,short m_num) for (j = 0; j < univ.town.monst[m_num].y_width; j++) { destination.x = univ.town.monst[m_num].cur_loc.x + i; destination.y = univ.town.monst[m_num].cur_loc.y + j; - if (adjacent(destination,loc) == true) + if (adjacent(destination,loc)) return true; } return false; @@ -464,11 +464,11 @@ bool outd_is_blocked(location to_check) short i; if (overall_mode == MODE_OUTDOORS) { - if (impassable(univ.out[to_check.x][to_check.y]) == true) { + if (impassable(univ.out[to_check.x][to_check.y])) { return true; } for (i = 0; i < 10; i++) - if ((univ.party.out_c[i].exists) == true) + if ((univ.party.out_c[i].exists)) if (univ.party.out_c[i].m_loc == to_check) return true; return false; @@ -488,7 +488,7 @@ bool is_special(location to_check) { ter_num_t which_ter; - if (special_which_blocks_monst(to_check) == false) + if (!special_which_blocks_monst(to_check)) return false; which_ter = coord_to_ter(to_check.x,to_check.y); if(scenario.ter_types[which_ter].blockage == eTerObstruct::BLOCK_MONSTERS) @@ -594,7 +594,7 @@ bool party_sees_a_monst() // Returns true is a hostile monster is in sight. for (i = 0; i < univ.town->max_monst(); i++) { if (univ.town.monst[i].active > 0) if ((univ.town.monst[i].attitude == 1) && - (party_can_see_monst(i) == true)) + (party_can_see_monst(i))) return true; } @@ -608,12 +608,12 @@ short party_can_see(location where) short i; if (is_out()) { - if ((point_onscreen(univ.party.p_loc,where) == true) && (can_see_light(univ.party.p_loc,where,sight_obscurity) < 5)) + if ((point_onscreen(univ.party.p_loc,where)) && (can_see_light(univ.party.p_loc,where,sight_obscurity) < 5)) return 1; else return 6; } if (is_town()) { - if ( ((point_onscreen(univ.town.p_loc,where) == true) || (overall_mode == MODE_LOOK_TOWN)) && (pt_in_light(univ.town.p_loc,where) == true) + if ( ((point_onscreen(univ.town.p_loc,where)) || (overall_mode == MODE_LOOK_TOWN)) && (pt_in_light(univ.town.p_loc,where) ) && (can_see_light(univ.town.p_loc,where,sight_obscurity) < 5)) return 1; else return 6; @@ -621,7 +621,7 @@ short party_can_see(location where) // Now for combat checks. Doing separately for efficiency. Check first for light. If // dark, give up. - if ((which_combat_type != 0) && (combat_pt_in_light(where) == false)) + if ((which_combat_type != 0) && !combat_pt_in_light(where)) return 6; for (i = 0; i < 6; i++) @@ -650,7 +650,7 @@ location push_loc(location from_where,location to_where) } if(sight_obscurity(loc_to_try.x,loc_to_try.y) > 0 || scenario.ter_types[univ.town->terrain(loc_to_try.x,loc_to_try.y)].blockage != eTerObstruct::CLEAR || - (loc_off_act_area(loc_to_try) == true) || + (loc_off_act_area(loc_to_try)) || (monst_there(loc_to_try) < 90) || (pc_there(loc_to_try) < 6)) return from_where; diff --git a/osx/boe.main.cpp b/osx/boe.main.cpp index 7446cfea..d3205002 100644 --- a/osx/boe.main.cpp +++ b/osx/boe.main.cpp @@ -190,7 +190,7 @@ int main(int /*argc*/, char* argv[]) { menu_activate(); restore_cursor(); - while (All_Done == false) + while (!All_Done) Handle_One_Event(); close_program(); @@ -268,7 +268,7 @@ void Handle_One_Event() Handle_Update(); //(cur_time - last_anim_time > 42) - if((animTimer.getElapsedTime().asMilliseconds() >= fortyTicks) && (overall_mode != MODE_STARTUP) && (anim_onscreen == true) && (PSD[SDF_NO_TER_ANIM] == 0) + if((animTimer.getElapsedTime().asMilliseconds() >= fortyTicks) && (overall_mode != MODE_STARTUP) && (anim_onscreen) && (PSD[SDF_NO_TER_ANIM] == 0) && (!gInBackground)) { animTimer.restart(); draw_terrain(); @@ -360,7 +360,7 @@ void Handle_One_Event() #if 0 else { for (i = 0; i < 18; i++) - if ((the_window == GetDialogWindow(modeless_dialogs[i])) && (modeless_exists[i] == true)) { + if ((the_window == GetDialogWindow(modeless_dialogs[i])) && (modeless_exists[i])) { //CloseDialog(modeless_dialogs[i]); HideWindow(GetDialogWindow(modeless_dialogs[i])); modeless_exists[i] = false; @@ -530,7 +530,7 @@ void handle_options_menu(int item_hit) break; case 4: - if (prime_time() == false) { + if (!prime_time()) { ASB("Finish what you're doing first."); print_buf(); } @@ -655,7 +655,7 @@ void handle_actions_menu(int item_hit) handle_keystroke(dummyEvent); break; case 3: - if (prime_time() == false) { + if (!prime_time()) { ASB("Finish what you're doing first."); print_buf(); } @@ -770,12 +770,12 @@ void move_sound(ter_num_t ter,short step){ on_swamp = true; }else on_swamp = false; - if ((monsters_going == false) && (overall_mode < MODE_COMBAT) && (univ.party.in_boat >= 0)) {// is on boat ? + if (!monsters_going && (overall_mode < MODE_COMBAT) && (univ.party.in_boat >= 0)) {// is on boat ? if(spec == eTerSpec::TOWN_ENTRANCE) return; play_sound(48); //play boat sound } - else if ((monsters_going == false) && (overall_mode < MODE_COMBAT) && (univ.party.in_horse >= 0)) {//// is on horse ? + else if (!monsters_going && (overall_mode < MODE_COMBAT) && (univ.party.in_horse >= 0)) {//// is on horse ? play_sound(85); //so play horse sound } else switch(scenario.ter_types[ter].step_sound){ diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index 8c726853..1a575604 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -85,7 +85,7 @@ short out_enc_lev_tot(short which) short count = 0,i; short num[7] = {22,8,4,4,3,2,1}; - if (univ.party.out_c[which].what_monst.cant_flee == true) + if (univ.party.out_c[which].what_monst.cant_flee) return 10000; for (i = 0; i < 7; i++) @@ -143,8 +143,8 @@ void place_outd_wand_monst(location where,cOutdoors::cWandering group,short forc while (i < 10) { //// - if ((univ.party.out_c[i].exists == false) || ((i == 9) && (forced > 0))) { - if ((sd_legit(group.end_spec1,group.end_spec2) == true) && (PSD[group.end_spec1][group.end_spec2] > 0)) + if (!univ.party.out_c[i].exists || ((i == 9) && (forced > 0))) { + if ((sd_legit(group.end_spec1,group.end_spec2)) && (PSD[group.end_spec1][group.end_spec2] > 0)) return; univ.party.out_c[i].exists = true; univ.party.out_c[i].direction = 0; @@ -156,7 +156,7 @@ void place_outd_wand_monst(location where,cOutdoors::cWandering group,short forc if (univ.party.out_c[i].which_sector.y == 1) univ.party.out_c[i].m_loc.y += 48; l = univ.party.out_c[i].m_loc; - while ((forced == true) && (is_blocked(l)) && (j < 50)) { + while ((forced) && (is_blocked(l)) && (j < 50)) { l = univ.party.out_c[i].m_loc; l.x += get_ran(1,0,2) - 1; l.y += get_ran(1,0,2) - 1; @@ -288,7 +288,7 @@ void do_monsters() if (get_ran(1,0,10) < 6) univ.town.monst[i].morale++; } - else if (monst_hate_spot(i,&l2) == true) + else if (monst_hate_spot(i,&l2)) acted_yet = seek_party(i,l1,l2); else if (((univ.town.monst[i].mu == 0) && (univ.town.monst[i].mu == 0)) || (can_see_light(l1,l2,sight_obscurity) > 3)) @@ -314,14 +314,14 @@ void do_monsters() } for (j = 0; j < univ.town->max_monst(); j++) if ((univ.town.monst[j].active == 2) - && ((dist(univ.town.monst[i].cur_loc,univ.town.monst[j].cur_loc) <= 5) == true)) + && ((dist(univ.town.monst[i].cur_loc,univ.town.monst[j].cur_loc) <= 5))) univ.town.monst[i].active = 2; } } if (overall_mode == MODE_OUTDOORS) { for (i = 0; i < 10; i++) - if (univ.party.out_c[i].exists == true) { + if (univ.party.out_c[i].exists) { acted_yet = false; l1 = univ.party.out_c[i].m_loc; l2 = univ.party.p_loc; @@ -387,15 +387,15 @@ short monst_pick_target(short which_m) if ((is_combat()) && (cur_monst->attitude % 2 == 1)) { if (spell_caster < 6) - if ((get_ran(1,1,5) < 5) && (monst_can_see(which_m,univ.party[spell_caster].combat_pos) == true) + if ((get_ran(1,1,5) < 5) && (monst_can_see(which_m,univ.party[spell_caster].combat_pos)) && univ.party[spell_caster].main_status == eMainStatus::ALIVE) return spell_caster; if (missile_firer < 6) - if ((get_ran(1,1,5) < 3) && (monst_can_see(which_m,univ.party[missile_firer].combat_pos) == true) + if ((get_ran(1,1,5) < 3) && (monst_can_see(which_m,univ.party[missile_firer].combat_pos)) && univ.party[missile_firer].main_status == eMainStatus::ALIVE) return missile_firer; if (univ.town.monst[which_m].target < 6) - if ((monst_can_see(which_m,univ.party[univ.town.monst[which_m].target].combat_pos) == true) + if ((monst_can_see(which_m,univ.party[univ.town.monst[which_m].target].combat_pos)) && univ.party[univ.town.monst[which_m].target].main_status == eMainStatus::ALIVE) return univ.town.monst[which_m].target; } @@ -451,7 +451,7 @@ short monst_pick_target_monst(cCreature *which_m) ((which_m->attitude % 2 == 1) && (univ.town.monst[i].attitude != which_m->attitude))) && // they hate each other ((dist(which_m->cur_loc,univ.town.monst[i].cur_loc) < min_dist) || ((dist(which_m->cur_loc,univ.town.monst[i].cur_loc) == min_dist) && (get_ran(1,0,7) < 4))) && - (monst_can_see(i,univ.town.monst[i].cur_loc) == true) ) { + (monst_can_see(i,univ.town.monst[i].cur_loc)) ) { min_dist = dist(which_m->cur_loc,univ.town.monst[i].cur_loc); cur_targ = i + 100; @@ -472,7 +472,7 @@ short monst_pick_target_pc(short m_num,cCreature *which_m)//// // First pick any visible, nearby PC r1 = get_ran(1,0,5); while(num_tries < 6 && (univ.party[r1].main_status != eMainStatus::ALIVE || - (monst_can_see(m_num,univ.party[r1].combat_pos) == false))) { + !monst_can_see(m_num,univ.party[r1].combat_pos))) { r1 = get_ran(1,0,5); num_tries++; } @@ -483,7 +483,7 @@ short monst_pick_target_pc(short m_num,cCreature *which_m)//// r1 = get_ran(1,0,5); while(num_tries < 6 && (univ.party[r1].main_status != eMainStatus::ALIVE || (dist(which_m->cur_loc,univ.party[r1].combat_pos) > 4) || - (monst_can_see(m_num,univ.party[r1].combat_pos) == false))) { + !monst_can_see(m_num,univ.party[r1].combat_pos))) { r1 = get_ran(1,0,5); num_tries++; } @@ -543,18 +543,18 @@ short switch_target_to_adjacent(short which_m,short orig_target) if (univ.town.monst[which_m].attitude % 2 == 0) { if (orig_target >= 100) if ((univ.town.monst[orig_target - 100].active > 0) && - (monst_adjacent(univ.town.monst[orig_target - 100].cur_loc,which_m) == true)) + (monst_adjacent(univ.town.monst[orig_target - 100].cur_loc,which_m))) return orig_target; for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst[i].active > 0) && (univ.town.monst[i].attitude % 2 == 1) && - (monst_adjacent(univ.town.monst[i].cur_loc,which_m) == true)) + (monst_adjacent(univ.town.monst[i].cur_loc,which_m))) return i + 100; return orig_target; } // If we get here while in town, just need to check if switch to pc - if ((is_town()) && (monst_adjacent(univ.town.p_loc,which_m) == true)) + if ((is_town()) && (monst_adjacent(univ.town.p_loc,which_m))) return 0; if (is_town()) return orig_target; @@ -565,7 +565,7 @@ short switch_target_to_adjacent(short which_m,short orig_target) return orig_target; if (orig_target >= 100) if ((univ.town.monst[orig_target - 100].active > 0) && - (monst_adjacent(univ.town.monst[orig_target - 100].cur_loc,which_m) == true)) + (monst_adjacent(univ.town.monst[orig_target - 100].cur_loc,which_m))) return orig_target; // Anyone unarmored? Heh heh heh... @@ -579,7 +579,7 @@ short switch_target_to_adjacent(short which_m,short orig_target) for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst[i].active > 0) && (univ.town.monst[i].attitude % 2 == 0) && - (monst_adjacent(univ.town.monst[i].cur_loc,which_m) == true) && + (monst_adjacent(univ.town.monst[i].cur_loc,which_m)) && (get_ran(1,0,2) < 2)) return i + 100; @@ -622,13 +622,13 @@ bool rand_move(char i) if (univ.town.monst[i].targ_loc.x > 0) acted_yet = seek_party(i,univ.town.monst[i].cur_loc,univ.town.monst[i].targ_loc); - if (acted_yet == false) { + if (!acted_yet) { univ.town.monst[i].targ_loc.x = 0; for (j = 0; j < 3; j++) { store_loc = univ.town.monst[i].cur_loc; store_loc.x += get_ran(1,0,24) - 12; store_loc.y += get_ran(1,0,24) - 12; - if ((loc_off_act_area(store_loc) == false) && (can_see_light(univ.town.monst[i].cur_loc,store_loc,sight_obscurity) < 5)) { + if (!loc_off_act_area(store_loc) && (can_see_light(univ.town.monst[i].cur_loc,store_loc,sight_obscurity) < 5)) { univ.town.monst[i].targ_loc = store_loc; j = 3; } } @@ -638,13 +638,13 @@ bool rand_move(char i) j = get_ran(1,0,3); store_loc = univ.town->wandering_locs[j]; - if ((loc_off_act_area(store_loc) == false) && (get_ran(1,0,1) == 1)) + if (!loc_off_act_area(store_loc) && (get_ran(1,0,1) == 1)) univ.town.monst[i].targ_loc = store_loc; else { store_loc = univ.town.monst[i].cur_loc; store_loc.x += get_ran(1,0,20) - 10; store_loc.y += get_ran(1,0,20) - 10; - if (loc_off_act_area(store_loc) == false) + if (!loc_off_act_area(store_loc)) univ.town.monst[i].targ_loc = store_loc; } } @@ -665,21 +665,21 @@ bool seek_party(short i,location l1,location l2) short m,n; if ((l1.x > l2.x) && (l1.y > l2.y)) acted_yet = try_move(i,l1,-1,-1); - if ((l1.x < l2.x) & (l1.y < l2.y) & (acted_yet == false)) + if ((l1.x < l2.x) & (l1.y < l2.y) & !acted_yet) acted_yet = try_move(i,l1,1,1); - if ((l1.x > l2.x) & (l1.y < l2.y) & (acted_yet == false)) + if ((l1.x > l2.x) & (l1.y < l2.y) & !acted_yet) acted_yet = try_move(i,l1,-1,1); - if ((l1.x < l2.x) & (l1.y > l2.y) & (acted_yet == false)) + if ((l1.x < l2.x) & (l1.y > l2.y) & !acted_yet) acted_yet = try_move(i,l1,1,-1); - if ((l1.x > l2.x) & (acted_yet == false)) + if ((l1.x > l2.x) & !acted_yet) acted_yet = try_move(i,l1,-1,0); - if ((l1.x < l2.x) & (acted_yet == false)) + if ((l1.x < l2.x) & !acted_yet) acted_yet = try_move(i,l1,1,0); - if ( (l1.y < l2.y) & (acted_yet == false)) + if ( (l1.y < l2.y) & !acted_yet) acted_yet = try_move(i,l1,0,1); - if ( (l1.y > l2.y) & (acted_yet == false)) + if ( (l1.y > l2.y) & !acted_yet) acted_yet = try_move(i,l1,0,-1); - if (acted_yet == false) { + if (!acted_yet) { futzing++; m = get_ran(1,0,2) - 1; n = get_ran(1,0,2) - 1; @@ -694,21 +694,21 @@ bool flee_party(short i,location l1,location l2) if ((l1.x > l2.x) & (l1.y > l2.y)) acted_yet = try_move(i,l1,1,1); - if ((l1.x < l2.x) & (l1.y < l2.y) & (acted_yet == false)) + if ((l1.x < l2.x) & (l1.y < l2.y) & !acted_yet) acted_yet = try_move(i,l1,-1,-1); - if ((l1.x > l2.x) & (l1.y < l2.y) & (acted_yet == false)) + if ((l1.x > l2.x) & (l1.y < l2.y) & !acted_yet) acted_yet = try_move(i,l1,1,-1); - if ((l1.x < l2.x) & (l1.y > l2.y) & (acted_yet == false)) + if ((l1.x < l2.x) & (l1.y > l2.y) & !acted_yet) acted_yet = try_move(i,l1,-1,+1); - if ((l1.x > l2.x) & (acted_yet == false)) + if ((l1.x > l2.x) & !acted_yet) acted_yet = try_move(i,l1,1,0); - if ((l1.x < l2.x) & (acted_yet == false)) + if ((l1.x < l2.x) & !acted_yet) acted_yet = try_move(i,l1,-1,0); - if ( (l1.y < l2.y) & (acted_yet == false)) + if ( (l1.y < l2.y) & !acted_yet) acted_yet = try_move(i,l1,0,-1); - if ( (l1.y > l2.y) & (acted_yet == false)) + if ( (l1.y > l2.y) & !acted_yet) acted_yet = try_move(i,l1,0,1); - if (acted_yet == false) { + if (!acted_yet) { futzing++; acted_yet = rand_move(i); } @@ -739,9 +739,9 @@ bool combat_move_monster(short which,location destination) { - if (monst_can_be_there(destination,which) == false) + if (!monst_can_be_there(destination,which)) return false; - else if (monst_check_special_terrain(destination,2,which) == false) + else if (!monst_check_special_terrain(destination,2,which)) return false; else { univ.town.monst[which].direction = @@ -773,13 +773,13 @@ location find_clear_spot(location from_where,short mode) loc.x = loc.x + r1; r1 = get_ran(1,-2,2); loc.y = loc.y + r1; - if ((loc_off_act_area(loc) == false) && (is_blocked(loc) == false) + if (!loc_off_act_area(loc) && !is_blocked(loc) && can_see_light(from_where,loc,combat_obscurity) == 0 && (!(is_combat()) || (pc_there(loc) == 6)) && (!(is_town()) || (loc != univ.town.p_loc)) && (!(univ.town.misc_i(loc.x,loc.y) & 248)) && // check for crate, barrel, barrier, quickfire (!(univ.town.explored(loc.x,loc.y) & 254))) { // check for fields, clouds - if ((mode == 0) || ((mode == 1) && (adjacent(from_where,loc) == true))) + if ((mode == 0) || ((mode == 1) && (adjacent(from_where,loc)))) return loc; else store_loc = loc; } @@ -811,7 +811,7 @@ location random_shift(location start) bool outdoor_move_monster(short num,location dest) { - if ((outd_is_blocked(dest) == false) && (outd_is_special(dest) == false) && + if (!outd_is_blocked(dest) && !outd_is_special(dest) && (dest != univ.party.p_loc) && ((univ.out[dest.x][dest.y] > 21) || (univ.out[dest.x][dest.y] < 5))) { univ.party.out_c[num].direction = @@ -824,10 +824,10 @@ bool outdoor_move_monster(short num,location dest) bool town_move_monster(short num,location dest) { - if (monst_check_special_terrain(dest,1,num) == false) + if (!monst_check_special_terrain(dest,1,num)) return false; - if (monst_can_be_there(dest,num) == true) { + 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].cur_loc = dest; @@ -969,12 +969,12 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon guts = 20; else guts = get_ran(1,1,(which_m->level / 2)); guts += which_m->health / 20; - if (mage == true) + if (mage) guts = guts / 2; if (which_m->attitude == 0) guts = guts / 2; - if ((univ.town.is_antimagic(where_check.x,where_check.y)) && (mage == true)) + if ((univ.town.is_antimagic(where_check.x,where_check.y)) && (mage)) return false; if ((univ.town.is_fire_wall(where_check.x,where_check.y)) && (which_m->spec_skill != 22)) { if (guts < 3) return false; @@ -1092,7 +1092,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon } // Action may change terrain, so update what's been seen - if (do_look == true) { + if (do_look) { if (is_town()) update_explored(univ.town.p_loc); if (is_combat()) @@ -1110,7 +1110,7 @@ void forced_place_monster(m_num_t which,location where) bool free_spot = false; short i = 0,r1; - while ((free_spot == false) && (i < univ.town->max_monst())) { + while (!free_spot && (i < univ.town->max_monst())) { if (univ.town.monst[i].active == 0) free_spot = true; i++; @@ -1118,7 +1118,7 @@ void forced_place_monster(m_num_t which,location where) do r1 = get_ran(1,0,59); while ((univ.town.monst[r1].spec1 != 0) || (univ.town.monst[r1].spec2 != 0)); - if (free_spot == false) + if (!free_spot) univ.town.monst[r1].active = 0; place_monster(which,where); } @@ -1414,7 +1414,7 @@ short get_encumberance(short pc_num) short store = 0,i,what_val; for (i = 0; i < 24; i++) - if (univ.party[pc_num].equip[i] == true) { + if (univ.party[pc_num].equip[i]) { what_val = univ.party[pc_num].items[i].awkward; if(what_val == 1 && get_ran(1,0,130) < hit_chance[univ.party[pc_num].skills[eSkill::DEFENSE]]) what_val--; diff --git a/osx/boe.newgraph.cpp b/osx/boe.newgraph.cpp index cf22d37d..26b0eb44 100644 --- a/osx/boe.newgraph.cpp +++ b/osx/boe.newgraph.cpp @@ -158,7 +158,7 @@ void apply_unseen_mask() for (j = 0; j < 11; j++) if (unexplored_area[i + 1][j + 1] == 1) need_bother = true; - if (need_bother == false) + if (!need_bother) return; for (i = 0; i < 11; i++) @@ -202,7 +202,7 @@ void apply_light_mask(bool onWindow) for (i = 2; i < 11; i++) for (j = 2; j < 11; j++) if (light_area[i][j] == 0) is_dark = true; - if (is_dark == false) { + if (!is_dark) { for (i = 2; i < 11; i++) for (j = 2; j < 11; j++) last_light_mask[i][j] = 0; @@ -235,7 +235,7 @@ void apply_light_mask(bool onWindow) if (last_light_mask[i][j] != light_area[i][j]) same_mask = false; - if (same_mask == true) { + if (same_mask) { return; } dark_mask_region.clear(); @@ -272,7 +272,7 @@ void start_missile_anim() { short i; - if (boom_anim_active == true) + if (boom_anim_active) return; boom_anim_active = true; for (i = 0; i < 30; i++) { @@ -296,7 +296,7 @@ void add_missile(location dest,short missile_type,short path_type,short x_adj,sh { short i; - if (boom_anim_active == false) + if (!boom_anim_active) return; if (PSD[SDF_NO_FRILLS] > 0) return; @@ -318,7 +318,7 @@ void add_missile(location dest,short missile_type,short path_type,short x_adj,sh void run_a_missile(location from,location fire_to,short miss_type,short path,short sound_num,short x_adj,short y_adj,short len) { -// if ((cartoon_happening == true) && (anim_step < 140)) +// if ((cartoon_happening) && (anim_step < 140)) // return; start_missile_anim(); add_missile(fire_to,miss_type,path, x_adj, y_adj); @@ -329,7 +329,7 @@ void run_a_missile(location from,location fire_to,short miss_type,short path,sho void run_a_boom(location boom_where,short type,short x_adj,short y_adj)//// { -// if ((cartoon_happening == true) && (anim_step < 140)) +// if ((cartoon_happening) && (anim_step < 140)) // return; if ((type < 0) || (type > 2)) return; @@ -357,7 +357,7 @@ void add_explosion(location dest,short val_to_place,short place_type,short boom_ if (PSD[SDF_NO_FRILLS] > 0) return; - if (boom_anim_active == false) + if (!boom_anim_active) return; // lose redundant explosions for (i = 0; i < 30; i++) @@ -394,7 +394,7 @@ void do_missile_anim(short num_steps,location missile_origin,short sound_num) location current_terrain_ul; sf::RenderTexture temp_gworld; - if ((have_missile == false) || (boom_anim_active == false)) { + if (!have_missile || !boom_anim_active) { boom_anim_active = false; return; } @@ -567,7 +567,7 @@ void do_explosion_anim(short /*sound_num*/,short special_draw) sf::RenderTexture temp_gworld; short boom_type_sound[3] = {5,10,53}; - if ((have_boom == false) || (boom_anim_active == false)) { + if (!have_boom || !boom_anim_active) { boom_anim_active = false; return; } @@ -709,7 +709,7 @@ void click_shop_rect(RECT area_rect) draw_shop_graphics(1,area_rect); mainPtr.display(); - if (play_sounds == true) + if (play_sounds) play_sound(37); else sf::sleep(time_in_ticks(5)); draw_shop_graphics(0,area_rect); @@ -1049,15 +1049,15 @@ cItemRec store_alchemy(short which_s) void get_item_interesting_string(cItemRec item,char *message) { - if (item.property == true) { + if (item.property) { strcpy(message,"Not yours."); return; } - if (item.ident == false) { + if (!item.ident) { strcpy(message,""); return; } - if (item.cursed == true) { + if (item.cursed) { strcpy(message,"Cursed item."); return; } diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 0affbff0..d2511b00 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -309,13 +309,13 @@ void init_party_scen_data() univ.party.horses[i] = scenario.horses[i]; for (i = 0; i < 30; i++) { if ((scenario.boats[i].which_town >= 0) && (scenario.boats[i].loc.x >= 0)) { - if (univ.party.boats[i].exists == false) { + if (!univ.party.boats[i].exists) { univ.party.boats[i] = scenario.boats[i]; univ.party.boats[i].exists = true; } } if ((scenario.horses[i].which_town >= 0) && (scenario.horses[i].loc.x >= 0)) { - if (univ.party.horses[i].exists == false) { + if (!univ.party.horses[i].exists) { univ.party.horses[i] = scenario.horses[i]; univ.party.horses[i].exists = true; } @@ -373,7 +373,7 @@ void init_party_scen_data() for (j = 0; j < NUM_TOWN_ITEMS; j++) if (univ.party.stored_items[i][j].variety != eItemType::NO_ITEM) stored_item = true; - if (stored_item == true) + if (stored_item) if(cChoiceDlog("keep-stored-items.xml", {"yes", "no"}).show() == "yes") { std::vector saved_item_refs; for (i = 0; i < 3;i++) @@ -435,7 +435,7 @@ void put_party_in_scen(std::string scen_name) item_took = true; } } - if (item_took == true) + if (item_took) cChoiceDlog("removed-special-items.xml").show(); univ.party.age = 0; for (i = 0; i < 200; i++) @@ -525,7 +525,7 @@ bool create_pc(short spot,cDialog* parent) // cd_initial_draw(989); still_ok = spend_xp(spot,0,parent); - if (still_ok == false) + if (!still_ok) return false; univ.party[spot].cur_health = univ.party[spot].max_health; univ.party[spot].cur_sp = univ.party[spot].max_sp; @@ -977,7 +977,7 @@ bool poison_weapon( short pc_num, short how_much,short safe) 91,92,93,94,94,95,95,96,97,98,100,100,100,100}; for (i = 0; i < 24; i++) - if ((univ.party[pc_num].equip[i] == true) && (is_weapon(pc_num,i) == true)) { + if ((univ.party[pc_num].equip[i]) && (is_weapon(pc_num,i))) { weap = i; i = 30; } @@ -1032,10 +1032,10 @@ void cast_spell(eSkill type) return; } - if (spell_forced == false) + if (!spell_forced) spell = pick_spell(6, type); else { - if (repeat_cast_ok(type) == false) + if (!repeat_cast_ok(type)) return; spell = type == eSkill::MAGE_SPELLS ? store_mage : store_priest; } @@ -1103,21 +1103,27 @@ void give_party_spell(short which) //// if (which < 100) for (i = 0; i < 6; i++) - if (univ.party[i].mage_spells[which] == false) { + if (!univ.party[i].mage_spells[which]) { univ.party[i].mage_spells[which] = true; if(univ.party[i].main_status == eMainStatus::ALIVE) sprintf((char *) str,"%s learns spell.",univ.party[i].name.c_str()); give_help(41,0); - if (sound_done == false) {sound_done = true; play_sound(62);}; + if (!sound_done) { + sound_done = true; + play_sound(62); + }; } if (which >= 100) for (i = 0; i < 6; i++) - if (univ.party[i].priest_spells[which - 100] == false) { + if (!univ.party[i].priest_spells[which - 100]) { univ.party[i].priest_spells[which - 100] = true; if(univ.party[i].main_status == eMainStatus::ALIVE) sprintf((char *) str,"%s learns spell.",univ.party[i].name.c_str()); give_help(41,0); - if (sound_done == false) {sound_done = true; play_sound(62);}; + if (!sound_done) { + sound_done = true; + play_sound(62); + } } } @@ -1161,7 +1167,7 @@ void do_mage_spell(short pc_num,eSpell spell_num) if (r1 < 0) break; univ.party[pc_num].cur_sp -= (*spell_num).cost; store = get_ran(3,1,4) + adj; - if (summon_monster(r1,where,store,2) == false) + if (!summon_monster(r1,where,store,2)) add_string_to_buf(" Summon failed."); break; case eSpell::SUMMON_WEAK: @@ -1172,7 +1178,7 @@ void do_mage_spell(short pc_num,eSpell spell_num) univ.party[pc_num].cur_sp -= (*spell_num).cost; store = get_ran(4,1,4) + adj; for (i = 0; i < j; i++) - if (summon_monster(r1,where,store,2) == false) + if (!summon_monster(r1,where,store,2)) add_string_to_buf(" Summon failed."); break; case eSpell::SUMMON: @@ -1183,7 +1189,7 @@ void do_mage_spell(short pc_num,eSpell spell_num) univ.party[pc_num].cur_sp -= (*spell_num).cost; store = get_ran(5,1,4) + adj; for (i = 0; i < j; i++) - if (summon_monster(r1,where,store,2) == false) + if (!summon_monster(r1,where,store,2)) add_string_to_buf(" Summon failed."); break; case eSpell::SUMMON_MAJOR: @@ -1194,12 +1200,12 @@ void do_mage_spell(short pc_num,eSpell spell_num) univ.party[pc_num].cur_sp -= (*spell_num).cost; store = get_ran(7,1,4) + stat_adj(who_cast,eSkill::INTELLIGENCE); for (i = 0; i < j; i++) - if (summon_monster(r1,where,store,2) == false) + if (!summon_monster(r1,where,store,2)) add_string_to_buf(" Summon failed."); break; case eSpell::DEMON: store = get_ran(5,1,4) + 2 * stat_adj(who_cast,eSkill::INTELLIGENCE); - if (summon_monster(85,where,store,2) == false) + if (!summon_monster(85,where,store,2)) add_string_to_buf(" Summon failed."); else univ.party[pc_num].cur_sp -= (*spell_num).cost; break; @@ -1350,7 +1356,7 @@ void do_priest_spell(short pc_num,eSpell spell_num) //// case eSpell::SUMMON_SPIRIT: store = stat_adj(who_cast,eSkill::INTELLIGENCE); - if (summon_monster(125,where,get_ran(2,1,4) + store,2) == false) + if (!summon_monster(125,where,get_ran(2,1,4) + store,2)) add_string_to_buf(" Summon failed."); else univ.party[pc_num].cur_sp -= (*spell_num).cost; break; @@ -1360,24 +1366,24 @@ void do_priest_spell(short pc_num,eSpell spell_num) //// for (i = 0; i < r1; i++) { r2 = get_ran(1,0,7); store = get_ran(2,1,5) + stat_adj(who_cast,eSkill::INTELLIGENCE); - if (summon_monster((r2 == 1) ? 100 : 99,where,store,2 ) == false) + if (!summon_monster((r2 == 1) ? 100 : 99,where,store,2 )) add_string_to_buf(" Summon failed."); } break; case eSpell::SUMMON_HOST: univ.party[pc_num].cur_sp -= (*spell_num).cost; store = get_ran(2,1,4) + stat_adj(who_cast,eSkill::INTELLIGENCE); - if (summon_monster(126,where,store,2) == false) + if (!summon_monster(126,where,store,2)) add_string_to_buf(" Summon failed."); for (i = 0; i < 4; i++) { store = get_ran(2,1,4) + stat_adj(who_cast,eSkill::INTELLIGENCE); - if (summon_monster(125,where,store,2) == false) + if (!summon_monster(125,where,store,2)) add_string_to_buf(" Summon failed."); } break; case eSpell::SUMMON_GUARDIAN: store = get_ran(6,1,4) + stat_adj(who_cast,eSkill::INTELLIGENCE); - if (summon_monster(122,where,store,2) == false) + if (!summon_monster(122,where,store,2)) add_string_to_buf(" Summon failed."); else univ.party[pc_num].cur_sp -= (*spell_num).cost; break; @@ -1849,7 +1855,7 @@ void crumble_wall(location where) // TODO: Add something like this to the spread { ter_num_t ter; - if (loc_off_act_area(where) == true) + if (loc_off_act_area(where)) return; ter = univ.town->terrain(where.x,where.y); if(scenario.ter_types[ter].special == eTerSpec::CRUMBLING && scenario.ter_types[ter].flag3.u < 2) { @@ -2341,7 +2347,7 @@ static bool pick_spell_select_led(cDialog& me, std::string id, eKeyMod mods, con } static bool finish_pick_spell(cDialog& me, bool spell_toast, const short store_store_target, const short& store_spell, const eSkill store_situation) { - if (spell_toast == true) { + if (spell_toast) { store_spell_target = store_store_target ; if (store_situation == eSkill::MAGE_SPELLS) store_last_cast_mage = pc_casting; @@ -2426,7 +2432,7 @@ eSpell pick_spell(short pc_num,eSkill type) // 70 - no spell OW spell num pc_casting = pc_num; } - if (can_choose_caster == false) { + if (!can_choose_caster) { if(univ.party[pc_num].skills[type] == 0) { if(type == eSkill::MAGE_SPELLS) add_string_to_buf("Cast: No mage skill."); else add_string_to_buf("Cast: No priest skill."); @@ -2643,7 +2649,7 @@ void do_alchemy() //// store_i.charges++; if (store_i.variety == eItemType::POTION) store_i.graphic_num += get_ran(1,0,2); - if (give_to_pc(pc_num,store_i,0) == false) { + if (!give_to_pc(pc_num,store_i,0)) { ASB("No room in inventory."); ASB(" Potion placed on floor."); place_item(store_i,univ.town.p_loc,true); @@ -2927,7 +2933,7 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ if ((damage_type == 0) || (damage_type == 6) ||(damage_type == 7)) { how_much -= minmax(-5,5,univ.party[which_pc].status[eStatus::BLESS_CURSE]); for (i = 0; i < 24; i++) - if ((univ.party[which_pc].items[i].variety != eItemType::NO_ITEM) && (univ.party[which_pc].equip[i] == true)) { + if ((univ.party[which_pc].items[i].variety != eItemType::NO_ITEM) && (univ.party[which_pc].equip[i])) { if(isArmourType(univ.party[which_pc].items[i].variety)) { r1 = get_ran(1,1,univ.party[which_pc].items[i].item_level); how_much -= r1; @@ -3013,7 +3019,7 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ && ((level = get_prot_level(which_pc,eItemAbil::FULL_PROTECTION)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); - if (boom_anim_active == true) { + if (boom_anim_active) { if (how_much < 0) how_much = 0; univ.party[which_pc].marked_damage += how_much; @@ -3021,7 +3027,7 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ add_explosion(univ.town.p_loc,how_much,0,(damage_type > 2) ? 2 : 0,0,0); else add_explosion(univ.party[which_pc].combat_pos,how_much,0,(damage_type > 2) ? 2 : 0,0,0); //sprintf ((char *) c_line, " %s takes %d. ",(char *) univ.party[which_pc].name, how_much); - //if (do_print == true) + //if (do_print) // add_string_to_buf((char *) c_line); if (how_much == 0) return false; @@ -3040,7 +3046,7 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ univ.party[which_pc].status[eStatus::ASLEEP]--; sprintf ((char *) c_line, " %s takes %d. ",(char *) univ.party[which_pc].name.c_str(), how_much); - if (do_print == true) + if (do_print) add_string_to_buf((char *) c_line); if (damage_type != 10) { if (is_combat()) diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index b0312790..07e688a6 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -252,7 +252,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,short which_pc,sho can_enter = false; } - if (can_enter == false) + if (!can_enter) return false; if ((!is_out()) && (overall_mode < MODE_TALKING)) { @@ -1090,13 +1090,13 @@ void use_item(short pc,short item) start_spell_targeting(eSpell::RAVAGE_SPIRIT, true); break; case eItemAbil::SUMMONING: - if (summon_monster(str,user_loc,50,2) == false) + if (!summon_monster(str,user_loc,50,2)) add_string_to_buf(" Summon failed."); break; case eItemAbil::MASS_SUMMONING: r1 = get_ran(6,1,4); for (i = 0; i < get_ran(1,3,5); i++) // TODO: Why recalculate the random number for each loop iteration? - if (summon_monster(str,user_loc,r1,2) == false) + if (!summon_monster(str,user_loc,r1,2)) add_string_to_buf(" Summon failed."); break; case eItemAbil::ACID_SPRAY: @@ -1179,9 +1179,9 @@ void use_item(short pc,short item) } put_pc_screen(); - if ((take_charge == true) && (univ.party[pc].items[item].charges > 0)) + if ((take_charge) && (univ.party[pc].items[item].charges > 0)) remove_charge(pc,item); - if (take_charge == false) { + if (!take_charge) { draw_terrain(0); put_item_screen(stat_window,0); } @@ -1284,7 +1284,7 @@ bool adj_town_look(location where) terrain = univ.town->terrain(where.x,where.y); if (univ.town.is_special(where.x,where.y)) {// && (get_blockage(terrain) > 0)) { - if (adjacent(univ.town.p_loc,where) == false) + if (!adjacent(univ.town.p_loc,where)) add_string_to_buf(" Not close enough to search."); else { for (i = 0; i < 50; i++) @@ -1537,7 +1537,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s if (dam_type == 0) how_much -= r1; - if (boom_anim_active == true) { + if (boom_anim_active) { if (how_much < 0) how_much = 0; monst_marked_damage[which_m] += how_much; @@ -1560,7 +1560,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s return false; } - if (do_print == true) + if (do_print) monst_damaged_mes(which_m,how_much,how_much_spec); victim->health = victim->health - how_much - how_much_spec; @@ -1601,7 +1601,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s // TODO: This looks like the reason Windows split the boom_space function in two. // It doesn't exactly make sense though, since in its version, boom_space is only called for how_much_spec. if (dam_type != 9) { // note special damage only gamed in hand-to-hand, not during animation - if (party_can_see_monst(which_m) == true) { + if (party_can_see_monst(which_m)) { boom_space(victim->cur_loc,100,boom_gr[dam_type],how_much,sound_type); if (how_much_spec > 0) boom_space(victim->cur_loc,100,51,how_much_spec,5); @@ -1662,7 +1662,7 @@ void kill_monst(cCreature *which_m,short who_killed) } // Special killing effects - if (sd_legit(which_m->spec1,which_m->spec2) == true) + if (sd_legit(which_m->spec1,which_m->spec2)) PSD[which_m->spec1][which_m->spec2] = 1; if (which_m->special_on_kill >= 0) @@ -1733,7 +1733,7 @@ void push_things()//// if (is_out()) // TODO: Make these work outdoors return; - if (belt_present == false) + if (!belt_present) return; for (i = 0; i < univ.town->max_monst(); i++) @@ -1748,8 +1748,8 @@ void push_things()//// } if (l != univ.town.monst[i].cur_loc) { univ.town.monst[i].cur_loc = l; - if ((point_onscreen(center,univ.town.monst[i].cur_loc) == true) || - (point_onscreen(center,l) == true)) + if ((point_onscreen(center,univ.town.monst[i].cur_loc)) || + (point_onscreen(center,l))) redraw = true; } } @@ -1765,8 +1765,8 @@ void push_things()//// } if (l != univ.town.items[i].item_loc) { univ.town.items[i].item_loc = l; - if ((point_onscreen(center,univ.town.items[i].item_loc) == true) || - (point_onscreen(center,l) == true)) + if ((point_onscreen(center,univ.town.items[i].item_loc)) || + (point_onscreen(center,l))) redraw = true; } } @@ -1847,7 +1847,7 @@ void push_things()//// } } } - if (redraw == true) { + if (redraw) { print_buf(); draw_terrain(0); } @@ -1908,11 +1908,11 @@ void special_increase_age(long length, bool queue) } else univ.party.party_event_timers[i].time -= length; } univ.party.age = current_age; - if (stat_area == true) { + if (stat_area) { put_pc_screen(); put_item_screen(stat_window,0); } - if (redraw == true) + if (redraw) draw_terrain(0); } @@ -1975,7 +1975,7 @@ void run_special(eSpecCtx which_mode,short which_type,short start_spec,location next_spec_type = which_type; current_pc_picked_in_spec_enc = -1; store_special_loc = spec_loc; - if (end_scenario == true) { + if (end_scenario) { special_in_progress = false; return; } @@ -2184,7 +2184,7 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, break; case eSpecType::BUY_ITEMS_OF_TYPE: for (i = 0; i < 144; i++) - if (party_check_class(spec.ex1a,0) == true) + if (party_check_class(spec.ex1a,0)) store_val++; if (store_val == 0) { if ( spec.ex1b >= 0) @@ -2204,7 +2204,7 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, else for (i = 0; i < 10; i++) PSD[spec.sd1][i] = spec.ex1a; break; case eSpecType::COPY_SDF: - if ((sd_legit(spec.sd1,spec.sd2) == false) || (sd_legit(spec.ex1a,spec.ex1b) == false)) + if (!sd_legit(spec.sd1,spec.sd2) || !sd_legit(spec.ex1a,spec.ex1b)) giveError("Stuff Done flag out of range."); else PSD[spec.sd1][spec.sd2] = PSD[spec.ex1a][spec.ex1b]; break; @@ -2319,7 +2319,7 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, } break; } - if (check_mess == true) { + if (check_mess) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); } } @@ -2340,7 +2340,7 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, case : break; } - if (check_mess == true) { + if (check_mess) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); } } @@ -2361,7 +2361,7 @@ void oneshot_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, spec = cur_node; *next_spec = cur_node.jumpto; - if ((sd_legit(spec.sd1,spec.sd2) == true) && (PSD[spec.sd1][spec.sd2] == 250)) { + if ((sd_legit(spec.sd1,spec.sd2)) && (PSD[spec.sd1][spec.sd2] == 250)) { *next_spec = -1; return; } @@ -2510,7 +2510,7 @@ void oneshot_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, else i = cChoiceDlog("basic-trap.xml",{"yes","no"}).show() == "no"; if (i == 1) {set_sd = false; *next_spec = -1; *a = 1;} else { - if (is_combat() == true) + if (is_combat()) j = run_trap(current_pc,(eTrapType)spec.ex1a,spec.ex1b,spec.ex2a); else j = run_trap(7,(eTrapType)spec.ex1a,spec.ex1b,spec.ex2a); if (j == 0) { @@ -2519,10 +2519,10 @@ void oneshot_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, } break; } - if (check_mess == true) { + if (check_mess) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); } - if ((set_sd == true) && (sd_legit(spec.sd1,spec.sd2) == true)) + if ((set_sd) && (sd_legit(spec.sd1,spec.sd2))) PSD[spec.sd1][spec.sd2] = 250; } @@ -2936,7 +2936,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, switch (cur_node.type) { case eSpecType::IF_SDF: - if (sd_legit(spec.sd1,spec.sd2) == true) { + if (sd_legit(spec.sd1,spec.sd2)) { if ((spec.ex1a >= 0) && (PSD[spec.sd1][spec.sd2] >= spec.ex1a)) *next_spec = spec.ex1b; else if ((spec.ex2a >= 0) && (PSD[spec.sd1][spec.sd2] < spec.ex2a)) @@ -2959,7 +2959,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, *next_spec = spec.ex1b; break; case eSpecType::IF_SDF_COMPARE: - if ((sd_legit(spec.sd1,spec.sd2) == true) && (sd_legit(spec.ex1a,spec.ex1b) == true)) { + if ((sd_legit(spec.sd1,spec.sd2)) && (sd_legit(spec.ex1a,spec.ex1b))) { if (PSD[spec.ex1a][spec.ex1b] < PSD[spec.sd1][spec.sd2]) *next_spec = spec.ex2b; } @@ -2993,7 +2993,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, *next_spec = spec.ex2b; break; case eSpecType::IF_HAVE_ITEM_CLASS: - if (party_check_class(spec.ex1a,1) == true) + if (party_check_class(spec.ex1a,1)) *next_spec = spec.ex1b; break; case eSpecType::IF_EQUIP_ITEM_CLASS: @@ -3001,7 +3001,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, if(univ.party[i].main_status == eMainStatus::ALIVE) for (j = 0; j < 24; j++) if(univ.party[i].items[j].variety != eItemType::NO_ITEM && univ.party[i].items[j].special_class == (unsigned)spec.ex1a - && (univ.party[i].equip[j] == true)) + && (univ.party[i].equip[j])) *next_spec = spec.ex1b; break; case eSpecType::IF_HAS_GOLD_AND_TAKE: @@ -3029,7 +3029,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, } break; case eSpecType::IF_HAVE_ITEM_CLASS_AND_TAKE: - if (party_check_class(spec.ex1a,0) == true) + if (party_check_class(spec.ex1a,0)) *next_spec = spec.ex1b; break; case eSpecType::IF_EQUIP_ITEM_CLASS_AND_TAKE: @@ -3037,7 +3037,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, if(univ.party[i].main_status == eMainStatus::ALIVE) for (j = 0; j < 24; j++) if(univ.party[i].items[j].variety != eItemType::NO_ITEM && univ.party[i].items[j].special_class == (unsigned)spec.ex1a - && (univ.party[i].equip[j] == true)) { + && (univ.party[i].equip[j])) { *next_spec = spec.ex1b; *redraw = 1; take_item(i,j); @@ -3074,7 +3074,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, } break; case eSpecType::IF_EVENT_OCCURRED: - if (day_reached(spec.ex1a,spec.ex1b) == true) + if (day_reached(spec.ex1a,spec.ex1b)) *next_spec = spec.ex2b; break; case eSpecType::IF_SPECIES: @@ -3209,7 +3209,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, if(j == 3) *next_spec = spec.pictype; break; case eSpecType::IF_SDF_EQ: - if (sd_legit(spec.sd1,spec.sd2) == true) { + if (sd_legit(spec.sd1,spec.sd2)) { if (PSD[spec.sd1][spec.sd2] == spec.ex1a) *next_spec = spec.ex1b; } @@ -3331,7 +3331,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, if(j >= 0) *a = j; break; } - if (check_mess == true) { + if (check_mess) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); } } @@ -3734,7 +3734,7 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, univ.town.monst[spec.ex1a].attitude = spec.ex1b; break; } - if (check_mess == true) { + if (check_mess) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); } } @@ -3880,7 +3880,7 @@ void rect_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, } } } - if (check_mess == true) { + if (check_mess) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); } } @@ -3896,7 +3896,7 @@ void outdoor_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, spec = cur_node; *next_spec = cur_node.jumpto; - if (is_out() == false) return; + if (!is_out()) return; switch (cur_node.type) { case eSpecType::OUT_MAKE_WANDER: @@ -3948,14 +3948,14 @@ void outdoor_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, break; } - if (check_mess == true) { + if (check_mess) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); } } void setsd(short a,short b,short val) { - if (sd_legit(a,b) == false) { + if (!sd_legit(a,b)) { giveError("The scenario attempted to change an out of range Stuff Done flag."); return; } diff --git a/osx/boe.startup.cpp b/osx/boe.startup.cpp index 861c04c0..db2c10f5 100644 --- a/osx/boe.startup.cpp +++ b/osx/boe.startup.cpp @@ -51,10 +51,10 @@ bool handle_startup_press(location the_point) the_point.y -= ul.y; for (i = 0; i < 5; i++) - if (the_point.in(startup_button[i]) == true) { + if (the_point.in(startup_button[i])) { draw_start_button(i,5); mainPtr.display(); // TODO: I suspect this won't work - if (play_sounds == true) + if (play_sounds) play_sound(37); else sf::sleep(time_in_ticks(5)); draw_start_button(i,0); @@ -77,7 +77,7 @@ bool handle_startup_press(location the_point) break; case STARTBTN_JOIN: // regular scen - if (party_in_memory == false) { + if (!party_in_memory) { cChoiceDlog("need-party.xml").show(); break; } @@ -96,7 +96,7 @@ bool handle_startup_press(location the_point) break; case STARTBTN_CUSTOM: // custom - if (party_in_memory == false) { + if (!party_in_memory) { cChoiceDlog("need-party.xml").show(); break; } diff --git a/osx/boe.text.cpp b/osx/boe.text.cpp index 7c7c7c88..c465b52b 100644 --- a/osx/boe.text.cpp +++ b/osx/boe.text.cpp @@ -312,7 +312,7 @@ void put_item_screen(short screen_num,short suppress_buttons) } else { style.font = FONT_PLAIN; - if (univ.party[pc].equip[i_num] == true) { + if (univ.party[pc].equip[i_num]) { style.italic = true; if(univ.party[pc].items[i_num].variety == eItemType::ONE_HANDED || univ.party[pc].items[i_num].variety == eItemType::TWO_HANDED) style.colour = sf::Color::Magenta; @@ -607,7 +607,7 @@ short total_encumberance(short pc_num) short store = 0,i,what_val; for (i = 0; i < 24; i++) - if (univ.party[pc_num].equip[i] == true) { + if (univ.party[pc_num].equip[i]) { what_val = univ.party[pc_num].items[i].awkward; store += what_val; } @@ -770,15 +770,15 @@ short do_look(location space) if (overall_mode == MODE_LOOK_COMBAT) for (i = 0; i < 6; i++) if(space == univ.party[i].combat_pos && univ.party[i].main_status == eMainStatus::ALIVE - && (is_lit == true) && (can_see_light(univ.party[current_pc].combat_pos,space,sight_obscurity) < 5)) { + && (is_lit) && (can_see_light(univ.party[current_pc].combat_pos,space,sight_obscurity) < 5)) { msg = " " + univ.party[i].name; add_string_to_buf(msg); } if ((overall_mode == MODE_LOOK_TOWN) || (overall_mode == MODE_LOOK_COMBAT)) { for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst[i].active != 0) && (is_lit == true) - && (monst_on_space(space,i) == true) && + if ((univ.town.monst[i].active != 0) && (is_lit) + && (monst_on_space(space,i)) && ((overall_mode == MODE_LOOK_TOWN) || (can_see_light(univ.party[current_pc].combat_pos,space,sight_obscurity) < 5)) && (univ.town.monst[i].picture_num != 0)) { @@ -875,7 +875,7 @@ short do_look(location space) for (i = 0; i < NUM_TOWN_ITEMS; i++) { if(univ.town.items[i].variety != eItemType::NO_ITEM && space == univ.town.items[i].item_loc - && (is_lit == true)) { + && (is_lit)) { if(univ.town.items[i].variety == eItemType::GOLD) gold_here = true; else if(univ.town.items[i].variety == eItemType::FOOD) @@ -883,9 +883,9 @@ short do_look(location space) else num_items++; } } - if (gold_here == true) + if (gold_here) add_string_to_buf(" Gold"); - if (food_here == true) + if (food_here) add_string_to_buf(" Food"); if (num_items > 8) add_string_to_buf(" Many items"); @@ -900,7 +900,7 @@ short do_look(location space) } } - if (is_lit == false) { + if (!is_lit) { add_string_to_buf(" Dark "); return 0; } @@ -1392,7 +1392,7 @@ void print_buf () line_to_print= 0; } - if ((num_lines_printed == LINES_IN_TEXT_WIN - 1) && (printing_long == true)) { + if ((num_lines_printed == LINES_IN_TEXT_WIN - 1) && (printing_long)) { end_loop = false; line_to_print= buf_pointer; } @@ -1429,7 +1429,7 @@ void Draw_Some_Item (sf::Texture& src_gworld, RECT src_rect, sf::RenderTarget& t if ((target.x < 0) || (target.y < 0) || (target.x > 8) || (target.y > 8)) return; - if ((supressing_some_spaces == true) && (target != ok_space[0]) && + if ((supressing_some_spaces) && (target != ok_space[0]) && (target != ok_space[1]) && (target != ok_space[2]) && (target != ok_space[3])) return; terrain_there[target.x][target.y] = -1; diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 3c4f651d..73202891 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -150,15 +150,15 @@ void start_town_mode(short which_town, short entry_dir) for (i = 0; i < 10; i++) if ((scenario.town_to_add_to[i] >= 0) && (scenario.town_to_add_to[i] < 200) && (town_number == scenario.town_to_add_to[i]) && - (sd_legit(scenario.flag_to_add_to_town[i][0],scenario.flag_to_add_to_town[i][1]) == true)) { + (sd_legit(scenario.flag_to_add_to_town[i][0],scenario.flag_to_add_to_town[i][1]))) { former_town = town_number; town_number += PSD[scenario.flag_to_add_to_town[i][0]][scenario.flag_to_add_to_town[i][1]]; // Now update horses & boats for (i = 0; i < 30; i++) - if ((univ.party.horses[i].exists == true) && (univ.party.horses[i].which_town == former_town)) + if ((univ.party.horses[i].exists) && (univ.party.horses[i].which_town == former_town)) univ.party.horses[i].which_town = town_number; for (i = 0; i < 30; i++) - if ((univ.party.boats[i].exists == true) && (univ.party.boats[i].which_town == former_town)) + if ((univ.party.boats[i].exists) && (univ.party.boats[i].which_town == former_town)) univ.party.boats[i].which_town = town_number; } @@ -179,7 +179,7 @@ void start_town_mode(short which_town, short entry_dir) load_town_talk(town_number); init_town(); -// if (play_town_sound == true) { +// if (play_town_sound) { if (univ.town->lighting_type > 0) play_sound(95); else play_sound(16); @@ -217,7 +217,7 @@ void start_town_mode(short which_town, short entry_dir) monsters_loaded = true; for (j = 0; j < univ.town->max_monst(); j++) { - if (loc_off_act_area(univ.town.monst[j].cur_loc) == true) + if (loc_off_act_area(univ.town.monst[j].cur_loc)) univ.town.monst[j].active = 0; if (univ.town.monst[j].active == 2) univ.town.monst[j].active = 1; @@ -250,14 +250,14 @@ void start_town_mode(short which_town, short entry_dir) // Now, appearing/disappearing monsters might have arrived/disappeared. case 1: - if (day_reached(univ.town.monst[j].monster_time, univ.town.monst[j].time_code) == true) + if (day_reached(univ.town.monst[j].monster_time, univ.town.monst[j].time_code)) { univ.town.monst[j].active = 1; univ.town.monst[j].time_flag=0; // Now remove time flag so it doesn't get reappearing } break; case 2: - if (day_reached(univ.town.monst[j].monster_time, univ.town.monst[j].time_code) == true) + if (day_reached(univ.town.monst[j].monster_time, univ.town.monst[j].time_code)) { univ.town.monst[j].active = 0; univ.town.monst[j].time_flag=0; // Now remove time flag so it doesn't get disappearing again @@ -369,7 +369,7 @@ void start_town_mode(short which_town, short entry_dir) for (i = 0; i < univ.town->max_monst(); i++) { if (univ.town.monst[i].active > 0) if (((univ.town.monst[i].x_width > 1) || (univ.town.monst[i].y_width > 1)) && - (monst_can_be_there(univ.town.monst[i].cur_loc,i) == false)) + !monst_can_be_there(univ.town.monst[i].cur_loc,i)) univ.town.monst[i].active = 0; } @@ -381,7 +381,7 @@ void start_town_mode(short which_town, short entry_dir) add_string_to_buf("Area has been cleaned out."); } if (univ.town->town_chop_time > 0) { - if (day_reached(univ.town->town_chop_time,univ.town->town_chop_key) == true) + if (day_reached(univ.town->town_chop_time,univ.town->town_chop_key)) { add_string_to_buf("Area has been abandoned."); for (i = 0; i < univ.town->max_monst(); i++) @@ -391,7 +391,7 @@ void start_town_mode(short which_town, short entry_dir) town_toast = true; } } - if (town_toast == true) { + if (town_toast) { for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst[i].active >= 10) univ.town.monst[i].active -= 10; @@ -410,7 +410,7 @@ void start_town_mode(short which_town, short entry_dir) for (j = 0; j < univ.town->max_dim(); j++) for (k = 0; k < univ.town->max_dim(); k++) { loc.x = j; loc.y = k; - if (is_door(loc) == true) { + if (is_door(loc)) { univ.town.set_web(j,k,false); univ.town.set_crate(j,k,false); univ.town.set_barrel(j,k,false); @@ -419,7 +419,7 @@ void start_town_mode(short which_town, short entry_dir) univ.town.set_quickfire(j,k,false); //univ.out.misc_i[j][k] = univ.out.misc_i[j][k] & 3; } - if (univ.town.is_quickfire(j,k) == true) + if (univ.town.is_quickfire(j,k)) univ.town.quickfire_present = true; } @@ -436,7 +436,7 @@ void start_town_mode(short which_town, short entry_dir) for (i = 0; i < 64; i++) if ((univ.town->preset_items[i].code >= 0) && (((univ.party.item_taken[univ.town.num][i / 8] & s_pow(2,i % 8)) == 0) || - (univ.town->preset_items[i].always_there == true))) { + (univ.town->preset_items[i].always_there))) { for (j = 0; j < NUM_TOWN_ITEMS; j++) // place the preset item, if party hasn't gotten it already @@ -471,15 +471,15 @@ void start_town_mode(short which_town, short entry_dir) for (i = 0; i < univ.town->max_monst(); i++) - if (loc_off_act_area(univ.town.monst[i].cur_loc) == true) + if (loc_off_act_area(univ.town.monst[i].cur_loc)) univ.town.monst[i].active = 0; for (i = 0; i < NUM_TOWN_ITEMS; i++) - if (loc_off_act_area(univ.town.items[i].item_loc) == true) + if (loc_off_act_area(univ.town.items[i].item_loc)) univ.town.items[i].variety = eItemType::NO_ITEM; // Clean out unwanted monsters for (i = 0; i < univ.town->max_monst(); i++) - if (sd_legit(univ.town.monst[i].spec1,univ.town.monst[i].spec2) == true) { + if (sd_legit(univ.town.monst[i].spec1,univ.town.monst[i].spec2)) { if (PSD[univ.town.monst[i].spec1][univ.town.monst[i].spec2] > 0) univ.town.monst[i].active = 0; } @@ -538,13 +538,13 @@ void start_town_mode(short which_town, short entry_dir) //// check horses for (i = 0; i < 30; i++) { if ((scenario.boats[i].which_town >= 0) && (scenario.boats[i].loc.x >= 0)) { - if (univ.party.boats[i].exists == false) { + if (!univ.party.boats[i].exists) { univ.party.boats[i] = scenario.boats[i]; univ.party.boats[i].exists = true; } } if ((scenario.horses[i].which_town >= 0) && (scenario.horses[i].loc.x >= 0)) { - if (univ.party.horses[i].exists == false) { + if (!univ.party.horses[i].exists) { univ.party.horses[i] = scenario.horses[i]; univ.party.horses[i].exists = true; } @@ -578,7 +578,7 @@ location end_town_mode(short switching_level,location destination) // returns n univ.party.setup[i][j][k] = univ.town.misc_i(j,k); data_saved = true; } - if (data_saved == false) { + if (!data_saved) { univ.party.creature_save[univ.party.at_which_save_slot] = univ.town.monst; for (j = 0; j < univ.town->max_dim(); j++) for (k = 0; k < univ.town->max_dim(); k++) @@ -689,7 +689,7 @@ location end_town_mode(short switching_level,location destination) // returns n } - if (combat_end == false) + if (!combat_end) clear_map(); univ.town.num = 200; // should be harmless... @@ -830,7 +830,7 @@ void place_party(short direction) where_in_a++; how_many_ok--; // if (how_many_ok > 1) { - while (spot_ok[where_in_a] == false) + while (!spot_ok[where_in_a]) where_in_a++; // } } @@ -1068,7 +1068,7 @@ void elim_monst(unsigned short which,short spec_a,short spec_b) { short i; - if (sd_legit(spec_a,spec_b) == false) + if (!sd_legit(spec_a,spec_b)) return; if (PSD[spec_a][spec_b] > 0) { for (i = 0; i < univ.town->max_monst(); i++) @@ -1141,7 +1141,7 @@ void pick_lock(location where,short pc_num) unlock_adjust = scenario.ter_types[terrain].flag2.u; if ((unlock_adjust >= 5) || (r1 > (unlock_adjust * 15 + 30))) { add_string_to_buf(" Didn't work. "); - if (will_break == true) { + if (will_break) { add_string_to_buf(" Pick breaks. "); remove_charge(pc_num,which_item); } @@ -1188,13 +1188,13 @@ void erase_specials()//// if ((is_combat()) && (which_combat_type == 0)) return; - if ((is_town() == false) && (is_combat() == false)) + if (!is_town() && !is_combat()) return; for (k = 0; k < 50; k++) { //if (univ.town->spec_id[k] >= 0) { sn = univ.town->specials[univ.town->spec_id[k]]; sd1 = sn.sd1; sd2 = sn.sd2; - if ((sd_legit(sd1,sd2) == true) && (PSD[sd1][sd2] == 250)) { + if ((sd_legit(sd1,sd2)) && (PSD[sd1][sd2] == 250)) { where = univ.town->special_locs[k]; if ((where.x != 100) && ((where.x > univ.town->max_dim()) || (where.y > univ.town->max_dim()) || (where.x < 0) || (where.y < 0))) { @@ -1233,7 +1233,7 @@ void erase_out_specials() for (short i = 0; i < 2; i++) for (short j = 0; j < 2; j++) - if (quadrant_legal(i,j) == true) { + if (quadrant_legal(i,j)) { for(short k = 0; k < 18; k++) { if(i < 8 && univ.out.outdoors[i][j].exit_dests[k] >= 0 && (univ.out.outdoors[i][j].exit_locs[k].x == minmax(0,47,univ.out.outdoors[i][j].exit_locs[k].x)) && @@ -1253,7 +1253,7 @@ void erase_out_specials() sn = univ.out.outdoors[i][j].specials[univ.out.outdoors[i][j].special_id[k]]; sd1 = sn.sd1; sd2 = sn.sd2; - if ((sd_legit(sd1,sd2) == true) && (PSD[sd1][sd2] == 250)) { + if ((sd_legit(sd1,sd2)) && (PSD[sd1][sd2] == 250)) { where = univ.out.outdoors[i][j].special_locs[k]; if ((where.x > 48) || (where.y > 48) || (where.x < 0) || (where.y < 0)) { @@ -1283,7 +1283,7 @@ void clear_map() { RECT map_world_rect(map_gworld); -// if (map_visible == false) { +// if (!map_visible) { // return; // } // draw_map(mini_map,11); @@ -1424,13 +1424,13 @@ void draw_map(bool need_refresh) { draw_rect = orig_draw_rect; draw_rect.offset(6 * where.x + small_adj, 6 * where.y + small_adj); - if (out_mode == true) + if (out_mode) what_ter = univ.out[where.x + 48 * univ.party.i_w_c.x][where.y + 48 * univ.party.i_w_c.y]; else what_ter = univ.town->terrain(where.x,where.y); ter_temp_from = orig_draw_rect; - if (out_mode == true) + if (out_mode) expl = univ.out.out_e[where.x + 48 * univ.party.i_w_c.x][where.y + 48 * univ.party.i_w_c.y]; else expl = is_explored(where.x,where.y); @@ -1462,10 +1462,10 @@ void draw_map(bool need_refresh) { if (((pic >= 400) ? anim_map_pats[pic - 400] : map_pats[pic]) < 30) { // Try a little optimization if ((pic < 400) && (where.x < area_to_put_on_map_rect.right - 1)) { - if (out_mode == true) + if (out_mode) what_ter2 = univ.out[(where.x + 1)+ 48 * univ.party.i_w_c.x][where.y + 48 * univ.party.i_w_c.y]; else what_ter2 = univ.town->terrain(where.x + 1,where.y); - if (out_mode == true) + if (out_mode) expl2 = univ.out.out_e[(where.x + 1) + 48 * univ.party.i_w_c.x][where.y + 48 * univ.party.i_w_c.y]; else expl2 = is_explored(where.x + 1,where.y); pic2 = scenario.ter_types[what_ter2].picture; diff --git a/osx/pcedit/pc.action.cpp b/osx/pcedit/pc.action.cpp index 879ad445..3946a196 100644 --- a/osx/pcedit/pc.action.cpp +++ b/osx/pcedit/pc.action.cpp @@ -64,7 +64,7 @@ bool handle_action(sf::Event event) the_point = {event.mouseButton.x, event.mouseButton.y}; - if (file_in_mem == false) + if (!file_in_mem) return false; for (i = 0; i < 6; i++) @@ -191,7 +191,7 @@ void combine_things(short pc_num) // ASB("Can have at most 125 of any item."); } else univ.party[pc_num].items[i].charges += univ.party[pc_num].items[j].charges; - if (univ.party[pc_num].equip[j] == true) { + if (univ.party[pc_num].equip[j]) { univ.party[pc_num].equip[i] = true; univ.party[pc_num].equip[j] = false; } @@ -224,7 +224,7 @@ bool give_to_party(cItemRec item,short print_result) short i = 0; while (i < 6) { - if (give_to_pc(i,item,print_result) == true) + if (give_to_pc(i,item,print_result)) return true; i++; } diff --git a/osx/pcedit/pc.editors.cpp b/osx/pcedit/pc.editors.cpp index 25c13e29..216896a8 100644 --- a/osx/pcedit/pc.editors.cpp +++ b/osx/pcedit/pc.editors.cpp @@ -475,7 +475,7 @@ static bool spend_xp_navigate_filter(cDialog& me, std::string item_hit,std::map< beep(); // TODO: This is a game event, so it should have a game sound, not a system alert. } store_train_pc = pc_num; - if (talk_done == true) { + if (talk_done) { me.toast(item_hit == "keep"); } return true; diff --git a/osx/pcedit/pc.graphics.cpp b/osx/pcedit/pc.graphics.cpp index c3637315..868cb8ce 100644 --- a/osx/pcedit/pc.graphics.cpp +++ b/osx/pcedit/pc.graphics.cpp @@ -415,7 +415,7 @@ void display_party() else { from_rect = pc_info_rect; from_rect.top = from_rect.bottom - 14; - if (party_in_scen == false) + if (!party_in_scen) win_draw_string(mainPtr,from_rect,"Party not in a scenario.",eTextMode::WRAP,style); else win_draw_string(mainPtr,from_rect,"Party is in a scenario (day " + std::to_string(1 + univ.party.age / 3700) + ").",eTextMode::WRAP,style); @@ -940,7 +940,7 @@ void display_party() // on_what_line++; // MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); // last_line_break = last_word_break; -// if (force_skip == true) { +// if (force_skip) { // force_skip = false; // i++; // last_line_break++; diff --git a/osx/pcedit/pc.main.cpp b/osx/pcedit/pc.main.cpp index 073934c5..8823ac8c 100644 --- a/osx/pcedit/pc.main.cpp +++ b/osx/pcedit/pc.main.cpp @@ -184,7 +184,7 @@ void Mouse_Pressed() bool try_to_end; try_to_end = handle_action(event); - if (try_to_end == true) + if (try_to_end) All_Done = verify_restore_quit(false); } @@ -321,7 +321,7 @@ void handle_extra_menu(int item_hit) break; case 13: - if (party_in_scen == false) { + if (!party_in_scen) { display_strings(25,15); break; } @@ -356,7 +356,7 @@ void handle_edit_menu(int item_hit) edit_day(); break; case 6: // ouit maps - if (party_in_scen == false) { + if (!party_in_scen) { display_strings(25,15); break; } @@ -367,7 +367,7 @@ void handle_edit_menu(int item_hit) univ.out_maps[i][j][k] = 255; break; case 7: // town maps - if (party_in_scen == false) { + if (!party_in_scen) { display_strings(25,15); break; } @@ -437,11 +437,11 @@ void handle_edit_menu(int item_hit) // i.reserved1 = 0; // i.reserved2 = 0; // i.item_properties = 0; -// if (s_item.identified == true) +// if (s_item.identified) // i.item_properties = i.item_properties | 1; // if ((s_item.ability == 14) || (s_item.ability == 129) || (s_item.ability == 95)) // i.item_properties = i.item_properties | 16; -// if (s_item.magic == true) +// if (s_item.magic) // i.item_properties = i.item_properties | 4; // // return i; @@ -502,7 +502,7 @@ bool verify_restore_quit(bool mode) // w = GetDialogWindow(hDlg); // updateRgn = NewRgn(); // GetWindowRegion(w, kWindowUpdateRgn, updateRgn); -// if (EmptyRgn(updateRgn) == true) { +// if (EmptyRgn(updateRgn)) { // return true; // } // BeginUpdate(GetDialogWindow(hDlg)); diff --git a/osx/scenedit/scen.actions.cpp b/osx/scenedit/scen.actions.cpp index 81cbaa95..d58815ec 100644 --- a/osx/scenedit/scen.actions.cpp +++ b/osx/scenedit/scen.actions.cpp @@ -216,7 +216,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { start_item_editing(0); break; case 5: // new town - if (change_made == true) { + if (change_made) { giveError("You need to save the changes made to your scenario before you can add a new town."); return are_done; } @@ -224,7 +224,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { giveError("You have reached the limit of 200 towns you can have in one scenario."); return are_done; } - if (new_town(scenario.num_towns) == true) + if (new_town(scenario.num_towns)) set_up_main_screen(); break; case 6: @@ -235,7 +235,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { start_special_item_editing(); break; case 11: // pick out - if (change_made == true) { + if (change_made) { if(!save_check("save-section-confirm.xml")) break; } @@ -255,7 +255,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { return false; break; case 16: // pick town - if (change_made == true) { + if (change_made) { if(!save_check("save-section-confirm.xml")) break; } @@ -321,7 +321,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { //set_rb(j,3000 + j,(char *) str,0); break; case 4: - if (option_hit == true) { + if (option_hit) { scenario.scen_specials[j] = null_spec_node; } else edit_spec_enc(j,0); @@ -331,7 +331,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { start_special_editing(0,1); break; case 5: - if (option_hit == true) { + if (option_hit) { current_terrain.specials[j] = null_spec_node; } else edit_spec_enc(j,1); @@ -341,7 +341,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { start_special_editing(1,1); break; case 6: - if (option_hit == true) { + if (option_hit) { town->specials[j] = null_spec_node; } else edit_spec_enc(j,2); @@ -351,7 +351,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { start_special_editing(2,1); break; case 7: - if (option_hit == true) { + if (option_hit) { s2 = get_str("scen-default", j + 1); strcpy(scenario.scen_strs(j),s2.c_str()); } @@ -362,7 +362,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { break; case 8: - if (option_hit == true) { + if (option_hit) { s2 = get_str("outdoor-default", j + 1); strcpy(current_terrain.out_strs(j),s2.c_str()); } @@ -372,7 +372,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { start_string_editing(1,1); break; case 9: - if (option_hit == true) { + if (option_hit) { s2 = get_str("town-default", j + 1); strcpy(town->town_strs(j),s2.c_str()); } @@ -420,18 +420,18 @@ bool handle_action(location the_point,sf::Event /*event*/) { spot_hit.y = j; } - if ((mouse_button_held == true) && (spot_hit.x == last_spot_hit.x) && + if ((mouse_button_held) && (spot_hit.x == last_spot_hit.x) && (spot_hit.y == last_spot_hit.y)) return are_done; else last_spot_hit = spot_hit; - if (mouse_button_held == false) + if (!mouse_button_held) last_spot_hit = spot_hit; old_mode = overall_mode; change_made = true; - if ((spot_hit.x < 0) || (spot_hit.x > ((editing_town == true) ? town->max_dim() - 1 : 47)) || - (spot_hit.y < 0) || (spot_hit.y > ((editing_town == true) ? town->max_dim() - 1 : 47))) ; + if ((spot_hit.x < 0) || (spot_hit.x > ((editing_town) ? town->max_dim() - 1 : 47)) || + (spot_hit.y < 0) || (spot_hit.y > ((editing_town) ? town->max_dim() - 1 : 47))) ; else switch (overall_mode) { case MODE_DRAWING: if ((!mouse_button_held && terrain_matches(spot_hit.x,spot_hit.y,current_terrain_type)) || @@ -451,7 +451,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { break; case MODE_ROOM_RECT: case MODE_SET_TOWN_RECT: case MODE_HOLLOW_RECT: case MODE_FILLED_RECT: - if (mouse_button_held == true) + if (mouse_button_held) break; if (mode_count == 2) { working_rect.left = spot_hit.x; @@ -473,12 +473,12 @@ bool handle_action(location the_point,sf::Event /*event*/) { town->in_town_rect = working_rect; } else { // MODE_ROOM_RECT - if (editing_town == true) { + if (editing_town) { for (x = 0; x < 16; x++) if (town->room_rect(x).right == 0) { town->room_rect(x) = working_rect; strcpy(town->town_strs(x + 1),""); - if (edit_area_rect_str(x,1) == false) + if (!edit_area_rect_str(x,1)) town->room_rect(x).right = 0; x = 500; } @@ -488,7 +488,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { if (current_terrain.info_rect[x].right == 0) { current_terrain.info_rect[x] = working_rect; strcpy(current_terrain.out_strs(x + 1),""); - if (edit_area_rect_str(x,0) == false) + if (!edit_area_rect_str(x,0)) current_terrain.info_rect[x].right = 0; x = 500; } @@ -501,13 +501,13 @@ bool handle_action(location the_point,sf::Event /*event*/) { set_cursor(wand_curs); break; case MODE_SET_WANDER_POINTS: - if (mouse_button_held == true) + if (mouse_button_held) break; - if (editing_town == false) { + if (!editing_town) { current_terrain.wandering_locs[mode_count - 1].x = spot_hit.x; current_terrain.wandering_locs[mode_count - 1].y = spot_hit.y; } - if (editing_town == true) { + if (editing_town) { town->wandering_locs[mode_count - 1].x = spot_hit.x; town->wandering_locs[mode_count - 1].y = spot_hit.y; } @@ -531,7 +531,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { break; //case MODE_TOGGLE_SPECIAL_DOT: // town.special[spot_hit.x][spot_hit.y] = !town.special[spot_hit.x][spot_hit.y]; - /*if (mouse_button_held == true) + /*if (mouse_button_held) break; if (is_special(spot_hit.x,spot_hit.y)) take_special(spot_hit.x,spot_hit.y); @@ -716,7 +716,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { overall_mode = MODE_DRAWING; break; case MODE_EYEDROPPER: - if (editing_town == true) + if (editing_town) set_new_terrain(town->terrain(spot_hit.x,spot_hit.y)); else set_new_terrain(current_terrain.terrain[spot_hit.x][spot_hit.y]); set_cursor(wand_curs); @@ -740,7 +740,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { overall_mode = MODE_DRAWING; break; case MODE_EDIT_SIGN: //edit sign - if (editing_town == true) { + if (editing_town) { for (x = 0; x < 15; x++) if ((town->sign_locs[x].x == spot_hit.x) && (town->sign_locs[x].y == spot_hit.y)) { edit_sign(x,scenario.ter_types[town->terrain(spot_hit.x,spot_hit.y)].picture); @@ -750,7 +750,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { giveError("Either this space is not a sign, or you have already placed too many signs on this level."); } } - if (editing_town == false) { + if (!editing_town) { for (x = 0; x < 8; x++) if ((current_terrain.sign_locs[x].x == spot_hit.x) && (current_terrain.sign_locs[x].y == spot_hit.y)) { edit_sign(x,scenario.ter_types[current_terrain.terrain[spot_hit.x][spot_hit.y]].picture); @@ -765,7 +765,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { break; case MODE_EDIT_CREATURE: //edit monst for (x = 0; x < 60; x++) - if (monst_on_space(spot_hit,x) == true) { + if (monst_on_space(spot_hit,x)) { edit_placed_monst(x); last_placed_monst = town->creatures(x); } @@ -778,14 +778,14 @@ bool handle_action(location the_point,sf::Event /*event*/) { overall_mode = MODE_DRAWING; break; case MODE_COPY_SPECIAL: //copy special - if (editing_town == true) { + if (editing_town) { for (x = 0; x < 50; x++) if ((town->special_locs[x].x == spot_hit.x) && (town->special_locs[x].y == spot_hit.y)) { copied_spec = town->spec_id[x]; x = 500; } } - if (editing_town == false) { + if (!editing_town) { for (x = 0; x < 18; x++) if ((current_terrain.special_locs[x].x == spot_hit.x) && (current_terrain.special_locs[x].y == spot_hit.y)) { copied_spec = current_terrain.special_id[x]; @@ -802,7 +802,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { giveError("You need to select a special to copy first."); break; } - if (editing_town == true) { + if (editing_town) { for (x = 0; x < 50; x++) if (town->special_locs[x].x == 100) { town->special_locs[x] = spot_hit; @@ -810,7 +810,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { x = 500; } } - if (editing_town == false) { + if (!editing_town) { if ((spot_hit.x == 0) || (spot_hit.x == 47) || (spot_hit.y == 0) || (spot_hit.y == 47)) { cChoiceDlog("not-at-edge.xml").show(); break; @@ -830,14 +830,14 @@ bool handle_action(location the_point,sf::Event /*event*/) { overall_mode = MODE_DRAWING; break; case MODE_ERASE_SPECIAL: //erase special - if (editing_town == true) { + if (editing_town) { for (x = 0; x < 50; x++) if ((town->special_locs[x].x == spot_hit.x) && (town->special_locs[x].y == spot_hit.y)) { town->special_locs[x].x = 100; x = 500; } } - if (editing_town == false) { + if (!editing_town) { for (x = 0; x < 18; x++) if ((current_terrain.special_locs[x].x == spot_hit.x) && (current_terrain.special_locs[x].y == spot_hit.y)) { current_terrain.special_locs[x].x = 100; @@ -873,7 +873,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { break; case MODE_ERASE_CREATURE: //delete monst for (x = 0; x < 60; x++) - if (monst_on_space(spot_hit,x) == true) { + if (monst_on_space(spot_hit,x)) { town->creatures(x).number = 0; } set_cursor(wand_curs); @@ -906,39 +906,39 @@ bool handle_action(location the_point,sf::Event /*event*/) { if((the_point.in(border_rect[0])) & (cen_y > (editing_town ? 4 : 3))) { cen_y--; if(ctrl_hit) - cen_y = ((editing_town == true) ? 4 : 3); + cen_y = ((editing_town) ? 4 : 3); need_redraw = true; mouse_button_held = true; } if((the_point.in(border_rect[1])) & (cen_x > (editing_town ? 4 : 3))) { cen_x--; if(ctrl_hit) - cen_x = ((editing_town == true) ? 4 : 3); + cen_x = ((editing_town) ? 4 : 3); need_redraw = true; mouse_button_held = true; } if((the_point.in(border_rect[2])) & (cen_y < (editing_town ? town->max_dim() - 5 : 44))) { cen_y++; if(ctrl_hit) - cen_y = (editing_town == true) ? town->max_dim() - 5 : 44; + cen_y = (editing_town) ? town->max_dim() - 5 : 44; need_redraw = true; mouse_button_held = true; } if((the_point.in(border_rect[3])) & (cen_x < (editing_town ? town->max_dim() - 5 : 44))) { cen_x++; if(ctrl_hit) - cen_x = (editing_town == true) ? town->max_dim() - 5 : 44; + cen_x = (editing_town) ? town->max_dim() - 5 : 44; need_redraw = true; mouse_button_held = true; } - if (need_redraw == true) { + if (need_redraw) { draw_terrain(); place_just_location(); need_redraw = false; } } - if ((mouse_button_held == false) && ((overall_mode < MODE_MAIN_SCREEN) || (overall_mode == MODE_EDIT_TYPES))) { + if (!mouse_button_held && ((overall_mode < MODE_MAIN_SCREEN) || (overall_mode == MODE_EDIT_TYPES))) { cur_point = the_point; cur_point.x -= RIGHT_AREA_UL_X; cur_point.y -= RIGHT_AREA_UL_Y; @@ -962,8 +962,8 @@ 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 == false) && (cur_point2.in(palette_buttons[i][j])) - && /*((j < 3) || (editing_town == true)) &&*/ (overall_mode < MODE_MAIN_SCREEN)) { + if ((good_palette_buttons[editing_town][j][i] > 0) && !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); flash_rect(temp_rect); @@ -1038,7 +1038,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { mouse_button_held = false; break; case 107: - if (editing_town == true) { + if (editing_town) { set_string("Can only set town entrances outdoors",""); break; } @@ -1047,7 +1047,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { overall_mode = MODE_EDIT_TOWN_ENTRANCE; break; case 200: - if (editing_town == false) { + if (!editing_town) { set_string("Edit placed item","Not while outdoors."); break; } @@ -1056,7 +1056,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { overall_mode = MODE_EDIT_ITEM; break; case 201: - if (editing_town == false) { + if (!editing_town) { set_string("Edit placed item","Not while outdoors."); break; } @@ -1065,7 +1065,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { overall_mode = MODE_PLACE_SAME_ITEM; break; case 202: - if (editing_town == false) { + if (!editing_town) { //set_string("Edit placed item","Not while outdoors."); set_string("Toggle special spot","Select location"); overall_mode = MODE_TOGGLE_SPECIAL_DOT; @@ -1231,7 +1231,7 @@ bool handle_action(location the_point,sf::Event /*event*/) { } } } - if (need_redraw == true) { + if (need_redraw) { draw_main_screen(); draw_terrain(); //draw_frames(); @@ -1267,12 +1267,12 @@ void swap_terrain() { change_ter(&a,&b,&c); if (a < 0) return; - for (i = 0; i < ((editing_town == true) ? town->max_dim() : 48); i++) - for (j = 0; j < ((editing_town == true) ? town->max_dim() : 48); j++) + for (i = 0; i < ((editing_town) ? town->max_dim() : 48); i++) + for (j = 0; j < ((editing_town) ? town->max_dim() : 48); j++) { - ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + ter = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; if ((ter == a) && (get_ran(1,1,100) <= c)) { - if (editing_town == true) + if (editing_town) town->terrain(i,j) = b; else current_terrain.terrain[i][j] = b; } @@ -1476,12 +1476,12 @@ bool is_wall(short i,short j) { bool answer = false; short pic; - ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + ter = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; pic = scenario.ter_types[ter].picture; - if ((editing_town == true) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) + if ((editing_town) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) return true; - if ((editing_town == false) && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) + if (!editing_town && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) return true; if ((ter < 22) && (ter > 4)) return true; @@ -1506,10 +1506,10 @@ bool is_correctable_wall(short i,short j) { bool answer = false; short k; - ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; - if ((editing_town == true) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) + ter = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + if ((editing_town) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) return false; - if ((editing_town == false) && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) + if (!editing_town && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) return false; for (k = 0; k < 13 ; k++) if (ter == walls[k]) @@ -1523,11 +1523,11 @@ bool is_mountain(short i,short j) { short pic; ter_num_t ter; - ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + ter = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; pic = scenario.ter_types[ter].picture; - if ((editing_town == true) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) + if ((editing_town) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) return true; - if ((editing_town == false) && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) + if (!editing_town && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) return true; if ((ter >= 22) && (ter <= 35)) answer = true; @@ -1545,11 +1545,11 @@ bool is_hill(short i,short j) { short pic; ter_num_t ter; - ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + ter = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; pic = scenario.ter_types[ter].picture; - if ((editing_town == true) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) + if ((editing_town) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) return true; - if ((editing_town == false) && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) + if (!editing_town && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) return true; if ((ter >= 36) && (ter <= 49)) answer = true; @@ -1575,11 +1575,11 @@ bool is_erasable_water(short i,short j) { short pic; ter_num_t ter; - ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + ter = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; pic = scenario.ter_types[ter].picture; - if ((editing_town == true) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) + if ((editing_town) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) return false; - if ((editing_town == false) && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) + if (!editing_town && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) return false; if ((ter >= 50) && (ter <= 62)) @@ -1592,11 +1592,11 @@ bool is_water(short i,short j) { short pic; ter_num_t ter; - ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + ter = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; pic = scenario.ter_types[ter].picture; - if ((editing_town == true) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) + if ((editing_town) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) return true; - if ((editing_town == false) && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) + if (!editing_town && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) return true; if ((pic >= 46) && (pic <= 66)) @@ -1609,11 +1609,11 @@ bool is_correctable_water(short i,short j) { short pic; ter_num_t ter; - ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + ter = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; pic = scenario.ter_types[ter].picture; - if ((editing_town == true) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) + if ((editing_town) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) return false; - if ((editing_town == false) && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) + if (!editing_town && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) return false; if ((ter >= 50) && (ter <= 62)) @@ -1628,11 +1628,11 @@ void shy_change_circle_terrain(location center,short radius,ter_num_t terrain_ty short i,j; ter_num_t ter; - for (i = 0; i < ((editing_town == true) ? town->max_dim() : 48); i++) - for (j = 0; j < ((editing_town == true) ? town->max_dim() : 48); j++) { + for (i = 0; i < ((editing_town) ? town->max_dim() : 48); i++) + for (j = 0; j < ((editing_town) ? town->max_dim() : 48); j++) { l.x = i; l.y = j; - ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + ter = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; if ((dist(center,l) <= radius) && (get_ran(1,1,20) <= probability) && (ter < 5)) set_terrain(l,terrain_type); @@ -1644,8 +1644,8 @@ void change_circle_terrain(location center,short radius,ter_num_t terrain_type,s location l; short i,j; - for (i = 0; i < ((editing_town == true) ? town->max_dim() : 48); i++) - for (j = 0; j < ((editing_town == true) ? town->max_dim() : 48); j++) { + for (i = 0; i < ((editing_town) ? town->max_dim() : 48); i++) + for (j = 0; j < ((editing_town) ? town->max_dim() : 48); j++) { l.x = i; l.y = j; if ((dist(center,l) <= radius) && (get_ran(1,1,20) <= probability)) @@ -1658,13 +1658,13 @@ void change_rect_terrain(rectangle r,ter_num_t terrain_type,short probability,bo location l; short i,j; - for (i = 0; i < ((editing_town == true) ? town->max_dim() : 48); i++) - for (j = 0; j < ((editing_town == true) ? town->max_dim() : 48); j++) { + for (i = 0; i < ((editing_town) ? town->max_dim() : 48); i++) + for (j = 0; j < ((editing_town) ? town->max_dim() : 48); j++) { l.x = i; l.y = j; if ((i >= r.left) && (i <= r.right) && (j >= r.top) && (j <= r.bottom) - && ((hollow == false) || (i == r.left) || (i == r.right) || (j == r.top) || (j == r.bottom)) - && ((hollow == true) || (get_ran(1,1,20) <= probability))) + && (!hollow || (i == r.left) || (i == r.right) || (j == r.top) || (j == r.bottom)) + && ((hollow) || (get_ran(1,1,20) <= probability))) set_terrain(l,terrain_type); } } @@ -1694,9 +1694,9 @@ void frill_up_terrain() { short i,j; ter_num_t terrain_type; - for (i = 0; i < ((editing_town == true) ? town->max_dim() : 48); i++) - for (j = 0; j < ((editing_town == true) ? town->max_dim() : 48); j++) { - terrain_type = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + for (i = 0; i < ((editing_town) ? town->max_dim() : 48); i++) + for (j = 0; j < ((editing_town) ? town->max_dim() : 48); j++) { + terrain_type = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; if ((terrain_type == 2) && (get_ran(1,1,20) < 3)) terrain_type = 3; @@ -1706,7 +1706,7 @@ void frill_up_terrain() { terrain_type = 1; if ((terrain_type == 36) && (get_ran(1,1,20) < 5)) terrain_type = 37; - if (editing_town == true) + if (editing_town) town->terrain(i,j) = terrain_type; else current_terrain.terrain[i][j] = terrain_type; } @@ -1717,9 +1717,9 @@ void unfrill_terrain() { short i,j; ter_num_t terrain_type; - for (i = 0; i < ((editing_town == true) ? town->max_dim() : 48); i++) - for (j = 0; j < ((editing_town == true) ? town->max_dim() : 48); j++) { - terrain_type = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j]; + for (i = 0; i < ((editing_town) ? town->max_dim() : 48); i++) + for (j = 0; j < ((editing_town) ? town->max_dim() : 48); j++) { + terrain_type = (editing_town) ? town->terrain(i,j) : current_terrain.terrain[i][j]; if (terrain_type == 3) terrain_type = 2; if (terrain_type == 4) @@ -1728,7 +1728,7 @@ void unfrill_terrain() { terrain_type = 0; if (terrain_type == 37) terrain_type = 36; - if (editing_town == true) + if (editing_town) town->terrain(i,j) = terrain_type; else current_terrain.terrain[i][j] = terrain_type; } @@ -1785,12 +1785,12 @@ void set_terrain(location l,ter_num_t terrain_type) { j = l.y; //if ((l.x < 0) || (l.x > town->max_dim() - 1) || (l.y < 0) || (l.y > town->max_dim() - 1)) // return; - if ((editing_town == true) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) + if ((editing_town) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) return ; - if ((editing_town == false) && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) + if (!editing_town && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) return ; - if (editing_town == true) + if (editing_town) town->terrain(i,j) = terrain_type; else current_terrain.terrain[i][j] = terrain_type; l2 = l; @@ -1804,7 +1804,7 @@ void set_terrain(location l,ter_num_t terrain_type) { while(obj_loc.y > 0) l2.y-- , obj_loc.y--; for(i = 0; i < obj_dim.x; i++) for(j = 0; j < obj_dim.y; j++){ - if (editing_town == true) + if (editing_town) town->terrain(l2.x + i,l2.y + j) = find_object_part(q,i,j,terrain_type); else current_terrain.terrain[l2.x + i][l2.y + j] = find_object_part(q,i,j,terrain_type); } @@ -1812,25 +1812,25 @@ void set_terrain(location l,ter_num_t terrain_type) { // if (terrain_type == 85) { // l2.x++; -// if (editing_town == true) +// if (editing_town) // town->terrain(l2.x,l2.y) = 86; // else current_terrain.terrain[l2.x][l2.y] = 86; // } // if (terrain_type == 86) { // l2.x--; -// if (editing_town == true) +// if (editing_town) // town->terrain(l2.x,l2.y) = 85; // else current_terrain.terrain[l2.x][l2.y] = 85; // } // if (terrain_type == 88) { // l2.x++; -// if (editing_town == true) +// if (editing_town) // town->terrain(l2.x,l2.y) = 89; // else current_terrain.terrain[l2.x][l2.y] = 89; // } // if (terrain_type == 89) { // l2.x--; -// if (editing_town == true) +// if (editing_town) // town->terrain(l2.x,l2.y) = 88; // else current_terrain.terrain[l2.x][l2.y] = 88; // } @@ -1839,15 +1839,15 @@ void set_terrain(location l,ter_num_t terrain_type) { if (is_mountain(l.x,l.y)) for (i = l.x - 1; i < l.x + 2; i++) for (j = l.y - 1; j < l.y + 2; j++) { - if ((i < 0) || (i > ((editing_town == true) ? town->max_dim() - 1 : 47)) - || (j < 0) || (j > ((editing_town == true) ? town->max_dim() - 1 : 47))) + if ((i < 0) || (i > ((editing_town) ? town->max_dim() - 1 : 47)) + || (j < 0) || (j > ((editing_town) ? town->max_dim() - 1 : 47))) ; else { l2.x = i; l2.y = j; - ter = (editing_town == true) ? town->terrain(l2.x,l2.y) : current_terrain.terrain[l2.x][l2.y]; + ter = (editing_town) ? town->terrain(l2.x,l2.y) : current_terrain.terrain[l2.x][l2.y]; if ((!is_mountain(l2.x,l2.y)) && (ter < 5)) { - if (editing_town == true) + if (editing_town) town->terrain(l2.x,l2.y) = 36; else current_terrain.terrain[l2.x][l2.y] = 36; } @@ -1892,7 +1892,7 @@ void set_terrain(location l,ter_num_t terrain_type) { } else { town->terrain(l.x,l.y) = current_ground; - if (sign_error_received == false) { + if (!sign_error_received) { giveError("Towns can have at most 15 signs. Outdoor sections can have at most 8. When the party looks at this sign, they will get no message."); sign_error_received = true; } @@ -1927,7 +1927,7 @@ void set_terrain(location l,ter_num_t terrain_type) { } else { current_terrain.terrain[l.x][l.y] = current_ground; - if (sign_error_received == false) { + if (!sign_error_received) { giveError("Towns can have at most 15 signs. Outdoor sections can have at most 8. When the party looks at this sign, they will get no message."); sign_error_received = true; } @@ -1972,7 +1972,7 @@ bool fix_cave(location l) { j = l.y; store_ter = town->terrain(l.x,l.y); - if (is_correctable_wall(i,j) == true) { + if (is_correctable_wall(i,j)) { /* if (((l.x == 0) || (l.x == town->max_dim() - 1)) && ((l.y == 0) || (l.y == town->max_dim() - 1))) ter_to_fix = 2; else if ((l.x == 0) || (l.x == town->max_dim() - 1)) { @@ -1996,14 +1996,14 @@ bool fix_cave(location l) { } else { // not edge */ - if (is_wall(i-1,j) == false) { - if (is_wall(i,j-1) == false) + if (!is_wall(i-1,j)) { + if (!is_wall(i,j-1)) { ter_to_fix = 11; } else { - if (is_wall(i,j+1) == false) + if (!is_wall(i,j+1)) ter_to_fix = 14; else ter_to_fix = 12; } @@ -2012,31 +2012,31 @@ bool fix_cave(location l) { } - else { // wall(i-1,j) == true - if (is_wall(i+1,j) == false) + else { // wall(i-1,j) + if (!is_wall(i+1,j)) { - if (is_wall(i, j-1) == false) + if (!is_wall(i, j-1)) ter_to_fix = 8; - else if (is_wall(i,j+1) == false) + else if (!is_wall(i,j+1)) ter_to_fix = 5; else ter_to_fix = 6; } - else //wall(i+1,j) == true + else //wall(i+1,j) { - if (is_wall(i, j-1) == false) + if (!is_wall(i, j-1)) ter_to_fix = 9; - else if (is_wall(i,j+1) == false) + else if (!is_wall(i,j+1)) ter_to_fix = 3; - else if (is_wall(i-1,j-1) == false) + else if (!is_wall(i-1,j-1)) ter_to_fix = 16; - else if(is_wall(i-1,j+1) == false) + else if(!is_wall(i-1,j+1)) ter_to_fix = 15; - else if (is_wall(i+1,j-1) == false) + else if (!is_wall(i+1,j-1)) ter_to_fix = 17; - else if (is_wall(i+1,j+1) == false) + else if (!is_wall(i+1,j+1)) ter_to_fix = 18; else ter_to_fix = 2; @@ -2093,14 +2093,14 @@ bool fix_mountain(location l) { } else { // not edge - if (is_mountain(i-1,j) == false) { - if (is_mountain(i,j-1) == false) + if (!is_mountain(i-1,j)) { + if (!is_mountain(i,j-1)) { ter_to_fix = 29; } else { - if (is_mountain(i,j+1) == false) + if (!is_mountain(i,j+1)) ter_to_fix = 31; else ter_to_fix = 30; } @@ -2109,31 +2109,31 @@ bool fix_mountain(location l) { } - else { // wall(i-1,j) == true - if (is_mountain(i+1,j) == false) + else { // wall(i-1,j) + if (!is_mountain(i+1,j)) { - if (is_mountain(i, j-1) == false) + if (!is_mountain(i, j-1)) ter_to_fix = 27; - else if (is_mountain(i,j+1) == false) + else if (!is_mountain(i,j+1)) ter_to_fix = 25; else ter_to_fix = 26; } - else //wall(i+1,j) == true + else //wall(i+1,j) { - if (is_mountain(i, j-1) == false) + if (!is_mountain(i, j-1)) ter_to_fix = 28; - else if (is_mountain(i,j+1) == false) + else if (!is_mountain(i,j+1)) ter_to_fix = 24; - else if (is_mountain(i-1,j-1) == false) + else if (!is_mountain(i-1,j-1)) ter_to_fix = 33; - else if(is_mountain(i-1,j+1) == false) + else if(!is_mountain(i-1,j+1)) ter_to_fix = 32; - else if (is_mountain(i+1,j-1) == false) + else if (!is_mountain(i+1,j-1)) ter_to_fix = 34; - else if (is_mountain(i+1,j+1) == false) + else if (!is_mountain(i+1,j+1)) ter_to_fix = 35; else ter_to_fix = 22; @@ -2188,14 +2188,14 @@ bool fix_hill(location l) { } else { // not edge - if (is_hill_or_mountain(i-1,j) == false) { - if (is_hill_or_mountain(i,j-1) == false) + if (!is_hill_or_mountain(i-1,j)) { + if (!is_hill_or_mountain(i,j-1)) { ter_to_fix = 29; } else { - if (is_hill_or_mountain(i,j+1) == false) + if (!is_hill_or_mountain(i,j+1)) ter_to_fix = 31; else ter_to_fix = 30; } @@ -2204,31 +2204,31 @@ bool fix_hill(location l) { } - else { // wall(i-1,j) == true - if (is_hill_or_mountain(i+1,j) == false) + else { // wall(i-1,j) + if (!is_hill_or_mountain(i+1,j)) { - if (is_hill_or_mountain(i, j-1) == false) + if (!is_hill_or_mountain(i, j-1)) ter_to_fix = 27; - else if (is_hill_or_mountain(i,j+1) == false) + else if (!is_hill_or_mountain(i,j+1)) ter_to_fix = 25; else ter_to_fix = 26; } - else //wall(i+1,j) == true + else //wall(i+1,j) { - if (is_hill_or_mountain(i, j-1) == false) + if (!is_hill_or_mountain(i, j-1)) ter_to_fix = 28; - else if (is_hill_or_mountain(i,j+1) == false) + else if (!is_hill_or_mountain(i,j+1)) ter_to_fix = 24; - else if (is_hill_or_mountain(i-1,j-1) == false) + else if (!is_hill_or_mountain(i-1,j-1)) ter_to_fix = 33; - else if(is_hill_or_mountain(i-1,j+1) == false) + else if(!is_hill_or_mountain(i-1,j+1)) ter_to_fix = 32; - else if (is_hill_or_mountain(i+1,j-1) == false) + else if (!is_hill_or_mountain(i+1,j-1)) ter_to_fix = 34; - else if (is_hill_or_mountain(i+1,j+1) == false) + else if (!is_hill_or_mountain(i+1,j+1)) ter_to_fix = 35; else ter_to_fix = 22; @@ -2286,14 +2286,14 @@ bool fix_water(location l) { } else { // not edge - if (is_water(i-1,j) == false) { - if (is_water(i,j-1) == false) + if (!is_water(i-1,j)) { + if (!is_water(i,j-1)) { ter_to_fix = 29; } else { - if (is_water(i,j+1) == false) + if (!is_water(i,j+1)) ter_to_fix = 31; else ter_to_fix = 30; } @@ -2302,31 +2302,31 @@ bool fix_water(location l) { } - else { // wall(i-1,j) == true - if (is_water(i+1,j) == false) + else { // wall(i-1,j) + if (!is_water(i+1,j)) { - if (is_water(i, j-1) == false) + if (!is_water(i, j-1)) ter_to_fix = 27; - else if (is_water(i,j+1) == false) + else if (!is_water(i,j+1)) ter_to_fix = 25; else ter_to_fix = 26; } - else //wall(i+1,j) == true + else //wall(i+1,j) { - if (is_water(i, j-1) == false) + if (!is_water(i, j-1)) ter_to_fix = 28; - else if (is_water(i,j+1) == false) + else if (!is_water(i,j+1)) ter_to_fix = 24; - else if (is_water(i-1,j-1) == false) + else if (!is_water(i-1,j-1)) ter_to_fix = 33; - else if(is_water(i-1,j+1) == false) + else if(!is_water(i-1,j+1)) ter_to_fix = 32; - else if (is_water(i+1,j-1) == false) + else if (!is_water(i+1,j-1)) ter_to_fix = 34; - else if (is_water(i+1,j+1) == false) + else if (!is_water(i+1,j+1)) ter_to_fix = 35; else ter_to_fix = 22; @@ -2385,7 +2385,7 @@ bool out_fix_cave(location l) { j = l.y; store_ter = current_terrain.terrain[l.x][l.y]; - if (is_correctable_wall(i,j) == true) { + if (is_correctable_wall(i,j)) { if (((l.x == 0) || (l.x == 47)) && ((l.y == 0) || (l.y == 47))) ter_to_fix = 2; else if ((l.x == 0) || (l.x == 47)) { @@ -2409,14 +2409,14 @@ bool out_fix_cave(location l) { } else { // not edge - if (is_wall(i-1,j) == false) { - if (is_wall(i,j-1) == false) + if (!is_wall(i-1,j)) { + if (!is_wall(i,j-1)) { ter_to_fix = 11; } else { - if (is_wall(i,j+1) == false) + if (!is_wall(i,j+1)) ter_to_fix = 14; else ter_to_fix = 12; } @@ -2425,31 +2425,31 @@ bool out_fix_cave(location l) { } - else { // wall(i-1,j) == true - if (is_wall(i+1,j) == false) + else { // wall(i-1,j) + if (!is_wall(i+1,j)) { - if (is_wall(i, j-1) == false) + if (!is_wall(i, j-1)) ter_to_fix = 8; - else if (is_wall(i,j+1) == false) + else if (!is_wall(i,j+1)) ter_to_fix = 5; else ter_to_fix = 6; } - else //wall(i+1,j) == true + else //wall(i+1,j) { - if (is_wall(i, j-1) == false) + if (!is_wall(i, j-1)) ter_to_fix = 9; - else if (is_wall(i,j+1) == false) + else if (!is_wall(i,j+1)) ter_to_fix = 3; - else if (is_wall(i-1,j-1) == false) + else if (!is_wall(i-1,j-1)) ter_to_fix = 16; - else if(is_wall(i-1,j+1) == false) + else if(!is_wall(i-1,j+1)) ter_to_fix = 15; - else if (is_wall(i+1,j-1) == false) + else if (!is_wall(i+1,j-1)) ter_to_fix = 17; - else if (is_wall(i+1,j+1) == false) + else if (!is_wall(i+1,j+1)) ter_to_fix = 18; else ter_to_fix = 2; @@ -2506,14 +2506,14 @@ bool out_fix_mountain(location l) { } else { // not edge - if (is_mountain(i-1,j) == false) { - if (is_mountain(i,j-1) == false) + if (!is_mountain(i-1,j)) { + if (!is_mountain(i,j-1)) { ter_to_fix = 29; } else { - if (is_mountain(i,j+1) == false) + if (!is_mountain(i,j+1)) ter_to_fix = 31; else ter_to_fix = 30; } @@ -2522,31 +2522,31 @@ bool out_fix_mountain(location l) { } - else { // wall(i-1,j) == true - if (is_mountain(i+1,j) == false) + else { // wall(i-1,j) + if (!is_mountain(i+1,j)) { - if (is_mountain(i, j-1) == false) + if (!is_mountain(i, j-1)) ter_to_fix = 27; - else if (is_mountain(i,j+1) == false) + else if (!is_mountain(i,j+1)) ter_to_fix = 25; else ter_to_fix = 26; } - else //wall(i+1,j) == true + else //wall(i+1,j) { - if (is_mountain(i, j-1) == false) + if (!is_mountain(i, j-1)) ter_to_fix = 28; - else if (is_mountain(i,j+1) == false) + else if (!is_mountain(i,j+1)) ter_to_fix = 24; - else if (is_mountain(i-1,j-1) == false) + else if (!is_mountain(i-1,j-1)) ter_to_fix = 33; - else if(is_mountain(i-1,j+1) == false) + else if(!is_mountain(i-1,j+1)) ter_to_fix = 32; - else if (is_mountain(i+1,j-1) == false) + else if (!is_mountain(i+1,j-1)) ter_to_fix = 34; - else if (is_mountain(i+1,j+1) == false) + else if (!is_mountain(i+1,j+1)) ter_to_fix = 35; else ter_to_fix = 22; @@ -2601,14 +2601,14 @@ bool out_fix_hill(location l) { } else { // not edge - if (is_hill_or_mountain(i-1,j) == false) { - if (is_hill_or_mountain(i,j-1) == false) + if (!is_hill_or_mountain(i-1,j)) { + if (!is_hill_or_mountain(i,j-1)) { ter_to_fix = 29; } else { - if (is_hill_or_mountain(i,j+1) == false) + if (!is_hill_or_mountain(i,j+1)) ter_to_fix = 31; else ter_to_fix = 30; } @@ -2617,31 +2617,31 @@ bool out_fix_hill(location l) { } - else { // wall(i-1,j) == true - if (is_hill_or_mountain(i+1,j) == false) + else { // wall(i-1,j) + if (!is_hill_or_mountain(i+1,j)) { - if (is_hill_or_mountain(i, j-1) == false) + if (!is_hill_or_mountain(i, j-1)) ter_to_fix = 27; - else if (is_hill_or_mountain(i,j+1) == false) + else if (!is_hill_or_mountain(i,j+1)) ter_to_fix = 25; else ter_to_fix = 26; } - else //wall(i+1,j) == true + else //wall(i+1,j) { - if (is_hill_or_mountain(i, j-1) == false) + if (!is_hill_or_mountain(i, j-1)) ter_to_fix = 28; - else if (is_hill_or_mountain(i,j+1) == false) + else if (!is_hill_or_mountain(i,j+1)) ter_to_fix = 24; - else if (is_hill_or_mountain(i-1,j-1) == false) + else if (!is_hill_or_mountain(i-1,j-1)) ter_to_fix = 33; - else if(is_hill_or_mountain(i-1,j+1) == false) + else if(!is_hill_or_mountain(i-1,j+1)) ter_to_fix = 32; - else if (is_hill_or_mountain(i+1,j-1) == false) + else if (!is_hill_or_mountain(i+1,j-1)) ter_to_fix = 34; - else if (is_hill_or_mountain(i+1,j+1) == false) + else if (!is_hill_or_mountain(i+1,j+1)) ter_to_fix = 35; else ter_to_fix = 22; @@ -2699,14 +2699,14 @@ bool out_fix_water(location l) { } else { // not edge - if (is_water(i-1,j) == false) { - if (is_water(i,j-1) == false) + if (!is_water(i-1,j)) { + if (!is_water(i,j-1)) { ter_to_fix = 29; } else { - if (is_water(i,j+1) == false) + if (!is_water(i,j+1)) ter_to_fix = 31; else ter_to_fix = 30; } @@ -2715,31 +2715,31 @@ bool out_fix_water(location l) { } - else { // wall(i-1,j) == true - if (is_water(i+1,j) == false) + else { // wall(i-1,j) + if (!is_water(i+1,j)) { - if (is_water(i, j-1) == false) + if (!is_water(i, j-1)) ter_to_fix = 27; - else if (is_water(i,j+1) == false) + else if (!is_water(i,j+1)) ter_to_fix = 25; else ter_to_fix = 26; } - else //wall(i+1,j) == true + else //wall(i+1,j) { - if (is_water(i, j-1) == false) + if (!is_water(i, j-1)) ter_to_fix = 28; - else if (is_water(i,j+1) == false) + else if (!is_water(i,j+1)) ter_to_fix = 24; - else if (is_water(i-1,j-1) == false) + else if (!is_water(i-1,j-1)) ter_to_fix = 33; - else if(is_water(i-1,j+1) == false) + else if(!is_water(i-1,j+1)) ter_to_fix = 32; - else if (is_water(i+1,j-1) == false) + else if (!is_water(i+1,j-1)) ter_to_fix = 34; - else if (is_water(i+1,j+1) == false) + else if (!is_water(i+1,j+1)) ter_to_fix = 35; else ter_to_fix = 22; @@ -2769,37 +2769,37 @@ void adjust_space(location l) { i = l.x; j = l.y; - if ((editing_town == true) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) + if ((editing_town) && ((i < 0) || (i > town->max_dim() - 1) || (j < 0) || (j > town->max_dim() - 1))) return ; - if ((editing_town == false) && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) + if (!editing_town && ((i < 0) || (i > 47) || (j < 0) || (j > 47))) return ; - if (editing_town == true) { - if (fix_rubble(l) == true) + if (editing_town) { + if (fix_rubble(l)) needed_change = true; - if (fix_cave(l) == true) + if (fix_cave(l)) needed_change = true; - if (fix_mountain(l) == true) + if (fix_mountain(l)) needed_change = true; - if (fix_hill(l) == true) + if (fix_hill(l)) needed_change = true; - if (fix_water(l) == true) + if (fix_water(l)) needed_change = true; } - if (editing_town == false) { - if (out_fix_rubble(l) == true) + if (!editing_town) { + if (out_fix_rubble(l)) needed_change = true; - if (out_fix_cave(l) == true) + if (out_fix_cave(l)) needed_change = true; - if (out_fix_mountain(l) == true) + if (out_fix_mountain(l)) needed_change = true; - if (out_fix_hill(l) == true) + if (out_fix_hill(l)) needed_change = true; - if (out_fix_water(l) == true) + if (out_fix_water(l)) needed_change = true; } - if (needed_change == true) { + if (needed_change) { l2 = l; l2.x--; adjust_space(l2); @@ -2863,7 +2863,7 @@ void place_items_in_town() { place_failed = true; } } - if (place_failed == true) + if (place_failed) giveError("Not all of the random items could be placed. The preset item per town limit of 64 was reached."); draw_terrain(); } @@ -2871,7 +2871,7 @@ void place_items_in_town() { void place_edit_special(location loc) { short i,spec; - if (editing_town == true) { + if (editing_town) { for (i = 0; i < 50; i++) if ((town->special_locs[i].x == loc.x) && (town->special_locs[i].y == loc.y)) { edit_spec_enc(town->spec_id[i],2); @@ -2900,7 +2900,7 @@ void place_edit_special(location loc) { } } - if (editing_town == false) { + if (!editing_town) { if ((loc.x == 0) || (loc.x == 47) || (loc.y == 0) || (loc.y == 47)) { cChoiceDlog("not-at-edge.xml").show(); return; @@ -2938,7 +2938,7 @@ void place_edit_special(location loc) { void set_special(location spot_hit) { short x,y; - if (editing_town == true) { + if (editing_town) { for (x = 0; x < 50; x++) if ((town->special_locs[x].x == spot_hit.x) && (town->special_locs[x].y == spot_hit.y)) { y = edit_special_num(2,town->spec_id[x]); @@ -2959,7 +2959,7 @@ void set_special(location spot_hit) { giveError("Each town can have at most 50 locations with special encounters. Each outdoor section can have at most 18. You'll need to erase some special spaces before you can place more."); } } - if (editing_town == false) { + if (!editing_town) { if ((spot_hit.x == 0) || (spot_hit.x == 47) || (spot_hit.y == 0) || (spot_hit.y == 47)) { cChoiceDlog("not-at-edge.xml").show(); return; @@ -3177,7 +3177,7 @@ void start_monster_editing(short just_redo_text) { sprintf((char *) str,"%d - %s",i,(char *) scenario.scen_monsters[i].m_name.c_str()); set_rb(i - 1,2000 + i,(char *) str,0); } - if (draw_full == true) + if (draw_full) redraw_screen(); else for (i = 0; i < NRSONPAGE; i++) draw_rb_slot(i,0); @@ -3205,7 +3205,7 @@ void start_item_editing(short just_redo_text) { sprintf((char *) str,"%d - %s",i,(char *) scenario.scen_items[i].full_name.c_str()); set_rb(i,3000 + i,(char *) str,0); } - if (draw_full == true) + if (draw_full) redraw_screen(); else for (i = 0; i < NRSONPAGE; i++) draw_rb_slot(i,0); @@ -3231,7 +3231,7 @@ void start_special_item_editing() { sprintf((char *) str,"%d - %s",i,(char *) scenario.scen_strs(60 + i * 2)); set_rb(i,10000 + i,(char *) str,0); } - if (draw_full == true) + if (draw_full) redraw_screen(); else for (i = 0; i < NRSONPAGE; i++) draw_rb_slot(i,0); @@ -3275,7 +3275,7 @@ void start_string_editing(short mode,short just_redo_text) { } pos = right_sbar->getPosition(); - if (draw_full == true) + if (draw_full) redraw_screen(); else for (i = 0; i < NRSONPAGE; i++) draw_rb_slot(i + pos,0); @@ -3322,7 +3322,7 @@ void start_special_editing(short mode,short just_redo_text) { break; } } - if (draw_full == true) + if (draw_full) redraw_screen(); else for (i = 0; i < NRSONPAGE; i++) draw_rb_slot(i,0); @@ -3362,7 +3362,7 @@ void start_dialogue_editing(short restoring) { town->talking.talk_nodes[i].personality,s); set_rb(10 + i,12000 + i,(char *) str,0); } - if (draw_full == true) + if (draw_full) redraw_screen(); else for (i = 0; i < NRSONPAGE; i++) draw_rb_slot(i,0); @@ -3372,7 +3372,7 @@ void start_dialogue_editing(short restoring) { bool save_check(std::string which_dlog) { std::string choice; - if (change_made == false) + if (!change_made) return true; change_made = false; choice = cChoiceDlog(which_dlog, {"save","revert","cancel"}).show(); @@ -3394,7 +3394,7 @@ bool is_lava(short x,short y) { ter_num_t coord_to_ter(short x,short y) { ter_num_t what_terrain; - if (editing_town == true) + if (editing_town) what_terrain = town->terrain(x,y); else what_terrain = current_terrain.terrain[x][y]; @@ -3402,7 +3402,7 @@ ter_num_t coord_to_ter(short x,short y) { } bool monst_on_space(location loc,short m_num) { - if (editing_town == false) + if (!editing_town) return false; if (town->creatures(m_num).number == 0) return false; diff --git a/osx/scenedit/scen.core.cpp b/osx/scenedit/scen.core.cpp index a50267dc..0654e13c 100644 --- a/osx/scenedit/scen.core.cpp +++ b/osx/scenedit/scen.core.cpp @@ -137,13 +137,13 @@ static bool save_ter_info(cDialog& me, cTerrain& store_ter) { /* i = CDGN(813,6); if ((store_ter.special < 2) || (store_ter.special > 6)) { - if (cre(i,0,256,"First special flag must be from 0 to 255.","",813) == true) return false; + if (cre(i,0,256,"First special flag must be from 0 to 255.","",813)) return false; } else if(store_ter.special == eTerSpec::DAMAGING) { - if (cre(i,0,256,"First special flag must be from 0 to 100.","",813) == true) return false; + if (cre(i,0,256,"First special flag must be from 0 to 100.","",813)) return false; } else if(store_ter.special == eTerSpec::DANGEROUS) { - if (cre(i,0,256,"First special flag must be from 0 to 8.","",813) == true) return false; + if (cre(i,0,256,"First special flag must be from 0 to 8.","",813)) return false; } */ if(store_ter.special == eTerSpec::NONE) @@ -158,15 +158,15 @@ static bool save_ter_info(cDialog& me, cTerrain& store_ter) { /* if(store_ter.special == eTerSpec::TOWN_ENTRANCE) { - if (cre(i,0,256,"Second special flag must be from 0 to 200.","",813) == true) return false; + if (cre(i,0,256,"Second special flag must be from 0 to 200.","",813)) return false; } else if(store_ter.special == eTerSpec::DAMAGING || store_ter.special == eTerSpec::DANGEROUS) { - if (cre(i,0,256,"Second special flag must be from 0 to 100.","",813) == true) return false; + if (cre(i,0,256,"Second special flag must be from 0 to 100.","",813)) return false; } */ /* - if (cre(i,0,255,"Transform To What must be from 0 to 255.","",813) == true) return false; + if (cre(i,0,255,"Transform To What must be from 0 to 255.","",813)) return false; */ store_ter.trans_to_what = me["trans"].getTextAsNum(); store_ter.fly_over = dynamic_cast(me["flight"]).getState() == led_red; @@ -174,7 +174,7 @@ static bool save_ter_info(cDialog& me, cTerrain& store_ter) { store_ter.block_horse = dynamic_cast(me["horse"]).getState(); store_ter.light_radius = me["light"].getTextAsNum(); /* - if (cre(store_ter.light_radius,0,8,"Light radius must be from 0 to 8.","",813) == true) return false; + if (cre(store_ter.light_radius,0,8,"Light radius must be from 0 to 8.","",813)) return false; */ std::string sound = dynamic_cast(me["sound"]).getSelected(); @@ -1444,10 +1444,10 @@ static bool save_item_placement(cDialog& me, cScenario::cItemStorage& store_stor std::string id = std::to_string(i + 1); store_storage.item_num[i] = me["item" + id].getTextAsNum(); if(cre(store_storage.item_num[i], - -1,399,"All item numbers must be from 0 to 399 (or -1 for No Item).","",&me) == true) return false; + -1,399,"All item numbers must be from 0 to 399 (or -1 for No Item).","",&me)) return false; store_storage.item_odds[i] = me["odds" + id].getTextAsNum(); if(cre(store_storage.item_odds[i], - 0,100,"All item chances must bve from 0 to 100.","",&me) == true) return false; + 0,100,"All item chances must bve from 0 to 100.","",&me)) return false; } scenario.storage_shortcuts[cur_shortcut] = store_storage; return true; @@ -1791,7 +1791,7 @@ bool save_scenario_events() { } scenario.scenario_timer_specs[i] = CDGN(811,12 + i); if (cre(scenario.scenario_timer_specs[i],-1,255,"The scenario special nodes must be between 0 at 255 (or -1 for no special)." - ,"",811) == true) return false; + ,"",811)) return false; } #endif return true; @@ -1814,12 +1814,12 @@ void edit_scenario_events_event_filter (short item_hit) { switch (item_hit) { case 22: - if (save_scenario_events() == true) + if (save_scenario_events()) toast_dialog(); break; default: if ((item_hit >= 30) && (item_hit <= 39)) { - if (save_scenario_events() == false) + if (!save_scenario_events()) break; spec = CDGN(811,item_hit - 30 + 12); if ((spec < 0) || (spec > 255)) { diff --git a/osx/scenedit/scen.fileio.cpp b/osx/scenedit/scen.fileio.cpp index 3a2d2188..609046e9 100644 --- a/osx/scenedit/scen.fileio.cpp +++ b/osx/scenedit/scen.fileio.cpp @@ -65,7 +65,7 @@ void save_scenario() { // legacy::ave_tr_type ave_t; // legacy::tiny_tr_type tiny_t; // - // /*if (check_p(user_given_password) == false) { + // /*if (!check_p(user_given_password)) { // fancy_choice_dialog(868,0); // return; // } @@ -618,7 +618,7 @@ void import_town(short /*which_town*/,fs::path /*temp_file_to_load*/) { // (temp_vers.flag3 == 30) && (temp_vers.flag4 == 40)) { // file_ok = true; // } - // if (file_ok == false) { + // if (!file_ok) { // FSClose(file_id); give_error("This is not a legitimate Blades of Exile scenario.","",0); return; // DisposePtr(buffer); FSClose(file_id); give_error("This is not a legitimate Blades of Exile scenario. If it is a scenario, note that it needs to have been saved by the Macintosh scenario editor.","",0); return; // } @@ -642,13 +642,13 @@ void import_town(short /*which_town*/,fs::path /*temp_file_to_load*/) { // // //// // Now check password - //// if (import_check_p(0) == false) { + //// if (!import_check_p(0)) { //// import_user_given_password = enter_password(); - //// if (import_check_p(import_user_given_password) == false) { + //// if (!import_check_p(import_user_given_password)) { //// fancy_choice_dialog(868,0); //// if (overall_mode != 61) { //// import_user_given_password = enter_password(); - //// if (import_check_p(import_user_given_password) == false) + //// if (!import_check_p(import_user_given_password)) //// ExitToShell(); //// } //// else return; diff --git a/osx/scenedit/scen.graphics.cpp b/osx/scenedit/scen.graphics.cpp index 5fdc9568..d8c2a918 100644 --- a/osx/scenedit/scen.graphics.cpp +++ b/osx/scenedit/scen.graphics.cpp @@ -561,7 +561,7 @@ void set_up_terrain_buttons() { if (overall_mode < MODE_MAIN_SCREEN) { // palette_to.left = 5; // palette_to.top = terrain_rects[255].bottom + 5; - // if (editing_town == true) { + // if (editing_town) { // palette_from.bottom = palette_buttons[0][5].bottom; // palette_from.right = palette_buttons[7][5].right; // } @@ -617,7 +617,7 @@ void draw_terrain(){ { where_draw.x = q; where_draw.y = r; - if (editing_town == true) { + if (editing_town) { t_to_draw = town->terrain(cen_x + q - 4,cen_y + r - 4); } else { @@ -643,7 +643,7 @@ void draw_terrain(){ tiny_to.offset(28 * q, 36 * r); // draw start icon, if starting point - if ((editing_town == true) && + if ((editing_town) && (cur_town == scenario.which_town_start) && (scenario.where_start.x == cen_x + q - 4) && (scenario.where_start.y == cen_y + r - 4)) { from_rect = start_button_from; @@ -652,7 +652,7 @@ void draw_terrain(){ rect_draw_some_item(editor_mixed,from_rect,ter_draw_gworld,to_rect); tiny_to.offset(0,-7); } - if ((editing_town == false) + if (!editing_town && (scenario.out_sec_start.x == cur_out.x) && (scenario.out_sec_start.y == cur_out.y) && (scenario.out_start.x == cen_x + q - 4) @@ -671,7 +671,7 @@ void draw_terrain(){ tiny_to.offset(0,-7); } - if (is_special(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_special(cen_x + q - 4,cen_y + r - 4)) { tiny_from = base_small_button_from; tiny_from.offset(7 * (7),7 * (0)); rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to); @@ -683,9 +683,9 @@ void draw_terrain(){ rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to); tiny_to.offset(0,-7); } - //if (is_s_d(cen_x + q - 4,cen_y + r - 4) == true) { + //if (is_s_d(cen_x + q - 4,cen_y + r - 4)) { // } - if (editing_town == false) { + if (!editing_town) { for (i = 0; i < 4; i++) if ((cen_x + q - 4 == current_terrain.wandering_locs[i].x) && (cen_y + r - 4 == current_terrain.wandering_locs[i].y)) { @@ -698,7 +698,7 @@ void draw_terrain(){ } - if (editing_town == true) { + if (editing_town) { for (i = 0; i < 30; i++) { if ((scenario.boats[i].which_town == cur_town) && (scenario.boats[i].loc.x == cen_x + q - 4) && @@ -732,27 +732,27 @@ void draw_terrain(){ tiny_to.offset(0,-7); i = 4; } - if (is_web(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_web(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(5,0); Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha); } - if (is_crate(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_crate(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(6,0); Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha); } - if (is_barrel(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_barrel(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(7,0); Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha); } - if (is_fire_barrier(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_fire_barrier(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(0,2); Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha); } - if (is_quickfire(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_quickfire(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(7,1); Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha); } - if (is_force_barrier(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_force_barrier(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(2,2); Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha); } @@ -772,14 +772,14 @@ void draw_terrain(){ } } - if (editing_town == true) { + if (editing_town) { draw_monsts(); draw_items(); } clip_rect(ter_draw_gworld,clipping_rect); - if (editing_town == true) { + if (editing_town) { // draw info rects for (i = 0; i < 16; i++) if (town->room_rect(i).left > 0) { @@ -796,7 +796,7 @@ void draw_terrain(){ draw_rect.bottom = 25 + 36 * (town->in_town_rect.bottom - cen_y + 4); frame_rect(ter_draw_gworld, draw_rect, sf::Color::White); } - if (editing_town == false) { + if (!editing_town) { // draw info rects for (i = 0; i < 8; i++) if (current_terrain.info_rect[i].left > 0) { @@ -815,14 +815,14 @@ void draw_terrain(){ } if (cur_viewing_mode == 1) { - if (small_any_drawn == false) { + if (!small_any_drawn) { tileImage(ter_draw_gworld, terrain_rect,bg[17]); frame_rect(ter_draw_gworld, terrain_rect, sf::Color::Black); } for (q = 0; q < (editing_town ? town->max_dim() : 48); q++) for (r = 0; r < (editing_town ? town->max_dim() : 48); r++) { t_to_draw = editing_town ? town->terrain(q,r) : current_terrain.terrain[q][r]; - if ((small_what_drawn[q][r] != t_to_draw) || (small_any_drawn == false)) { + if (!small_what_drawn[q][r] != t_to_draw || small_any_drawn) { draw_one_tiny_terrain_spot(q,r,t_to_draw); small_what_drawn[q][r] = t_to_draw; } @@ -1272,11 +1272,11 @@ void set_string(const char *string,const char *string2) { bool is_special(short i,short j) { short k; - if (editing_town == true) + if (editing_town) for (k = 0; k < 50; k++) if ((town->special_locs[k].x == i) && (town->special_locs[k].y == j)) return true; - if (editing_town == false) + if (!editing_town) for (k = 0; k < 18; k++) if ((current_terrain.special_locs[k].x == i) && (current_terrain.special_locs[k].y == j)) return true; @@ -1314,7 +1314,7 @@ bool is_field_type(short i,short j,short field_type) { void make_field_type(short i,short j,short field_type) { unsigned short k; - if (is_field_type(i,j,field_type) == true) + if (is_field_type(i,j,field_type)) return; for (k = 0; k < town->preset_fields.size(); k++) if (town->preset_fields[k].type == 0) { @@ -1419,13 +1419,13 @@ void take_quickfire(short i,short j) { } bool container_there(location l) { - if (editing_town == false) + if (!editing_town) return false; if(scenario.ter_types[town->terrain(l.x,l.y)].special == eTerSpec::IS_A_CONTAINER) return true; - if (is_barrel(l.x,l.y) == true) + if (is_barrel(l.x,l.y)) return true; - if (is_crate(l.x,l.y) == true) + if (is_crate(l.x,l.y)) return true; return 0; } diff --git a/osx/scenedit/scen.keydlgs.cpp b/osx/scenedit/scen.keydlgs.cpp index 2643652e..394e8737 100644 --- a/osx/scenedit/scen.keydlgs.cpp +++ b/osx/scenedit/scen.keydlgs.cpp @@ -608,7 +608,7 @@ static bool edit_spec_enc_event_filter(cDialog& me, std::string item_hit, short& put_spec_enc_in_dlog(me, which_node); } } else if(item_hit == "general") { - if(save_spec_enc(me, which_mode, which_node) == true) + if(save_spec_enc(me, which_mode, which_node)) return true; // TODO: I wonder if this can all be achieved without casts... if not, at least check getNodeCategory to ensure validity. i = choose_text_res("special-node-names",1,28,int(store_spec_node.type) + 1,&me,"Choose General Use Special:"); diff --git a/osx/scenedit/scen.main.cpp b/osx/scenedit/scen.main.cpp index 579d6d65..5eae3545 100644 --- a/osx/scenedit/scen.main.cpp +++ b/osx/scenedit/scen.main.cpp @@ -128,7 +128,7 @@ int main(int, char* argv[]) { check_for_intel(); redraw_screen(); - while (All_Done == false) + while (!All_Done) Handle_One_Event(); close_program(); @@ -267,7 +267,7 @@ void handle_scenario_menu(int item_hit) { switch (item_hit) { case 1: // Create new town - if (change_made == true) { + if (change_made) { giveError("You need to save the changes made to your scenario before you can add a new town."); return; } @@ -275,7 +275,7 @@ void handle_scenario_menu(int item_hit) { giveError("You have reached the limit of 200 towns you can have in one scenario."); return; } - if (new_town(scenario.num_towns) == true) + if (new_town(scenario.num_towns)) set_up_main_screen(); break; case 3: // Scenario Details @@ -288,7 +288,7 @@ void handle_scenario_menu(int item_hit) { set_starting_loc(); break; case 6: // Change Password -// if (check_p(user_given_password) == true) { +// if (check_p(user_given_password)) { // user_given_password = get_password(); // given_password = true; // } @@ -303,7 +303,7 @@ void handle_scenario_menu(int item_hit) { start_string_editing(0,0); break; case 11: // Import Town - if (change_made == true) { + if (change_made) { giveError("You need to save the changes made to your scenario before you can add a new town."); return; } @@ -333,7 +333,7 @@ void handle_scenario_menu(int item_hit) { edit_item_placement(); break; case 18: // Delete Last Town - if (change_made == true) { + if (change_made) { giveError("You need to save the changes made to your scenario before you can delete a town."); return; } diff --git a/osx/scenedit/scen.townout.cpp b/osx/scenedit/scen.townout.cpp index 13eda830..88eb1651 100644 --- a/osx/scenedit/scen.townout.cpp +++ b/osx/scenedit/scen.townout.cpp @@ -252,13 +252,13 @@ void put_placed_item_in_dlog() { csit(836,22,(char *) str); csit(836,15,scenario.scen_items[store_placed_item.code].full_name.c_str()); CDSN(836,2,store_placed_item.ability); - if (store_placed_item.always_there == true) + if (store_placed_item.always_there) cd_set_led(836,12,1); else cd_set_led(836,12,0); - if (store_placed_item.property == true) + if (store_placed_item.property) cd_set_led(836,13,1); else cd_set_led(836,13,0); - if (store_placed_item.contained == true) + if (store_placed_item.contained) cd_set_led(836,14,1); else cd_set_led(836,14,0); @@ -298,7 +298,7 @@ void edit_placed_item_event_filter (short item_hit) { #if 0 switch (item_hit) { case 3: - if (get_placed_item_in_dlog() == false) + if (!get_placed_item_in_dlog()) break; toast_dialog(); break; @@ -342,7 +342,7 @@ void edit_sign_event_filter (short item_hit) { #if 0 switch (item_hit) { case 9: case 4: - if (editing_town == false) + if (!editing_town) CDGT(831,2,current_terrain.out_strs(100 + store_which_sign)); else CDGT(831,2,town->town_strs(120 + store_which_sign)); if (item_hit == 9) @@ -352,8 +352,8 @@ void edit_sign_event_filter (short item_hit) { store_which_sign--; else store_which_sign++; if (store_which_sign < 0) - store_which_sign = (editing_town == true) ? 14 : 7; - if (store_which_sign > (editing_town == true) ? 14 : 7) + store_which_sign = (editing_town) ? 14 : 7; + if (store_which_sign > (editing_town) ? 14 : 7) store_which_sign = 0; } break; @@ -362,7 +362,7 @@ void edit_sign_event_filter (short item_hit) { break; } cdsin(831,5,store_which_sign); - if (editing_town == false) + if (!editing_town) CDST(831,2,current_terrain.out_strs(100 + store_which_sign)); else CDST(831,2,town->town_strs(120 + store_which_sign)); #endif @@ -384,7 +384,7 @@ void edit_sign(short which_sign,short picture) { else csp(831,6,picture,PICT_TER); cdsin(831,5,store_which_sign); - if (editing_town == false) + if (!editing_town) CDST(831,2,current_terrain.out_strs(100 + store_which_sign)); else CDST(831,2,town->town_strs(120 + store_which_sign)); //cd_activate_item(831,3,0); @@ -432,7 +432,7 @@ void edit_out_strs_event_filter (short item_hit) { #if 0 switch (item_hit) { case 10: - if (save_out_strs() == true) + if (save_out_strs()) toast_dialog(); break; case 11: @@ -504,7 +504,7 @@ void edit_town_strs_event_filter (short item_hit) { #if 0 switch (item_hit) { case 18: - if (save_town_strs() == true) + if (save_town_strs()) toast_dialog(); break; case 19: @@ -591,9 +591,9 @@ void change_ter_event_filter (short item_hit) { a = CDGN(857,2); b = CDGN(857,3); c = CDGN(857,4); - if (cre(a,0,255,"Both terrain types must be from 0 to 255.","",857) == true) break; - if (cre(b,0,255,"Both terrain types must be from 0 to 255.","",857) == true) break; - if (cre(c,0,100,"The Chance must be from 0 to 100.","",857) == true) break; + if (cre(a,0,255,"Both terrain types must be from 0 to 255.","",857)) break; + if (cre(b,0,255,"Both terrain types must be from 0 to 255.","",857)) break; + if (cre(c,0,100,"The Chance must be from 0 to 100.","",857)) break; toast_dialog(); break; @@ -710,15 +710,15 @@ bool get_out_wand_in_dlog() { store_out_wand.end_spec1 = CDGN(852,5); store_out_wand.end_spec2 = CDGN(852,6); if (cre(store_out_wand.end_spec1, - -1,299,"First part of Stuff Done flag must be from 0 to 299 (or -1 if it's not used).","",852) == true) return false; + -1,299,"First part of Stuff Done flag must be from 0 to 299 (or -1 if it's not used).","",852)) return false; if (cre(store_out_wand.end_spec2, - -1,9,"Second part of Stuff Done flag must be from 0 to 9 (or -1 if it's not used).","",852) == true) return false; + -1,9,"Second part of Stuff Done flag must be from 0 to 9 (or -1 if it's not used).","",852)) return false; if (cre(store_out_wand.spec_on_meet, - -1,59,"Outdoor Special Nodes run from 0 to 59 (or -1 if not used).","",852) == true) return false; + -1,59,"Outdoor Special Nodes run from 0 to 59 (or -1 if not used).","",852)) return false; if (cre(store_out_wand.spec_on_win, - -1,59,"Outdoor Special Nodes run from 0 to 59 (or -1 if not used).","",852) == true) return false; + -1,59,"Outdoor Special Nodes run from 0 to 59 (or -1 if not used).","",852)) return false; if (cre(store_out_wand.spec_on_flee, - -1,59,"Outdoor Special Nodes run from 0 to 59 (or -1 if not used).","",852) == true) return false; + -1,59,"Outdoor Special Nodes run from 0 to 59 (or -1 if not used).","",852)) return false; store_out_wand.cant_flee = 0; if (cd_get_led(852,53) > 0) @@ -739,7 +739,7 @@ void edit_out_wand_event_filter (short item_hit) { #if 0 switch (item_hit) { case 17: - if (get_out_wand_in_dlog() == false) + if (!get_out_wand_in_dlog()) break; toast_dialog(); break; @@ -747,7 +747,7 @@ void edit_out_wand_event_filter (short item_hit) { toast_dialog(); break; case 19: - if (get_out_wand_in_dlog() == false) break; + if (!get_out_wand_in_dlog()) break; store_which_out_wand--; if (store_which_out_wand < 0) store_which_out_wand = 3; store_out_wand = (store_out_wand_mode == 0) ? @@ -755,7 +755,7 @@ void edit_out_wand_event_filter (short item_hit) { put_out_wand_in_dlog(); break; case 20: - if (get_out_wand_in_dlog() == false) break; + if (!get_out_wand_in_dlog()) break; store_which_out_wand++; if (store_which_out_wand > 3) store_which_out_wand = 0; store_out_wand = (store_out_wand_mode == 0) ? @@ -763,7 +763,7 @@ void edit_out_wand_event_filter (short item_hit) { put_out_wand_in_dlog(); break; case 31: case 32: case 33: - if (get_out_wand_in_dlog() == false) + if (!get_out_wand_in_dlog()) break; spec = CDGN(852,item_hit - 29); if ((spec < 0) || (spec >= 60)) { @@ -778,11 +778,11 @@ void edit_out_wand_event_filter (short item_hit) { edit_spec_enc(spec,1,852); if ((spec >= 0) && (spec < 60) && (current_terrain.specials[spec].pic < 0)) CDSN(852,item_hit - 29,-1); - if (get_out_wand_in_dlog() == false) + if (!get_out_wand_in_dlog()) break; break; default: - if (get_out_wand_in_dlog() == false) + if (!get_out_wand_in_dlog()) break; cd_flip_led(852,51,item_hit); cd_flip_led(852,53,item_hit); @@ -831,15 +831,15 @@ bool save_town_details() { sprintf(town->town_strs(0),"%-29.29s",str); town->town_chop_time = CDGN(832,3); if (cre(town->town_chop_time,-1,10000,"The day the town becomes abandoned must be from 0 to 10000 (or -1 if it doesn't)." - ,"",832) == true) return false; + ,"",832)) return false; town->town_chop_key = CDGN(832,4); if (cre(town->town_chop_key,-1,10,"The event which prevents the town from becoming abandoned must be from 1 to 10 (-1 or 0 for none)." - ,"",832) == true) return false; + ,"",832)) return false; town->lighting_type = cd_get_led_range(832,19,22); town->max_num_monst = CDGN(832,5); town->difficulty = CDGN(832,6); if (cre(town->difficulty,0,10,"The town difficulty must be between 0 (easiest) and 10 (hardest)." - ,"",832) == true) return false; + ,"",832)) return false; #endif return true; } @@ -859,7 +859,7 @@ void edit_town_details_event_filter (short item_hit) { #if 0 switch (item_hit) { case 7: - if (save_town_details() == true) + if (save_town_details()) toast_dialog(); break; default: @@ -889,7 +889,7 @@ bool save_town_events() { town->timer_spec_times[i] = CDGN(833,2 + i); town->timer_specs[i] = CDGN(833,10 + i); if (cre(town->timer_specs[i],-1,99,"The town special nodes must be between 0 at 99 (or -1 for no special)." - ,"",833) == true) return false; + ,"",833)) return false; } #endif return true; @@ -910,12 +910,12 @@ void edit_town_events_event_filter (short item_hit) { #if 0 switch (item_hit) { case 18: - if (save_town_events() == true) + if (save_town_events()) toast_dialog(); break; default: if ((item_hit >= 26) && (item_hit <= 33)) { - if (save_town_events() == false) + if (!save_town_events()) break; spec = CDGN(833,item_hit - 26 + 10); if ((spec < 0) || (spec > 99)) { @@ -957,20 +957,20 @@ bool save_advanced_town() { for (i = 0; i < 4; i++) { town->exit_specs[i] = CDGN(834,2 + i); if (cre(town->exit_specs[i],-1,99,"The town exit specials must be between 0 at 99 (or -1 for no special)." - ,"",834) == true) return false; + ,"",834)) return false; town->exit_locs[i].x = CDGN(834,8 + i * 2); if (cre(town->exit_locs[i].x,-1,47,"The town exit coordinates must be from 0 to 47 (or -1 if you want them ignored)." - ,"",834) == true) return false; + ,"",834)) return false; town->exit_locs[i].y = CDGN(834,9 + i * 2); if (cre(town->exit_locs[i].y,-1,47,"The town exit coordinates must be from 0 to 47 (or -1 if you want them ignored)." - ,"",834) == true) return false; + ,"",834)) return false; } town->spec_on_entry = CDGN(834,6); town->spec_on_entry_if_dead = CDGN(834,7); if (cre(town->spec_on_entry,-1,99,"The town entry specials must be from 0 to 99 (or -1 for no special)." - ,"",834) == true) return false; + ,"",834)) return false; if (cre(town->spec_on_entry_if_dead,-1,99,"The town entry specials must be from 0 to 99 (or -1 for no special)." - ,"",834) == true) return false; + ,"",834)) return false; scenario.town_hidden[cur_town] = cd_get_led(834,37); #endif return true; @@ -994,7 +994,7 @@ void edit_advanced_town_event_filter (short item_hit) { #if 0 switch (item_hit) { case 16: - if (save_advanced_town() == true) + if (save_advanced_town()) toast_dialog(); break; case 17: @@ -1030,7 +1030,7 @@ bool save_town_wand() { { town->wandering[i].monst[j] = CDGN(835,2 + i * 4 + j); if (cre(town->wandering[i].monst[j],0,255,"Wandering monsters must all be from 0 to 255 (0 means no monster)." - ,"",835) == true) return false; + ,"",835)) return false; } #endif return true; @@ -1052,7 +1052,7 @@ void edit_town_wand_event_filter (short item_hit) { #if 0 switch (item_hit) { case 18: - if (save_town_wand() == true) + if (save_town_wand()) toast_dialog(); break; case 27: case 28: case 29: case 30: @@ -1111,20 +1111,20 @@ void edit_basic_dlog_event_filter (short item_hit) { #if 0 switch (item_hit) { case 7: - if (save_basic_dlog() == true) + if (save_basic_dlog()) toast_dialog(); break; case 8: toast_dialog(); break; case 9: - if (save_basic_dlog() == false) break; + if (!save_basic_dlog()) break; store_which_talk_node--; if (store_which_talk_node < 0) store_which_talk_node = 9; put_basic_dlog_in_dlog(); break; case 10: - if (save_basic_dlog() == false) break; + if (!save_basic_dlog()) break; store_which_talk_node++; if (store_which_talk_node > 9) store_which_talk_node = 0; put_basic_dlog_in_dlog(); @@ -1282,11 +1282,11 @@ void edit_talk_node_event_filter (short item_hit) { #if 0 switch (item_hit) { case 11: - if (save_talk_node() == true) + if (save_talk_node()) toast_dialog(); break; case 13: //go_back - if (save_talk_node() == false) + if (!save_talk_node()) break; for (i = 0; i < 60; i++) if (last_talk_node[i] < 0) { @@ -1300,7 +1300,7 @@ void edit_talk_node_event_filter (short item_hit) { toast_dialog(); break; case 14: - if (save_talk_node() == false) + if (!save_talk_node()) break; spec = -1; @@ -1325,7 +1325,7 @@ void edit_talk_node_event_filter (short item_hit) { break; case 28: - if (save_talk_node() == false) + if (!save_talk_node()) break; i = choose_text_res(-5,0,30,store_talk_node.type,817,"What Talking Node type?"); if (i >= 0) { @@ -1360,7 +1360,7 @@ void edit_talk_node_event_filter (short item_hit) { } break; case 38: - if (save_talk_node() == false) + if (!save_talk_node()) break; spec = CDGN(817,5); if ((spec < 0) || (spec >= 100)) { @@ -1385,7 +1385,7 @@ void edit_talk_node_event_filter (short item_hit) { if ((spec >= 0) && (spec < 256) && (scenario.scen_specials[spec].pic < 0)) CDSN(817,5,-1); } - if (save_talk_node() == false) + if (!save_talk_node()) break; break; } @@ -1611,7 +1611,7 @@ short pick_import_town(short def, fs::path& temp_file_to_load) { NavChooseFile(NULL,&s_reply,NULL,NULL,NULL,NULL,NULL,NULL); - if (s_reply.validRecord == false) + if (!s_reply.validRecord) return -1; AEKeyword keyword; DescType descType; diff --git a/osx/tools/fileio.cpp b/osx/tools/fileio.cpp index fc07fd7b..9fd2a73c 100644 --- a/osx/tools/fileio.cpp +++ b/osx/tools/fileio.cpp @@ -106,7 +106,7 @@ bool load_scenario(fs::path file_to_load, bool skip_strings){ cur_scen_is_mac = false; file_ok = true; } - if (file_ok == false) { + if (!file_ok) { fclose(file_id); giveError("This is not a legitimate Blades of Exile scenario."); return false; diff --git a/osx/tools/graphtool.cpp b/osx/tools/graphtool.cpp index e104f588..bd0298c6 100644 --- a/osx/tools/graphtool.cpp +++ b/osx/tools/graphtool.cpp @@ -414,7 +414,7 @@ void draw_terrain(){ for (r = 0; r < 9; r++) { where_draw.x = q; where_draw.y = r; - if (editing_town == true) { + if (editing_town) { t_to_draw = t_d.terrain[cen_x + q - 4][cen_y + r - 4]; } else { @@ -436,7 +436,7 @@ void draw_terrain(){ OffsetRect(&tiny_to,28 * q, 36 * r); // draw start icon, if starting point - if ((editing_town == true) && + if ((editing_town) && (cur_town == scenario.which_town_start) && (scenario.where_start.x == cen_x + q - 4) && (scenario.where_start.y == cen_y + r - 4)) { from_rect = start_button_from; @@ -445,7 +445,7 @@ void draw_terrain(){ rect_draw_some_item(editor_mixed,from_rect,ter_draw_gworld,to_rect,0,0); OffsetRect(&tiny_to,0,-7); } - if ((editing_town == false) + if (!editing_town && (scenario.out_sec_start.x == cur_out.x) && (scenario.out_sec_start.y == cur_out.y) && (scenario.out_start.x == cen_x + q - 4) @@ -468,7 +468,7 @@ void draw_terrain(){ OffsetRect(&tiny_to,0,-7); } - if (is_special(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_special(cen_x + q - 4,cen_y + r - 4)) { tiny_from = base_small_button_from; OffsetRect(&tiny_from,7 * (7),7 * (0)); rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); @@ -480,9 +480,9 @@ void draw_terrain(){ rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); OffsetRect(&tiny_to,0,-7); } - //if (is_s_d(cen_x + q - 4,cen_y + r - 4) == true) { + //if (is_s_d(cen_x + q - 4,cen_y + r - 4)) { // } - if (editing_town == false) { + if (!editing_town) { for (i = 0; i < 4; i++) if ((cen_x + q - 4 == current_terrain.wandering_locs[i].x) && (cen_y + r - 4 == current_terrain.wandering_locs[i].y)) { @@ -495,7 +495,7 @@ void draw_terrain(){ } - if (editing_town == true) { + if (editing_town) { for (i = 0; i < 30; i++) { if ((scenario.scen_boats[i].which_town == cur_town) && (scenario.scen_boats[i].boat_loc.x == cen_x + q - 4) && @@ -530,27 +530,27 @@ void draw_terrain(){ OffsetRect(&tiny_to,0,-7); i = 4; } - if (is_web(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_web(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(5,0); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); } - if (is_crate(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_crate(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(6,0); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); } - if (is_barrel(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_barrel(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(7,0); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); } - if (is_fire_barrier(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_fire_barrier(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(0,2); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); } - if (is_quickfire(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_quickfire(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(7,1); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); } - if (is_force_barrier(cen_x + q - 4,cen_y + r - 4) == true) { + if (is_force_barrier(cen_x + q - 4,cen_y + r - 4)) { from_rect = calc_rect(2,2); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); } @@ -570,7 +570,7 @@ void draw_terrain(){ } } - if (editing_town == true) { + if (editing_town) { draw_monsts(); draw_items(); } @@ -578,7 +578,7 @@ void draw_terrain(){ SetPort( ter_draw_gworld); ClipRect(&clipping_rect); - if (editing_town == true) { + if (editing_town) { // draw info rects for (i = 0; i < 16; i++) if (t_d.room_rect[i].left > 0) { @@ -599,7 +599,7 @@ void draw_terrain(){ FrameRect(&draw_rect); ForeColor(blackColor); } - if (editing_town == false) { + if (!editing_town) { // draw info rects for (i = 0; i < 8; i++) if (current_terrain.info_rect[i].left > 0) { @@ -622,15 +622,15 @@ void draw_terrain(){ if (cur_viewing_mode == 1) { SetPort( ter_draw_gworld); - if (small_any_drawn == false) { + if (!small_any_drawn) { FillCRect(&terrain_rect,bg_rects[6]); FrameRect(&terrain_rect); } - for (q = 0; q < ((editing_town == true) ? max_dim[town_type] : 48); q++) - for (r = 0; r < ((editing_town == true) ? max_dim[town_type] : 48); r++) { - t_to_draw = (editing_town == true) ? t_d.terrain[q][r] : + for (q = 0; q < ((editing_town) ? max_dim[town_type] : 48); q++) + for (r = 0; r < ((editing_town) ? max_dim[town_type] : 48); r++) { + t_to_draw = (editing_town) ? t_d.terrain[q][r] : current_terrain.terrain[q][r]; - if ((small_what_drawn[q][r] != t_to_draw) || (small_any_drawn == false)) { + if ((small_what_drawn[q][r] != t_to_draw) || !small_any_drawn) { draw_one_tiny_terrain_spot(q,r,t_to_draw); small_what_drawn[q][r] = t_to_draw; } diff --git a/osx/tools/soundtool.cpp b/osx/tools/soundtool.cpp index 027ea456..b7587abb 100644 --- a/osx/tools/soundtool.cpp +++ b/osx/tools/soundtool.cpp @@ -137,7 +137,7 @@ void play_sound(short which, short how_many_times) { // if < 0, play asynch if (which >= 100) return; - if ((always_asynch[which] == true) && + if ((always_asynch[which]) && ((can_ignore[which] == 1) || (can_ignore[which] >= 3))) asyn = true; if ((can_ignore[which] > 0) && (can_ignore[which] < 5) && (party.stuff_done[305][5] == 1)) @@ -146,10 +146,10 @@ void play_sound(short which, short how_many_times) { // if < 0, play asynch asyn = false; if ((party.stuff_done[305][5] == 1) && (can_ignore[which] < 5)) asyn = false; - if (not_asyn == true) + if (not_asyn) asyn = false; - if ((load_when_play[which] == true) && (sound_handles[which] == NULL)) { + if ((load_when_play[which]) && (sound_handles[which] == NULL)) { asyn = false; sprintf((char *)snd_name,"#%d",which + 1); h = FindResource(hModule,snd_name,"#100"); @@ -162,12 +162,12 @@ void play_sound(short which, short how_many_times) { // if < 0, play asynch if (store_last_sound_played == 6) sndPlaySound(NULL,0); - if (asyn == true) { + if (asyn) { if (can_ignore[which] >= 4) check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY | SND_NOSTOP); else check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY); - while (check_sound == false) { + while (!check_sound) { if (can_ignore[store_last_sound_played] == 4) {// then sound goes away return; @@ -196,7 +196,7 @@ void play_sound(short which, short how_many_times) { // if < 0, play asynch if (can_ignore[which] >= 4) check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY | SND_NOSTOP); else check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY); - while (check_sound == false) { + while (!check_sound) { if (can_ignore[store_last_sound_played] == 4) {// then sound goes away return; } @@ -223,12 +223,12 @@ void play_sound(short which, short how_many_times) { // if < 0, play asynch store_last_sound_played = which; - if ((load_when_play[which] == true) && (asyn == false)) + if ((load_when_play[which]) && !asyn) sound_handles[which] = NULL; for (i = 0; i < NUM_SOUNDS; i++) - if ((load_when_play[which] == true) && (sound_handles[which] != NULL) - && (a_sound_did_get_played == true) && (i != which)) + if ((load_when_play[which]) && (sound_handles[which] != NULL) + && (a_sound_did_get_played) && (i != which)) { sound_handles[i] = NULL; } @@ -256,7 +256,7 @@ void clear_sound_memory(){ void flip_sound() { - play_sounds = (play_sounds == true) ? false : true; + play_sounds = (play_sounds) ? false : true; } @@ -320,7 +320,7 @@ void load_sounds(HMODULE handle) for (i = 0; i < NUM_SOUNDS; i++) { sound_handles[i] = NULL; - if (load_when_play[i] == false) { + if (!load_when_play[i]) { sprintf((char *)snd_name,"#%d",i + 1); h = FindResource(handle,snd_name,"#100");