diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-01 02:31:13 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-01 02:31:13 +0000 |
commit | c24cfde50a08a4ac472466508cab62ba1ace74ca (patch) | |
tree | 2a8f13a5b690ce24d8f8901ea005ae1fd60b2ab6 /crawl-ref/source/message.cc | |
parent | 3f0a535a9d963438d6a4b0bde64ac06ddc247216 (diff) | |
download | crawl-ref-c24cfde50a08a4ac472466508cab62ba1ace74ca.tar.gz crawl-ref-c24cfde50a08a4ac472466508cab62ba1ace74ca.zip |
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
Diffstat (limited to 'crawl-ref/source/message.cc')
-rw-r--r-- | crawl-ref/source/message.cc | 32 |
1 files changed, 32 insertions, 0 deletions
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<std::string> get_recent_messages(int &message_pos, + bool dumpworthy_only, + std::vector<int> *channels) +{ + ASSERT(message_pos >= 0 && message_pos < NUM_STORED_MESSAGES); + + std::vector<int> _channels; + if (channels == NULL) + channels = &_channels; + + std::vector<std::string> 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 ); |