From ebe2f4ea0900af2db7dcf875e16a7ba6ff4bde6f Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Sun, 7 Apr 2019 18:52:39 +0200 Subject: [PATCH] core_bind: Use the appropriate enum instead of int --- core/bind/core_bind.cpp | 14 +++++++------- core/bind/core_bind.h | 15 ++++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 67de156fc34..98d3e77f66f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -148,7 +148,7 @@ _ResourceLoader::_ResourceLoader() { singleton = this; } -Error _ResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { +Error _ResourceSaver::save(const String &p_path, const RES &p_resource, SaverFlags p_flags) { ERR_FAIL_COND_V(p_resource.is_null(), ERR_INVALID_PARAMETER); return ResourceSaver::save(p_path, p_resource, p_flags); @@ -1579,7 +1579,7 @@ _Geometry::_Geometry() { ///////////////////////// FILE -Error _File::open_encrypted(const String &p_path, int p_mode_flags, const Vector &p_key) { +Error _File::open_encrypted(const String &p_path, ModeFlags p_mode_flags, const Vector &p_key) { Error err = open(p_path, p_mode_flags); if (err) @@ -1596,7 +1596,7 @@ Error _File::open_encrypted(const String &p_path, int p_mode_flags, const Vector return OK; } -Error _File::open_encrypted_pass(const String &p_path, int p_mode_flags, const String &p_pass) { +Error _File::open_encrypted_pass(const String &p_path, ModeFlags p_mode_flags, const String &p_pass) { Error err = open(p_path, p_mode_flags); if (err) @@ -1614,7 +1614,7 @@ Error _File::open_encrypted_pass(const String &p_path, int p_mode_flags, const S return OK; } -Error _File::open_compressed(const String &p_path, int p_mode_flags, int p_compress_mode) { +Error _File::open_compressed(const String &p_path, ModeFlags p_mode_flags, CompressionMode p_compress_mode) { FileAccessCompressed *fac = memnew(FileAccessCompressed); @@ -1631,7 +1631,7 @@ Error _File::open_compressed(const String &p_path, int p_mode_flags, int p_compr return OK; } -Error _File::open(const String &p_path, int p_mode_flags) { +Error _File::open(const String &p_path, ModeFlags p_mode_flags) { close(); Error err; @@ -2453,12 +2453,12 @@ void _Thread::_start_func(void *ud) { } } -Error _Thread::start(Object *p_instance, const StringName &p_method, const Variant &p_userdata, int p_priority) { +Error _Thread::start(Object *p_instance, const StringName &p_method, const Variant &p_userdata, Priority p_priority) { ERR_FAIL_COND_V(active, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_instance, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(p_method == StringName(), ERR_INVALID_PARAMETER); - ERR_FAIL_INDEX_V(p_priority, 3, ERR_INVALID_PARAMETER); + ERR_FAIL_INDEX_V(p_priority, PRIORITY_MAX, ERR_INVALID_PARAMETER); ret = Variant(); target_method = p_method; diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 1c26d9b1441..2906de4a4a0 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -85,7 +85,7 @@ public: static _ResourceSaver *get_singleton() { return singleton; } - Error save(const String &p_path, const RES &p_resource, uint32_t p_flags); + Error save(const String &p_path, const RES &p_resource, SaverFlags p_flags); PoolVector get_recognized_extensions(const RES &p_resource); _ResourceSaver(); @@ -436,11 +436,11 @@ public: COMPRESSION_GZIP = Compression::MODE_GZIP }; - Error open_encrypted(const String &p_path, int p_mode_flags, const Vector &p_key); - Error open_encrypted_pass(const String &p_path, int p_mode_flags, const String &p_pass); - Error open_compressed(const String &p_path, int p_mode_flags, int p_compress_mode = 0); + Error open_encrypted(const String &p_path, ModeFlags p_mode_flags, const Vector &p_key); + Error open_encrypted_pass(const String &p_path, ModeFlags p_mode_flags, const String &p_pass); + Error open_compressed(const String &p_path, ModeFlags p_mode_flags, CompressionMode p_compress_mode = COMPRESSION_FASTLZ); - Error open(const String &p_path, int p_mode_flags); ///< open a file + Error open(const String &p_path, ModeFlags p_mode_flags); ///< open a file void close(); ///< close a file bool is_open() const; ///< true when file is open @@ -632,10 +632,11 @@ public: PRIORITY_LOW, PRIORITY_NORMAL, - PRIORITY_HIGH + PRIORITY_HIGH, + PRIORITY_MAX }; - Error start(Object *p_instance, const StringName &p_method, const Variant &p_userdata = Variant(), int p_priority = PRIORITY_NORMAL); + Error start(Object *p_instance, const StringName &p_method, const Variant &p_userdata = Variant(), Priority p_priority = PRIORITY_NORMAL); String get_id() const; bool is_active() const; Variant wait_to_finish();