From a821a5c34708aff459b31f4d16d2c33ec0ca0ecd Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 10 Sep 2007 09:48:48 +0000 Subject: A few general fixes: Fix 1791185: Memory overrun. Patch provided by ennewalker. Fix 1789803. Again, patch by ennewalker. Fix 1790486: Throwing nets and launchers. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2063 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 4 ++-- crawl-ref/source/enum.h | 3 ++- crawl-ref/source/hiscores.cc | 2 +- crawl-ref/source/initfile.cc | 2 ++ crawl-ref/source/invent.cc | 5 ++++- crawl-ref/source/item_use.cc | 2 ++ crawl-ref/source/sqldbm.cc | 3 ++- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 3bb7f0c4a5..383afd6370 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2675,8 +2675,8 @@ static int affect_wall(bolt &beam, int x, int y) if (targ_grid == DNGN_ORCISH_IDOL) { - beogh_idol_revenge(); - } + beogh_idol_revenge(); + } beam.obvious_effect = 1; } diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index aead4414c7..2fd4585600 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1350,7 +1350,8 @@ enum fire_type FIRE_SPEAR = 0x0020, FIRE_HAND_AXE = 0x0040, FIRE_CLUB = 0x0080, - FIRE_ROCK = 0x0100 + FIRE_ROCK = 0x0100, + FIRE_NET = 0x0200 }; enum flush_reason_type diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index cd5996098b..4b9a274217 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -438,7 +438,7 @@ static const char *kill_method_names[] = "wild_magic", "xom", "statue", "rotting", "targeting", "spore", "tso_smiting", "petrification", "unknown", "something", "falling_down_stairs", "acid", "curare", "melting", "bleeding", - "bog_smiting" + "beogh_smiting" }; const char *kill_method_name(kill_method_type kmt) diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 58fddaba65..bed5a7e9ea 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -263,6 +263,8 @@ static fire_type str_to_fire_types( const std::string &str ) return (FIRE_CLUB); else if (str == "javelin") return (FIRE_JAVELIN); + else if (str == "net") + return (FIRE_NET); return (FIRE_NONE); } diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index e757ecee26..c835984358 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -1025,7 +1025,7 @@ static bool check_old_item_warning( const item_def& item, else if (oper == OPER_WEAR) // can we safely take off old item? { equipment_type eq_slot = get_armour_slot(item); - if (you.equip[eq_slot] == -1) + if (item.base_type != OBJ_ARMOUR || you.equip[eq_slot] == -1) return (true); old_item = you.inv[you.equip[eq_slot]]; @@ -1036,6 +1036,9 @@ static bool check_old_item_warning( const item_def& item, } else if (oper == OPER_PUTON) // can we safely remove old item? { + if (item.base_type != OBJ_JEWELLERY) + return (true); + if (jewellery_is_amulet(item)) { if (you.equip[EQ_AMULET] == -1) diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 408e6d2f25..7a25308c5b 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1143,6 +1143,8 @@ static bool fire_item_matches(const item_def &item, unsigned fire_type) return (true); if ((fire_type & FIRE_ROCK) && item.sub_type == MI_LARGE_ROCK) return (true); + if ((fire_type & FIRE_NET) && item.sub_type == MI_THROWING_NET) + return (true); if (fire_type & FIRE_LAUNCHER) { diff --git a/crawl-ref/source/sqldbm.cc b/crawl-ref/source/sqldbm.cc index fee11a9d46..7a6956f08c 100644 --- a/crawl-ref/source/sqldbm.cc +++ b/crawl-ref/source/sqldbm.cc @@ -183,7 +183,8 @@ sql_datum::sql_datum(const std::string &s) : dptr(NULL), dsize(s.length()), { if ((dptr = new char [dsize])) { - strcpy(dptr, s.c_str()); + if (dsize) + memcpy(dptr, s.c_str(), dsize); need_free = true; } } -- cgit v1.2.3-54-g00ecf