diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 23:09:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-14 23:09:03 +0200 |
| commit | 00949f0c5fcc6a4f8382a4a97d5591fd9ec380f8 (patch) | |
| tree | 2b1c31f45add24085b64425ce440f577424c16a1 /modules/gdscript/register_types.cpp | |
| parent | 5046f666a1181675b39f156c38346525dc1c444e (diff) | |
| parent | 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (diff) | |
| download | redot-engine-00949f0c5fcc6a4f8382a4a97d5591fd9ec380f8.tar.gz | |
Merge pull request #38738 from akien-mga/cause-we-never-go-out-of-style
Style: Remove new line at block start, enforce line between functions, enforce braces in if and loop blocks
Diffstat (limited to 'modules/gdscript/register_types.cpp')
| -rw-r--r-- | modules/gdscript/register_types.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 62b9d94d6c..0625123530 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -54,12 +54,10 @@ Ref<ResourceFormatSaverGDScript> resource_saver_gd; #endif // !GDSCRIPT_NO_LSP class EditorExportGDScript : public EditorExportPlugin { - GDCLASS(EditorExportGDScript, EditorExportPlugin); public: virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features) { - int script_mode = EditorExportPreset::MODE_SCRIPT_COMPILED; String script_key; @@ -70,21 +68,21 @@ public: script_key = preset->get_script_encryption_key().to_lower(); } - if (!p_path.ends_with(".gd") || script_mode == EditorExportPreset::MODE_SCRIPT_TEXT) + if (!p_path.ends_with(".gd") || script_mode == EditorExportPreset::MODE_SCRIPT_TEXT) { return; + } Vector<uint8_t> file = FileAccess::get_file_as_array(p_path); - if (file.empty()) + if (file.empty()) { return; + } String txt; txt.parse_utf8((const char *)file.ptr(), file.size()); file = GDScriptTokenizerBuffer::parse_code_string(txt); if (!file.empty()) { - if (script_mode == EditorExportPreset::MODE_SCRIPT_ENCRYPTED) { - String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("script.gde"); FileAccess *fa = FileAccess::open(tmp_path, FileAccess::WRITE); @@ -94,19 +92,21 @@ public: int v = 0; if (i * 2 < script_key.length()) { CharType ct = script_key[i * 2]; - if (ct >= '0' && ct <= '9') + if (ct >= '0' && ct <= '9') { ct = ct - '0'; - else if (ct >= 'a' && ct <= 'f') + } else if (ct >= 'a' && ct <= 'f') { ct = 10 + ct - 'a'; + } v |= ct << 4; } if (i * 2 + 1 < script_key.length()) { CharType ct = script_key[i * 2 + 1]; - if (ct >= '0' && ct <= '9') + if (ct >= '0' && ct <= '9') { ct = ct - '0'; - else if (ct >= 'a' && ct <= 'f') + } else if (ct >= 'a' && ct <= 'f') { ct = 10 + ct - 'a'; + } v |= ct; } key.write[i] = v; @@ -127,7 +127,6 @@ public: DirAccess::remove_file_or_error(tmp_path); } else { - add_file(p_path.get_basename() + ".gdc", file, true); } } @@ -135,7 +134,6 @@ public: }; static void _editor_init() { - Ref<EditorExportGDScript> gd_export; gd_export.instance(); EditorExport::get_singleton()->add_export_plugin(gd_export); @@ -151,7 +149,6 @@ static void _editor_init() { #endif // TOOLS_ENABLED void register_gdscript_types() { - ClassDB::register_class<GDScript>(); ClassDB::register_virtual_class<GDScriptFunctionState>(); @@ -171,11 +168,11 @@ void register_gdscript_types() { } void unregister_gdscript_types() { - ScriptServer::unregister_language(script_language_gd); - if (script_language_gd) + if (script_language_gd) { memdelete(script_language_gd); + } ResourceLoader::remove_resource_format_loader(resource_loader_gd); resource_loader_gd.unref(); |
