diff options
Diffstat (limited to 'core/os')
-rw-r--r-- | core/os/input_event.cpp | 6 | ||||
-rw-r--r-- | core/os/input_event.h | 2 | ||||
-rw-r--r-- | core/os/memory.cpp | 9 | ||||
-rw-r--r-- | core/os/os.cpp | 34 | ||||
-rw-r--r-- | core/os/os.h | 6 |
5 files changed, 7 insertions, 50 deletions
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 381ba9d010..f09a904953 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -49,11 +49,11 @@ bool InputEvent::is_action(const StringName &p_action) const { return InputMap::get_singleton()->event_is_action(Ref<InputEvent>((InputEvent *)this), p_action); } -bool InputEvent::is_action_pressed(const StringName &p_action) const { +bool InputEvent::is_action_pressed(const StringName &p_action, bool p_allow_echo) const { bool pressed; bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed); - return valid && pressed && !is_echo(); + return valid && pressed && (p_allow_echo || !is_echo()); } bool InputEvent::is_action_released(const StringName &p_action) const { @@ -112,7 +112,7 @@ void InputEvent::_bind_methods() { ClassDB::bind_method(D_METHOD("get_device"), &InputEvent::get_device); ClassDB::bind_method(D_METHOD("is_action", "action"), &InputEvent::is_action); - ClassDB::bind_method(D_METHOD("is_action_pressed", "action"), &InputEvent::is_action_pressed); + ClassDB::bind_method(D_METHOD("is_action_pressed", "action", "allow_echo"), &InputEvent::is_action_pressed, DEFVAL(false)); ClassDB::bind_method(D_METHOD("is_action_released", "action"), &InputEvent::is_action_released); ClassDB::bind_method(D_METHOD("get_action_strength", "action"), &InputEvent::get_action_strength); diff --git a/core/os/input_event.h b/core/os/input_event.h index 14649502ee..a4db618bfe 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -184,7 +184,7 @@ public: int get_device() const; bool is_action(const StringName &p_action) const; - bool is_action_pressed(const StringName &p_action) const; + bool is_action_pressed(const StringName &p_action, bool p_allow_echo = false) const; bool is_action_released(const StringName &p_action) const; float get_action_strength(const StringName &p_action) const; diff --git a/core/os/memory.cpp b/core/os/memory.cpp index d1de51f3db..f4ed1d6e27 100644 --- a/core/os/memory.cpp +++ b/core/os/memory.cpp @@ -50,20 +50,17 @@ void *operator new(size_t p_size, void *(*p_allocfunc)(size_t p_size)) { #ifdef _MSC_VER void operator delete(void *p_mem, const char *p_description) { - ERR_EXPLAINC("Call to placement delete should not happen."); - CRASH_NOW(); + CRASH_NOW_MSG("Call to placement delete should not happen."); } void operator delete(void *p_mem, void *(*p_allocfunc)(size_t p_size)) { - ERR_EXPLAINC("Call to placement delete should not happen."); - CRASH_NOW(); + CRASH_NOW_MSG("Call to placement delete should not happen."); } void operator delete(void *p_mem, void *p_pointer, size_t check, const char *p_description) { - ERR_EXPLAINC("Call to placement delete should not happen."); - CRASH_NOW(); + CRASH_NOW_MSG("Call to placement delete should not happen."); } #endif diff --git a/core/os/os.cpp b/core/os/os.cpp index b44487b908..25889de1b3 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -196,29 +196,6 @@ bool OS::is_stdout_verbose() const { return _verbose_stdout; } -void OS::set_last_error(const char *p_error) { - - GLOBAL_LOCK_FUNCTION - if (p_error == NULL) - p_error = "Unknown Error"; - - if (last_error) - memfree(last_error); - last_error = NULL; - int len = 0; - while (p_error[len++]) - ; - - last_error = (char *)memalloc(len); - for (int i = 0; i < len; i++) - last_error[i] = p_error[i]; -} - -const char *OS::get_last_error() const { - GLOBAL_LOCK_FUNCTION - return last_error ? last_error : ""; -} - void OS::dump_memory_to_file(const char *p_file) { //Memory::dump_static_mem_to_file(p_file); @@ -297,14 +274,6 @@ void OS::dump_resources_to_file(const char *p_file) { ResourceCache::dump(p_file); } -void OS::clear_last_error() { - - GLOBAL_LOCK_FUNCTION - if (last_error) - memfree(last_error); - last_error = NULL; -} - void OS::set_no_window_mode(bool p_enable) { _no_window = p_enable; @@ -764,7 +733,6 @@ OS::OS() { void *volatile stack_bottom; restart_on_exit = false; - last_error = NULL; singleton = this; _keep_screen_on = true; // set default value to true, because this had been true before godot 2.0. low_processor_usage_mode = false; @@ -790,8 +758,6 @@ OS::OS() { } OS::~OS() { - if (last_error) - memfree(last_error); memdelete(_logger); singleton = NULL; } diff --git a/core/os/os.h b/core/os/os.h index b5224c4f63..687ccaaba5 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -61,8 +61,6 @@ class OS { bool _allow_layered; bool _use_vsync; - char *last_error; - void *_stack_bottom; CompositeLogger *_logger; @@ -155,10 +153,6 @@ public: virtual void alert(const String &p_alert, const String &p_title = "ALERT!") = 0; virtual String get_stdin_string(bool p_block = true) = 0; - virtual void set_last_error(const char *p_error); - virtual const char *get_last_error() const; - virtual void clear_last_error(); - enum MouseMode { MOUSE_MODE_VISIBLE, MOUSE_MODE_HIDDEN, |