summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-17 10:53:10 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-17 10:53:10 +0000
commit8f24be21b7874bda7d4df564a19ea9b2ee0dc1f3 (patch)
tree00667deb9cb911062aebdfe6413d50c35843e01d
parenta1c989cf73a5995231dab2ab283efa77e3a66f0a (diff)
downloadcrawl-ref-8f24be21b7874bda7d4df564a19ea9b2ee0dc1f3.tar.gz
crawl-ref-8f24be21b7874bda7d4df564a19ea9b2ee0dc1f3.zip
Merge Haran's changes into 0.1.6:
* Shopping display cleanup * {empty} inscription removal. * Rod fear fix. * Allow reading scorefile from stdin with -. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.1.6@653 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/beam.cc2
-rw-r--r--crawl-ref/source/effects.cc39
-rw-r--r--crawl-ref/source/effects.h2
-rw-r--r--crawl-ref/source/hiscores.cc6
-rw-r--r--crawl-ref/source/initfile.cc2
-rw-r--r--crawl-ref/source/monstuff.cc3
-rw-r--r--crawl-ref/source/shopping.cc10
-rw-r--r--crawl-ref/source/spells1.cc4
8 files changed, 45 insertions, 23 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index f87f644de4..d91bdc1419 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1829,7 +1829,7 @@ bool mass_enchantment( int wh_enchant, int pow, int origin )
canned_msg(MSG_NOTHING_HAPPENS);
return (msg_generated);
-} // end mass_enchantmenet()
+} // end mass_enchantment()
/*
Monster has probably failed save, now it gets enchanted somehow.
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index f3116be7f2..6af1957f31 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1405,6 +1405,29 @@ bool acquirement(unsigned char force_class, int agent)
return (true);
} // end acquirement()
+// Remove the "empty" autoinscription, if present.
+// Return true if the inscription was there, false otherwise.
+bool remove_empty_inscription( item_def& item )
+{
+ const char* empty_inscription = "empty";
+ size_t p = item.inscription.find(empty_inscription);
+ if ( p != std::string::npos )
+ {
+ // found it, delete it
+ size_t prespace = 0;
+ // if preceded by a space, delete that too
+ if ( p != 0 && item.inscription[p-1] == ' ' )
+ prespace = 1;
+ item.inscription =
+ item.inscription.substr(0, p - prespace) +
+ item.inscription.substr(p + strlen(empty_inscription),
+ std::string::npos);
+ return true;
+ }
+ else
+ return false;
+}
+
bool recharge_wand(void)
{
if (you.equip[EQ_WEAPON] == -1)
@@ -1418,25 +1441,13 @@ bool recharge_wand(void)
int charge_gain = 0;
if (wand.base_type == OBJ_WANDS)
{
- // remove "empty" autoinscription
- const char* empty_inscription = "[empty]";
- size_t p = wand.inscription.find(empty_inscription);
- if ( p != std::string::npos ) {
- // found it, delete it
- size_t prespace = 0;
- if ( p != 0 && wand.inscription[p-1] == ' ' )
- prespace = 1;
- wand.inscription =
- wand.inscription.substr(0, p - prespace) +
- wand.inscription.substr(p + strlen(empty_inscription),
- std::string::npos);
- }
+ remove_empty_inscription(wand);
switch (wand.sub_type)
{
case WAND_INVISIBILITY:
case WAND_FIREBALL:
case WAND_HEALING:
- case WAND_HASTING:
+ case WAND_HASTING:
charge_gain = 3;
break;
diff --git a/crawl-ref/source/effects.h b/crawl-ref/source/effects.h
index 44d1ba56a5..5544eab617 100644
--- a/crawl-ref/source/effects.h
+++ b/crawl-ref/source/effects.h
@@ -92,4 +92,6 @@ void torment( int caster, int tx, int ty );
int torment_monsters(int x, int y, int pow, int caster);
+bool remove_empty_inscription( item_def& item );
+
#endif
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index 8ebe79f1c6..da3061564c 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -418,6 +418,10 @@ static bool unlock_file_handle( FILE *handle )
FILE *hs_open( const char *mode, const std::string &scores )
{
+ // allow reading from standard input
+ if ( scores == "-" )
+ return stdin;
+
FILE *handle = fopen(scores.c_str(), mode);
#ifdef SHARED_FILES_CHMOD_PUBLIC
chmod(scores.c_str(), SHARED_FILES_CHMOD_PUBLIC);
@@ -442,7 +446,7 @@ void hs_close( FILE *handle, const char *mode, const std::string &scores )
{
UNUSED( mode );
- if (handle == NULL)
+ if (handle == NULL || handle == stdin)
return;
#ifdef USE_FILE_LOCKING
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 205a68f9d5..bbff68a936 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -2058,7 +2058,7 @@ bool parse_args( int argc, char **argv, bool rc_only )
bool next_is_param = false;
if (next_arg != NULL)
{
- if (next_arg[0] != '-')
+ if (next_arg[0] != '-' || strlen(next_arg) == 1)
next_is_param = true;
}
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 11838f43c5..077fe1826a 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1351,7 +1351,8 @@ void behaviour_event( struct monsters *mon, int event, int src,
// will alert monster to <src> and turn them
// against them, unless they have a current foe.
// it won't turn friends hostile either.
- if (mon->behaviour != BEH_CORNERED)
+ if (mon->behaviour != BEH_CORNERED && mon->behaviour != BEH_PANIC &&
+ mon->behaviour != BEH_FLEE)
mon->behaviour = BEH_SEEK;
if (mon->foe == MHITNOT)
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 6f80839df1..441be694c0 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -38,6 +38,7 @@
#include "spl-book.h"
#include "stash.h"
#include "stuff.h"
+#include "view.h"
static char in_a_shop(char shoppy, id_arr id);
static char more3(void);
@@ -86,7 +87,8 @@ static std::string purchase_keys(const std::string &s)
static void list_shop_keys(const std::string &purchasable)
{
char buf[200];
- gotoxy(1, 23);
+ const int numlines = get_number_of_lines();
+ gotoxy(1, numlines - 1);
std::string pkeys = purchase_keys(purchasable);
if (pkeys.length())
@@ -97,14 +99,14 @@ static void list_shop_keys(const std::string &purchasable)
pkeys.c_str());
formatted_string fs = formatted_string::parse_string(buf);
- fs.cprintf("%*s", get_number_of_cols() - fs.length(), "");
+ fs.cprintf("%*s", get_number_of_cols() - fs.length() - 1, "");
fs.display();
- gotoxy(1, 24);
+ gotoxy(1, numlines);
fs = formatted_string::parse_string(
"[<w>?</w>/<w>*</w>] Inventory "
"[<w>\\</w>] Known Items");
- fs.cprintf("%*s", get_number_of_cols() - fs.length(), "");
+ fs.cprintf("%*s", get_number_of_cols() - fs.length() - 1, "");
fs.display();
}
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 8e7eecc8e9..38373820a5 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -28,6 +28,7 @@
#include "beam.h"
#include "cloud.h"
#include "direct.h"
+#include "effects.h"
#include "invent.h"
#include "it_use2.h"
#include "itemname.h"
@@ -413,7 +414,8 @@ void identify(int power)
you.inv[item_slot].sub_type, ID_KNOWN_TYPE );
set_ident_flags( you.inv[item_slot], ISFLAG_IDENT_MASK );
-
+ remove_empty_inscription(you.inv[item_slot]);
+
// output identified item
in_name( item_slot, DESC_INVENTORY_EQUIP, str_pass );
mpr( str_pass );