Several little fixes

- Fix custom missiles causing a crash if graphic not found
- Fix display in transcript of damage taken by monsters
- Fix missile start items not having their missile graphic set
- Fix immunity fields being signed (which would've prevented immunities from working properly)
- Don't bother generating a random number if min and max are the same
- Fix monster attack types not showing right
- Fix checking for item abilities returning 0 instead of 24 when not found
- Fix not updating screen when switching active PC
This commit is contained in:
2015-01-15 14:18:49 -05:00
parent 399572adf6
commit 7b55262ed4
9 changed files with 20 additions and 18 deletions

View File

@@ -630,7 +630,7 @@ static void handle_bash_pick(location destination, bool& did_something, bool& ne
put_item_screen(stat_window,0);
}
static void handle_switch_pc(short which_pc) {
static void handle_switch_pc(short which_pc, bool& need_redraw) {
if(!prime_time() && overall_mode != MODE_SHOPPING && overall_mode != MODE_TALKING)
add_string_to_buf("Set active: Finish what you're doing first.");
else if(is_combat())
@@ -643,6 +643,7 @@ static void handle_switch_pc(short which_pc) {
set_stat_window(which_pc);
add_string_to_buf("Now " + std::string(overall_mode == MODE_SHOPPING ? "shopping" : "active") + ": " + univ.party[which_pc].name);
adjust_spell_menus();
need_redraw = true;
}
}
@@ -1225,7 +1226,8 @@ bool handle_action(sf::Event event) {
pc_buttons[i][j].offset(-PC_WIN_UL_X,-PC_WIN_UL_Y);
switch(j) {
case 0:
handle_switch_pc(i);
handle_switch_pc(i, need_redraw);
need_reprint = true;
break;
case 1:
str.str("");

View File

@@ -238,7 +238,7 @@ short pc_has_abil_equip(short pc_num,eItemAbil abil,short dat) {
if(dat >= 0 && dat != univ.party[pc_num].items[i].abil_data[1]) continue;
return i;
}
return 0;
return 24;
}
short pc_has_abil(short pc_num,eItemAbil abil,short dat) {
@@ -248,7 +248,7 @@ short pc_has_abil(short pc_num,eItemAbil abil,short dat) {
if(dat >= 0 && dat != univ.party[pc_num].items[i].abil_data[1]) continue;
return i;
}
return 0;
return 24;
}
bool party_has_abil(eItemAbil abil,short dat) {

View File

@@ -451,8 +451,9 @@ void do_missile_anim(short num_steps,location missile_origin,short sound_num) {
base -= 10000;
} else base -= 1000;
base += step % 4;
sf::Texture* from_gw;
sf::Texture* from_gw = nullptr;
graf_pos_ref(from_gw, from_rect) = spec_scen_g.find_graphic(base, isParty);
if(from_gw == nullptr) continue;
from_rect.width() = 18;
from_rect.height() = 18;
if(step >= 4)

View File

@@ -940,7 +940,7 @@ void print_monst_attacks(mon_num_t m_type,short target) {
void damaged_message(short damage,short type) {
std::ostringstream sout;
sout << " " << get_str("monster-abilities",130 + type);
sout << " " << get_str("monster-abilities",130 + type);
sout << " for " << damage;
add_string_to_buf(sout.str().c_str());
}
@@ -1150,9 +1150,8 @@ void monst_breathe_note(mon_num_t number) {
void monst_damaged_mes(mon_num_t which_m,short how_much,short how_much_spec) {
std::string msg = get_m_name(univ.town.monst[which_m].number);
msg = " " + msg + " takes ";
std::ostringstream sout(msg);
sout << how_much;
std::ostringstream sout;
sout << " " << msg << " takes " << how_much;
if(how_much_spec > 0)
sout << '+' << how_much_spec;
msg = sout.str();

View File

@@ -132,6 +132,7 @@ cItem::cItem(long preset){
weap_type = eSkill::INVALID;
magic_use_type = 0;
graphic_num = 57;
missile = 3;
value = 1;
weight = 1;
full_name = "Arrows";
@@ -180,6 +181,7 @@ cItem::cItem(long preset){
weap_type = eSkill::INVALID;
magic_use_type = 0;
graphic_num = 59;
missile = 7;
value = 10;
weight = 1;
full_name = "Iron Razordisks";

View File

@@ -130,10 +130,10 @@ public:
std::map<eMonstAbil, uAbility> abil;
item_num_t corpse_item;
short corpse_item_chance;
int magic_res : 2;
int fire_res : 2;
int cold_res : 2;
int poison_res : 2;
unsigned int magic_res : 2;
unsigned int fire_res : 2;
unsigned int cold_res : 2;
unsigned int poison_res : 2;
bool mindless : 1;
bool invuln : 1;
bool invisible : 1;

View File

@@ -132,8 +132,6 @@ inline bool isStatusNegative(eStatus stat) {
return false;
}
/* Special Ability a.k.a spec_skill */
enum class eMonstAbil {
NO_ABIL,
MISSILE,
@@ -244,7 +242,6 @@ enum class eTrimType {
CITY = 18, // the game will join roads up to this space but not draw roads on the space
};
/* terrain type blockage */
enum class eTerObstruct {
CLEAR = 0,
BLOCK_SIGHT = 1,
@@ -716,6 +713,7 @@ enum eEncNoteType {
NOTE_TOWN,
};
// MARK: eFieldType
// This is a slight misnomer, as a couple of these are not true fields.
enum eFieldType {
SPECIAL_EXPLORED = 0,

View File

@@ -14,10 +14,11 @@ short get_ran (short times,short min,short max){
short i, to_ret = 0;
if(max < min) max = min;
if(max == min) return times * min;
for(i = 1; i < times + 1; i++) {
store = rand();
to_ret += min + (store % (max - min + 1));//min + (((store + 32767) * (max - min + 1)) / 65536);
to_ret += min + (store % (max - min + 1));
}
return to_ret;
}