Fix most of the warnings in the Visual Studio build
- Fix energy-draining weapons - Specials called when a spell is targeted on a space now work a little differently if the spell is multi-target. For each target, the special is triggered if it exists; otherwise the normal spell behaviour occurs.
This commit is contained in:
@@ -843,7 +843,7 @@ void pc_attack_weapon(short who_att,iLiving& target,short hit_adj,short dam_adj,
|
||||
target.drain_sp(weap.abil_data[0]);
|
||||
if(before > target.get_magic()) {
|
||||
add_string_to_buf(" Blade drains energy.");
|
||||
univ.party[who_att].restore_sp((before > target.get_magic()) / 3);
|
||||
univ.party[who_att].restore_sp(before / 3);
|
||||
}
|
||||
} else if(weap.ability == eItemAbil::WEAPON_CALL_SPECIAL) {
|
||||
short s1,s2,s3;
|
||||
@@ -1027,11 +1027,6 @@ void do_combat_cast(location target) {
|
||||
}
|
||||
force_wall_position = 10;
|
||||
|
||||
// TODO: Should we do this here? Or in the handling of targeting modes?
|
||||
// (It really depends whether we want to be able to trigger it for targeting something other than a spell.)
|
||||
if(adjust <= 4 && !cast_spell_on_space(target, spell_being_cast))
|
||||
return; // The special node intercepted and cancelled regular spell behaviour.
|
||||
|
||||
caster.void_sanctuary();
|
||||
if(overall_mode == MODE_SPELL_TARGET) {
|
||||
spell_targets[0] = target;
|
||||
@@ -1066,8 +1061,14 @@ void do_combat_cast(location target) {
|
||||
caster.cur_sp -= store_sum_monst_cost;
|
||||
cost_taken = true;
|
||||
}
|
||||
|
||||
if((adjust = can_see_light(caster.combat_pos,target,sight_obscurity)) > 4) {
|
||||
|
||||
adjust = can_see_light(caster.combat_pos, target, sight_obscurity);
|
||||
// TODO: Should we do this here? Or in the handling of targeting modes?
|
||||
// (It really depends whether we want to be able to trigger it for targeting something other than a spell.)
|
||||
if(adjust <= 4 && !cast_spell_on_space(target, spell_being_cast))
|
||||
continue; // The special node intercepted and cancelled regular spell behaviour.
|
||||
|
||||
if(adjust > 4) {
|
||||
add_string_to_buf(" Can't see target.");
|
||||
}
|
||||
else if(loc_off_act_area(target)) {
|
||||
|
||||
@@ -62,6 +62,7 @@ extern cCustomGraphics spec_scen_g;
|
||||
extern sf::RenderWindow mini_map;
|
||||
bool map_visible = false;
|
||||
extern bool show_startup_splash;
|
||||
extern std::string save_talk_str1, save_talk_str2;
|
||||
|
||||
rectangle menuBarRect;
|
||||
Region originalGrayRgn, newGrayRgn, underBarRgn;
|
||||
@@ -575,7 +576,8 @@ void redraw_screen(int refresh) {
|
||||
draw_startup(0);
|
||||
break;
|
||||
case MODE_TALKING:
|
||||
if(refresh & REFRESH_DLOG); // TODO: Should call place_talk_str, but we don't have the strings
|
||||
if(refresh & REFRESH_DLOG)
|
||||
place_talk_str(save_talk_str1, save_talk_str2, 0, rectangle());
|
||||
refresh_talking();
|
||||
break;
|
||||
case MODE_SHOPPING:
|
||||
|
||||
@@ -378,16 +378,17 @@ void set_town_attitude(short lo,short hi,short att) {
|
||||
return;
|
||||
give_help(53,0);
|
||||
univ.town.monst.friendly = 1;
|
||||
long long num_monst = univ.town.monst.size();
|
||||
|
||||
// Nice smart indexing, like Python :D
|
||||
if(lo <= -univ.town.monst.size())
|
||||
if(lo <= -num_monst)
|
||||
lo = 0;
|
||||
if(lo < 0)
|
||||
lo = univ.town.monst.size() + lo;
|
||||
if(hi <= -univ.town.monst.size())
|
||||
lo = num_monst + lo;
|
||||
if(hi <= -num_monst)
|
||||
hi = 0;
|
||||
if(hi < 0)
|
||||
hi = univ.town.monst.size() + hi;
|
||||
hi = num_monst + hi;
|
||||
if(hi < lo)
|
||||
std::swap(lo, hi);
|
||||
|
||||
@@ -970,9 +971,9 @@ void refresh_store_items() {
|
||||
continue;
|
||||
} else if(entry.type == eShopItemType::CLASS) {
|
||||
std::set<int> choices;
|
||||
for(int i = 0; i < univ.scenario.scen_items.size(); i++) {
|
||||
if(univ.scenario.scen_items[i].special_class == entry.item.special_class)
|
||||
choices.insert(i);
|
||||
for(int k = 0; k < univ.scenario.scen_items.size(); k++) {
|
||||
if(univ.scenario.scen_items[k].special_class == entry.item.special_class)
|
||||
choices.insert(k);
|
||||
}
|
||||
int choice = get_ran(1,0,choices.size());
|
||||
if(choice < choices.size()) {
|
||||
|
||||
@@ -3529,7 +3529,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
|
||||
if(i > 0) *next_spec = spec.ex1b;
|
||||
break;
|
||||
case eSpecType::IF_RECIPE:
|
||||
if(i < 0 || i >= 20) {
|
||||
if(spec.ex1a < 0 || spec.ex1a >= 20) {
|
||||
giveError("Alchemy recipe out of range (0 - 19).");
|
||||
break;
|
||||
}
|
||||
@@ -3734,7 +3734,7 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
|
||||
*next_spec = -1;
|
||||
}
|
||||
else {
|
||||
if(handle_lever(loc(PSD[SDF_SPEC_LOC_X], PSD[SDF_SPEC_LOC_Y])) > 0)
|
||||
if(handle_lever(loc(PSD[SDF_SPEC_LOC_X], PSD[SDF_SPEC_LOC_Y])))
|
||||
*next_spec = spec.ex1b;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1008,7 +1008,8 @@ void cMonster::readFrom(std::istream& file) {
|
||||
m_name = read_maybe_quoted_string(line);
|
||||
} else if(cur == "ATTACK") {
|
||||
int which;
|
||||
line >> which >> a[which].dice >> a[which].sides >> a[which].type;
|
||||
line >> which;
|
||||
line >> a[which].dice >> a[which].sides >> a[which].type;
|
||||
which--;
|
||||
} else if(cur == "SIZE") {
|
||||
line >> temp1 >> temp2;
|
||||
|
||||
@@ -169,9 +169,9 @@ public:
|
||||
cParty party;
|
||||
std::map<long,cPlayer*> stored_pcs;
|
||||
cCurTown town;
|
||||
char town_maps[200][8][64]; // formerly stored_town_maps_type
|
||||
unsigned char town_maps[200][8][64]; // formerly stored_town_maps_type
|
||||
cCurOut out;
|
||||
char out_maps[100][6][48]; // formerly stored_outdoor_maps_type
|
||||
unsigned char out_maps[100][6][48]; // formerly stored_outdoor_maps_type
|
||||
fs::path file;
|
||||
|
||||
void clear_stored_pcs();
|
||||
|
||||
@@ -240,7 +240,7 @@ void display_alchemy(bool allowEdit) {
|
||||
if(!allowEdit)
|
||||
showAlch->getControl(id).attachClickHandler(&cLed::noAction);
|
||||
cLed& led = dynamic_cast<cLed&>(showAlch->getControl(id));
|
||||
if(univ.party.alchemy[i] > 0)
|
||||
if(univ.party.alchemy[i])
|
||||
led.setState(led_red);
|
||||
else led.setState(led_off);
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ static void readShopFromXml(ticpp::Element& data, cShop& shop, cScenario& scen)
|
||||
shop.setPrompt(boost::lexical_cast<eShopPrompt>(val));
|
||||
} else if(type == "face") {
|
||||
pic_num_t face;
|
||||
elem->GetText(face);
|
||||
elem->GetText(&face);
|
||||
shop.setFace(face);
|
||||
} else if(type == "entries") {
|
||||
int entries_found = 0;
|
||||
|
||||
Reference in New Issue
Block a user