00001
00002
00003
00004
00005
00006
00007
00008 #ifndef STUFF_H
00009 #define STUFF_H
00010
00011 #include <map>
00012
00013 std::string make_time_string(time_t abs_time, bool terse = false);
00014 std::string make_file_time(time_t when);
00015
00016 void set_redraw_status(uint64_t flags);
00017 void tag_followers();
00018 void untag_followers();
00019
00020
00021
00022
00023 class stack_iterator : public std::iterator<std::forward_iterator_tag,
00024 item_def>
00025 {
00026 public:
00027 explicit stack_iterator(const coord_def& pos, bool accessible = false);
00028 explicit stack_iterator(int start_link);
00029
00030 operator bool() const;
00031 item_def& operator *() const;
00032 item_def* operator->() const;
00033 int link() const;
00034
00035 const stack_iterator& operator ++ ();
00036 stack_iterator operator ++ (int);
00037 private:
00038 int cur_link;
00039 int next_link;
00040 };
00041
00042 int stepdown_value(int base_value, int stepping, int first_step,
00043 int last_step, int ceiling_value);
00044 int stat_mult(int stat_level, int value, int div = 20, int shift = 3);
00045 int skill_bump(int skill);
00046 unsigned char get_ch();
00047
00048 void cio_init();
00049 void cio_cleanup();
00050 void clear_globals_on_exit();
00051 NORETURN void end(int exit_code, bool print_err = false,
00052 const char *format = NULL, ...);
00053 NORETURN void game_ended();
00054 NORETURN void game_ended_with_error(const std::string &message);
00055
00056 bool print_error_screen(const char *message, ...);
00057 void redraw_screen();
00058
00059 void canned_msg(canned_message_type which_message);
00060
00061 bool yes_or_no(const char* fmt, ...);
00062 typedef std::map<int, int> explicit_keymap;
00063 bool yesno(const char * str, bool safe = true, int safeanswer = 0,
00064 bool clear_after = true, bool interrupt_delays = true,
00065 bool noprompt = false,
00066 const explicit_keymap *map = NULL,
00067 GotoRegion = GOTO_MSG);
00068
00069 int yesnoquit(const char* str, bool safe = true, int safeanswer = 0,
00070 bool allow_all = false, bool clear_after = true,
00071 char alt_yes = 'Y', char alt_yes2 = 'Y');
00072
00073 bool player_can_hear(const coord_def& p, int hear_distance = 999);
00074
00075 char index_to_letter(int the_index);
00076
00077 int letter_to_index(int the_letter);
00078
00079 int near_stairs(const coord_def &p, int max_dist,
00080 dungeon_char_type &stair_type, branch_type &branch);
00081
00082 coord_def get_random_stair();
00083
00084 inline bool testbits(uint64_t flags, uint64_t test)
00085 {
00086 return ((flags & test) == test);
00087 }
00088
00089 void zap_los_monsters(bool items_also);
00090
00091 int random_rod_subtype();
00092
00093 maybe_bool frombool(bool b);
00094 bool tobool(maybe_bool mb, bool def);
00095 bool tobool(maybe_bool mb);
00096
00097 class game_ended_condition : public std::exception
00098 {
00099 };
00100
00101 int prompt_for_int(const char *prompt, bool nonneg);
00102
00103 #endif