diff options
author | volzhs <volzhs@gmail.com> | 2015-07-01 15:13:10 +0900 |
---|---|---|
committer | volzhs <volzhs@gmail.com> | 2015-07-01 15:13:10 +0900 |
commit | f6668dc9db34fc4a3ef9e9e309e0fc248c3f51a8 (patch) | |
tree | 0c9a6e5cd8b6d3fdfab3cb6aff41458a08841133 /modules | |
parent | 903e6b37c0ed94cd0b3447dd3ff471abbfaa4460 (diff) | |
parent | b4d5f7e154973e8fb93a9a0af6ffa0b065e2c50c (diff) |
Merge branch 'master' of https://github.com/okamstudio/godot into fix_android_payments
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gd_script.cpp | 12 | ||||
-rw-r--r-- | modules/gdscript/gd_script.h | 2 | ||||
-rw-r--r-- | modules/gridmap/grid_map.cpp | 8 |
3 files changed, 16 insertions, 6 deletions
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index b6ad7aa716..53ae0c8702 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -1977,9 +1977,17 @@ void GDScript::_bind_methods() { ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo("new")); + ObjectTypeDB::bind_method(_MD("get_as_byte_code"),&GDScript::get_as_byte_code); + } +Vector<uint8_t> GDScript::get_as_byte_code() const { + + GDTokenizerBuffer tokenizer; + return tokenizer.parse_code_string(source); +}; + Error GDScript::load_byte_code(const String& p_path) { @@ -2556,9 +2564,9 @@ void GDScriptLanguage::init() { //populate native classes - List<String> class_list; + List<StringName> class_list; ObjectTypeDB::get_type_list(&class_list); - for(List<String>::Element *E=class_list.front();E;E=E->next()) { + for(List<StringName>::Element *E=class_list.front();E;E=E->next()) { StringName n = E->get(); String s = String(n); diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 4672f3b8be..1e1279d5f5 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -349,6 +349,8 @@ public: Error load_source_code(const String& p_path); Error load_byte_code(const String& p_path); + Vector<uint8_t> get_as_byte_code() const; + virtual ScriptLanguage *get_language() const; GDScript(); diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 121b23001d..4f0daf329f 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -130,8 +130,8 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) { } else if (name.begins_with("areas/")) { - int which = name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int which = name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (what=="bounds") { ERR_FAIL_COND_V(area_map.has(which),false); create_area(which,p_value); @@ -215,8 +215,8 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const { r_ret= d; } else if (name.begins_with("areas/")) { - int which = name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int which = name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (what=="bounds") r_ret= area_get_bounds(which); else if (what=="name") |