From bdb45bf27b86ff63c5afdff311b4065c83faf37d Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sun, 25 Mar 2007 13:23:23 +0000 Subject: Merged in crawl.akrasiac.org patches (simple messaging, milestones). These take effect only if compiled with -DDGAMELAUNCH. Simple messaging: interacts with dgamelaunch's messaging facility allowing viewers to send messages to the player. Milestones: Writes a milestones.txt file (in xlogfile format) for things like the player killing uniques, reaching the end of a dungeon branch, etc. (similar to notes). milestones.txt is used for game announcements by an IRC bot. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1095 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/items.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'crawl-ref/source/items.cc') diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 734bec9fd6..81e99d05a0 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -38,6 +38,7 @@ #include "debug.h" #include "delay.h" #include "effects.h" +#include "hiscores.h" #include "invent.h" #include "it_use2.h" #include "item_use.h" @@ -959,6 +960,26 @@ static int first_corpse_monnum(int x, int y) return (0); } +#ifdef MILESTONES +static std::string milestone_rune(const item_def &item) +{ + return std::string("found ") + item_name( item, DESC_NOCAP_A ) + "."; +} + +static void milestone_check(const item_def &item) +{ + if (item.base_type == OBJ_MISCELLANY + && item.sub_type == MISC_RUNE_OF_ZOT) + { + mark_milestone("rune", milestone_rune(item)); + } + else if (item.base_type == OBJ_ORBS && item.sub_type == ORB_ZOT) + { + mark_milestone("orb", "found the Orb of Zot!"); + } +} +#endif // MILESTONES + void origin_set(int x, int y) { int monnum = first_corpse_monnum(x, y); @@ -968,9 +989,14 @@ void origin_set(int x, int y) item_def &item = mitm[link]; if (origin_known(item)) continue; + if (!item.orig_monnum) item.orig_monnum = static_cast( monnum ); item.orig_place = pplace; + +#ifdef MILESTONES + milestone_check(item); +#endif } } @@ -986,6 +1012,9 @@ void origin_freeze(item_def &item, int x, int y) if (!item.orig_monnum && x != -1 && y != -1) origin_set_monstercorpse(item, x, y); item.orig_place = get_packed_place(); +#ifdef MILESTONES + milestone_check(item); +#endif } } -- cgit v1.2.3-54-g00ecf