From c24cfde50a08a4ac472466508cab62ba1ace74ca Mon Sep 17 00:00:00 2001 From: zelgadis Date: Thu, 1 Jan 2009 02:31:13 +0000 Subject: Added arena game options: * arena_dump_msgs, which if true will dump all mpr()'d messages into arena.result * arena_dump_msgs_all, which will cause arena_dump_msgs to dump all messages, not just ones considered "dump worthy" * arena_list_eq, which if true will cause all items the monsters came equipped with to be dumped to arena.result Also, made arena_delay option settable, so you can do "arena_delay = 0" to make the simulation zip by. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8071 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/message.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'crawl-ref/source/message.cc') diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index 1efdc0f2a5..b52aea65d1 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -997,6 +997,38 @@ std::string get_last_messages(int mcount) return text; } +std::vector get_recent_messages(int &message_pos, + bool dumpworthy_only, + std::vector *channels) +{ + ASSERT(message_pos >= 0 && message_pos < NUM_STORED_MESSAGES); + + std::vector _channels; + if (channels == NULL) + channels = &_channels; + + std::vector out; + + while (message_pos != Next_Message) + { + const message_item &msg = Store_Message[message_pos++]; + + if (message_pos >= NUM_STORED_MESSAGES) + message_pos -= NUM_STORED_MESSAGES; + + if (msg.text.empty()) + continue; + + if (dumpworthy_only && !is_channel_dumpworthy(msg.channel)) + continue; + + out.push_back(formatted_string::parse_string(msg.text).tostring()); + channels->push_back( (int) msg.channel ); + } + + return (out); +} + void save_messages(writer& outf) { marshallLong( outf, Next_Message ); -- cgit v1.2.3-54-g00ecf