00001
00002
00003
00004
00005
00006 #ifndef DELAY_H
00007 #define DELAY_H
00008
00009 #include "enum.h"
00010
00011 class monster;
00012 struct ait_hp_loss;
00013
00014 enum activity_interrupt_payload_type
00015 {
00016 AIP_NONE,
00017 AIP_INT,
00018 AIP_STRING,
00019 AIP_MONSTER,
00020 AIP_HP_LOSS,
00021 };
00022
00023 struct activity_interrupt_data
00024 {
00025 activity_interrupt_payload_type apt;
00026 const void *data;
00027 std::string context;
00028
00029 activity_interrupt_data()
00030 : apt(AIP_NONE), data(NULL), context()
00031 {
00032 }
00033 activity_interrupt_data(const int *i)
00034 : apt(AIP_INT), data(i), context()
00035 {
00036 }
00037 activity_interrupt_data(const char *s)
00038 : apt(AIP_STRING), data(s), context()
00039 {
00040 }
00041 activity_interrupt_data(const std::string &s)
00042 : apt(AIP_STRING), data(s.c_str()), context()
00043 {
00044 }
00045 activity_interrupt_data(const monster* m, const std::string &ctx = "")
00046 : apt(AIP_MONSTER), data(m), context(ctx)
00047 {
00048 }
00049 activity_interrupt_data(const ait_hp_loss *ahl)
00050 : apt(AIP_HP_LOSS), data(ahl), context()
00051 {
00052 }
00053 activity_interrupt_data(const activity_interrupt_data &a)
00054 : apt(a.apt), data(a.data), context(a.context)
00055 {
00056 }
00057 };
00058
00059 struct ait_hp_loss
00060 {
00061 int hp;
00062 int hurt_type;
00063
00064 ait_hp_loss(int _hp, int _ht) : hp(_hp), hurt_type(_ht) { }
00065 };
00066
00067 void start_delay(delay_type type, int turns, int parm1 = 0, int parm2 = 0);
00068 void stop_delay(bool stop_stair_travel = false);
00069 bool you_are_delayed();
00070 delay_type current_delay_action();
00071 void handle_delay();
00072 void finish_last_delay();
00073
00074 bool delay_is_run(delay_type delay);
00075 bool is_being_butchered(const item_def &item, bool just_first = true);
00076 bool is_vampire_feeding();
00077 bool is_butchering();
00078 bool player_stair_delay();
00079 bool already_learning_spell(int spell);
00080 void stop_butcher_delay();
00081 void maybe_clear_weapon_swap();
00082 void handle_interrupted_swap(bool swap_if_safe = false,
00083 bool force_unsafe = false,
00084 bool transform = false);
00085
00086 void clear_macro_process_key_delay();
00087
00088 activity_interrupt_type get_activity_interrupt(const std::string &);
00089
00090 const char *delay_name(int delay);
00091 delay_type get_delay(const std::string &);
00092
00093 void autotoggle_autopickup(bool off);
00094 bool interrupt_activity(activity_interrupt_type ai,
00095 const activity_interrupt_data &a
00096 = activity_interrupt_data(),
00097 std::vector<std::string>* msgs_buf = NULL);
00098 #endif