diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/func_ref.cpp | 3 | ||||
-rw-r--r-- | core/io/marshalls.cpp | 3 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 2 | ||||
-rw-r--r-- | core/io/unzip.c | 2 | ||||
-rw-r--r-- | core/io/zip.c | 4 | ||||
-rw-r--r-- | core/os/os.cpp | 1 | ||||
-rw-r--r-- | core/os/os.h | 3 | ||||
-rw-r--r-- | core/path_db.cpp | 31 | ||||
-rw-r--r-- | core/path_db.h | 5 | ||||
-rw-r--r-- | core/resource.h | 2 | ||||
-rw-r--r-- | core/ustring.cpp | 2 |
11 files changed, 44 insertions, 14 deletions
diff --git a/core/func_ref.cpp b/core/func_ref.cpp index 0e43112de8..66962710bd 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -31,8 +31,7 @@ void FuncRef::_bind_methods() { { MethodInfo mi; - mi.name="call"; - mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); + mi.name="call_func"; Vector<Variant> defargs; for(int i=0;i<10;i++) { mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index b0d24abfe3..1e76e2b4b2 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -299,10 +299,8 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * ERR_FAIL_COND_V(len<12,ERR_INVALID_DATA); Vector<StringName> names; Vector<StringName> subnames; - bool absolute; StringName prop; - int i=0; uint32_t namecount=strlen&=0x7FFFFFFF; uint32_t subnamecount = decode_uint32(buf+4); uint32_t flags = decode_uint32(buf+8); @@ -391,7 +389,6 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * ie.type=decode_uint32(&buf[0]); ie.device=decode_uint32(&buf[4]); - uint32_t len = decode_uint32(&buf[8])-12; if (r_len) (*r_len)+=12; diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 1e014480f4..3862790b02 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -231,14 +231,12 @@ Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p local_path = Globals::get_singleton()->localize_path(p_path); String extension=p_path.extension(); - bool found=false; Ref<ResourceImportMetadata> ret; for (int i=0;i<loader_count;i++) { if (!loader[i]->recognize(extension)) continue; - found=true; Error err = loader[i]->load_import_metadata(local_path,ret); if (err==OK) diff --git a/core/io/unzip.c b/core/io/unzip.c index 0cd975211e..b438021ad7 100644 --- a/core/io/unzip.c +++ b/core/io/unzip.c @@ -1788,7 +1788,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) return UNZ_PARAMERROR; - if ((pfile_in_zip_read_info->read_buffer == NULL)) + if (pfile_in_zip_read_info->read_buffer==NULL) return UNZ_END_OF_LIST_OF_FILE; if (len==0) return 0; diff --git a/core/io/zip.c b/core/io/zip.c index 8f6aeb922f..c4ab93ab81 100644 --- a/core/io/zip.c +++ b/core/io/zip.c @@ -1114,9 +1114,9 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, zi->ci.flag = flagBase; if ((level==8) || (level==9)) zi->ci.flag |= 2; - if ((level==2)) + if (level==2) zi->ci.flag |= 4; - if ((level==1)) + if (level==1) zi->ci.flag |= 6; if (password != NULL) zi->ci.flag |= 1; diff --git a/core/os/os.cpp b/core/os/os.cpp index 2db926e556..ee9f12b79d 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -516,6 +516,7 @@ OS::OS() { _target_fps=0; _render_thread_mode=RENDER_THREAD_SAFE; _time_scale=1.0; + _pixel_snap=false; Math::seed(1234567); } diff --git a/core/os/os.h b/core/os/os.h index d89734d7d3..e5338b4a02 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -58,6 +58,7 @@ class OS { float _fps; int _target_fps; float _time_scale; + bool _pixel_snap; char *last_error; @@ -393,7 +394,7 @@ public: void set_time_scale(float p_scale); float get_time_scale() const; - + _FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; } OS(); virtual ~OS(); diff --git a/core/path_db.cpp b/core/path_db.cpp index d3dc3aceb8..c6ea25d966 100644 --- a/core/path_db.cpp +++ b/core/path_db.cpp @@ -286,6 +286,37 @@ NodePath::NodePath(const Vector<StringName>& p_path,const Vector<StringName>& p_ data->property=p_property; } + +void NodePath::simplify() { + + if (!data) + return; + for(int i=0;i<data->path.size();i++) { + if (data->path.size()==1) + break; + if (data->path[i].operator String()==".") { + data->path.remove(i); + i--; + } else if (data->path[i].operator String()==".." && i>0 && data->path[i-1].operator String()!="." && data->path[i-1].operator String()!="..") { + //remove both + data->path.remove(i-1); + data->path.remove(i-1); + i-=2; + if (data->path.size()==0) { + data->path.push_back("."); + break; + } + } + } +} + +NodePath NodePath::simplified() const { + + NodePath np=*this; + np.simplify(); + return np; +} + NodePath::NodePath(const String& p_path) { data=NULL; diff --git a/core/path_db.h b/core/path_db.h index b4f13d50be..de84216006 100644 --- a/core/path_db.h +++ b/core/path_db.h @@ -84,7 +84,10 @@ public: bool operator==(const NodePath& p_path) const; bool operator!=(const NodePath& p_path) const; void operator=(const NodePath& p_path); - + + void simplify(); + NodePath simplified() const; + NodePath(const Vector<StringName>& p_path,bool p_absolute,const String& p_property=""); NodePath(const Vector<StringName>& p_path,const Vector<StringName>& p_subpath,bool p_absolute,const String& p_property=""); NodePath(const NodePath& p_path); diff --git a/core/resource.h b/core/resource.h index 9d9c445e1d..3596abe673 100644 --- a/core/resource.h +++ b/core/resource.h @@ -130,7 +130,7 @@ public: void set_name(const String& p_name); String get_name() const; - void set_path(const String& p_path,bool p_take_over=false); + virtual void set_path(const String& p_path,bool p_take_over=false); String get_path() const; void set_subindex(int p_sub_index); diff --git a/core/ustring.cpp b/core/ustring.cpp index e5419effcb..7582376fe0 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3066,7 +3066,7 @@ String String::world_wrap(int p_chars_per_line) const { } else if (operator[](i)==' ' || operator[](i)=='\t') { last_space=i; } else if (operator[](i)=='\n') { - ret+=substr(from,i-from); + ret+=substr(from,i-from)+"\n"; from=i+1; last_space=-1; } |