diff options
Diffstat (limited to 'core')
52 files changed, 266 insertions, 162 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 5559c9b93c..d2264c6c6a 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -996,11 +996,12 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_clipboard","clipboard"),&_OS::set_clipboard); ClassDB::bind_method(_MD("get_clipboard"),&_OS::get_clipboard); - ClassDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); - ClassDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); - ClassDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); - ClassDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); - ClassDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); + //will not delete for now, just unexpose + //ClassDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); + //ClassDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); + //ClassDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); + //ClassDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); + //ClassDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); ClassDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); @@ -1830,9 +1831,9 @@ Error _Directory::open(const String& p_path) { return OK; } -bool _Directory::list_dir_begin() { +Error _Directory::list_dir_begin() { - ERR_FAIL_COND_V(!d,false); + ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED); return d->list_dir_begin(); } @@ -1982,7 +1983,7 @@ void _Directory::_bind_methods() { ClassDB::bind_method(_MD("make_dir_recursive:Error","path"),&_Directory::make_dir_recursive); ClassDB::bind_method(_MD("file_exists","path"),&_Directory::file_exists); ClassDB::bind_method(_MD("dir_exists","path"),&_Directory::dir_exists); -// ClassDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); + //ClassDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); ClassDB::bind_method(_MD("get_space_left"),&_Directory::get_space_left); ClassDB::bind_method(_MD("copy:Error","from","to"),&_Directory::copy); ClassDB::bind_method(_MD("rename:Error","from","to"),&_Directory::rename); @@ -2512,22 +2513,22 @@ void _ClassDB::_bind_methods() { ClassDB::bind_method(_MD("can_instance","class"),&_ClassDB::can_instance); ClassDB::bind_method(_MD("instance","class"),&_ClassDB::instance); - ClassDB::bind_method(_MD("has_signal","class","signal"),&_ClassDB::has_signal); - ClassDB::bind_method(_MD("get_signal","class","signal"),&_ClassDB::get_signal); - ClassDB::bind_method(_MD("get_signal_list","class","no_inheritance"),&_ClassDB::get_signal_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_has_signal","class","signal"),&_ClassDB::has_signal); + ClassDB::bind_method(_MD("class_get_signal","class","signal"),&_ClassDB::get_signal); + ClassDB::bind_method(_MD("class_get_signal_list","class","no_inheritance"),&_ClassDB::get_signal_list,DEFVAL(false)); - ClassDB::bind_method(_MD("get_property_list","class","no_inheritance"),&_ClassDB::get_property_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_property_list","class","no_inheritance"),&_ClassDB::get_property_list,DEFVAL(false)); - ClassDB::bind_method(_MD("has_method","class","method","no_inheritance"),&_ClassDB::has_method,DEFVAL(false)); + ClassDB::bind_method(_MD("class_has_method","class","method","no_inheritance"),&_ClassDB::has_method,DEFVAL(false)); - ClassDB::bind_method(_MD("get_method_list","class","no_inheritance"),&_ClassDB::get_method_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_method_list","class","no_inheritance"),&_ClassDB::get_method_list,DEFVAL(false)); - ClassDB::bind_method(_MD("get_integer_constant_list","class","no_inheritance"),&_ClassDB::get_integer_constant_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_integer_constant_list","class","no_inheritance"),&_ClassDB::get_integer_constant_list,DEFVAL(false)); - ClassDB::bind_method(_MD("has_integer_constant","class","name"),&_ClassDB::has_integer_constant); - ClassDB::bind_method(_MD("get_integer_constant","class","name"),&_ClassDB::get_integer_constant); + ClassDB::bind_method(_MD("class_has_integer_constant","class","name"),&_ClassDB::has_integer_constant); + ClassDB::bind_method(_MD("class_get_integer_constant","class","name"),&_ClassDB::get_integer_constant); - ClassDB::bind_method(_MD("get_category","class"),&_ClassDB::get_category); + ClassDB::bind_method(_MD("class_get_category","class"),&_ClassDB::get_category); ClassDB::bind_method(_MD("is_class_enabled","class"),&_ClassDB::is_class_enabled); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index cf39578a57..f10714720f 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -456,7 +456,7 @@ public: Error open(const String& p_path); - bool list_dir_begin(); ///< This starts dir listing + Error list_dir_begin(); ///< This starts dir listing String get_next(); bool current_is_dir() const; diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 71f810422a..1e3a51fede 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -467,7 +467,7 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { //print_line("Hash: "+itos(p)); if (p==0xFFFFFFFF) { -// print_line("GETMSG: Nothing!"); + //print_line("GETMSG: Nothing!"); return StringName(); //nothing } @@ -489,7 +489,7 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { //print_line("bucket pos: "+itos(idx)); if (idx==-1) { -// print_line("GETMSG: Not in Bucket!"); + //print_line("GETMSG: Not in Bucket!"); return StringName(); } @@ -497,8 +497,8 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { String rstr; rstr.parse_utf8(&sptr[ bucket.elem[idx].str_offset ], bucket.elem[idx].uncomp_size ); -// print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size)); -// print_line("Return: "+rstr); + //print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size)); + //print_line("Return: "+rstr); return rstr; } else { @@ -508,8 +508,8 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { smaz_decompress(&sptr[ bucket.elem[idx].str_offset ], bucket.elem[idx].comp_size,uncomp.ptr(),bucket.elem[idx].uncomp_size ); String rstr; rstr.parse_utf8(uncomp.get_data()); -// print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size)); -// print_line("Return: "+rstr); + //print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size)); + //print_line("Return: "+rstr); return rstr; } diff --git a/core/globals.cpp b/core/globals.cpp index 28fabac302..a4c24a6cc8 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -329,7 +329,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { String candidate = d->get_current_dir(); String current_dir = d->get_current_dir(); - String exec_name = OS::get_singleton()->get_executable_path().get_file().basename(); + String exec_name = OS::get_singleton()->get_executable_path().get_file().get_basename(); bool found = false; bool first_time=true; @@ -1011,7 +1011,7 @@ GlobalConfig::GlobalConfig() { GLOBAL_DEF("input/ui_page_down",va); input_presets.push_back("input/ui_page_down"); -// GLOBAL_DEF("display/handheld/orientation", "landscape"); + //GLOBAL_DEF("display/handheld/orientation", "landscape"); custom_prop_info["display/handheld/orientation"]=PropertyInfo(Variant::STRING,"display/handheld/orientation",PROPERTY_HINT_ENUM,"landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor"); diff --git a/core/hash_map.h b/core/hash_map.h index fba12b55ec..0d55206935 100644 --- a/core/hash_map.h +++ b/core/hash_map.h @@ -61,7 +61,7 @@ public: static _FORCE_INLINE_ uint32_t hash(const uint8_t p_int) { return p_int; } static _FORCE_INLINE_ uint32_t hash(const int8_t p_int) { return (uint32_t)p_int; } static _FORCE_INLINE_ uint32_t hash(const wchar_t p_wchar) { return (uint32_t)p_wchar; } -// static _FORCE_INLINE_ uint32_t hash(const void* p_ptr) { return uint32_t(uint64_t(p_ptr))*(0x9e3779b1L); } + //static _FORCE_INLINE_ uint32_t hash(const void* p_ptr) { return uint32_t(uint64_t(p_ptr))*(0x9e3779b1L); } }; /** diff --git a/core/image.cpp b/core/image.cpp index 174c840c23..d769e6a0b3 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -363,7 +363,7 @@ void Image::convert( Format p_new_format ){ Image new_img(width,height,0,p_new_format); -// int len=data.size(); + //int len=data.size(); PoolVector<uint8_t>::Read r = data.read(); PoolVector<uint8_t>::Write w = new_img.data.write(); @@ -414,7 +414,7 @@ void Image::convert( Format p_new_format ){ bool gen_mipmaps=mipmaps; -// mipmaps=false; + //mipmaps=false; *this=new_img; @@ -1240,7 +1240,7 @@ void Image::create( const char ** p_xpm ) { uint8_t col_r; uint8_t col_g; uint8_t col_b; -// uint8_t col_a=255; + //uint8_t col_a=255; for (int i=0;i<6;i++) { diff --git a/core/input_map.cpp b/core/input_map.cpp index 0379131dd3..bcae630c76 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -324,7 +324,7 @@ void InputMap::load_default() { key.key.scancode=KEY_PAGEDOWN; action_add_event("ui_page_down",key); -// set("display/handheld/orientation", "landscape"); + //set("display/handheld/orientation", "landscape"); } diff --git a/core/io/file_access_buffered_fa.h b/core/io/file_access_buffered_fa.h index 884d40a266..000c2b45f3 100644 --- a/core/io/file_access_buffered_fa.h +++ b/core/io/file_access_buffered_fa.h @@ -127,10 +127,11 @@ public: set_error(OK); }; -// static void make_default() { - - //FileAccess::create_func = FileAccessBufferedFA<T>::create; -// }; + /* + static void make_default() { + FileAccess::create_func = FileAccessBufferedFA<T>::create; + }; + */ virtual uint64_t _get_modified_time(const String& p_file) { diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index a9dbf56c15..32eb003228 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -68,7 +68,7 @@ FileAccess* FileAccessMemory::create() { bool FileAccessMemory::file_exists(const String& p_name) { String name = fix_path(p_name); -// name = DirAccess::normalize_path(name); + //name = DirAccess::normalize_path(name); return files && (files->find(name) != NULL); } @@ -87,7 +87,7 @@ Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) { ERR_FAIL_COND_V(!files, ERR_FILE_NOT_FOUND); String name = fix_path(p_path); -// name = DirAccess::normalize_path(name); + //name = DirAccess::normalize_path(name); Map<String, Vector<uint8_t> >::Element* E = files->find(name); ERR_FAIL_COND_V(!E, ERR_FILE_NOT_FOUND); diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 19076b57be..7bf750f6e1 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -206,7 +206,7 @@ Error FileAccessNetworkClient::connect(const String& p_host,int p_port,const Str } DEBUG_PRINT("IP: "+String(ip)+" port "+itos(p_port)); - Error err = client->connect(ip,p_port); + Error err = client->connect_to_host(ip,p_port); ERR_FAIL_COND_V(err,err); while(client->get_status()==StreamPeerTCP::STATUS_CONNECTING) { //DEBUG_PRINT("trying to connect...."); @@ -325,7 +325,7 @@ Error FileAccessNetwork::_open(const String& p_path, int p_mode_flags) { last_page=-1; last_page_buff=NULL; -// buffers.clear(); + //buffers.clear(); nc->unlock_mutex(); DEBUG_PRINT("OPEN POST"); DEBUG_TIME("open_post"); @@ -437,7 +437,7 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const{ p_length=total_size-pos; } -// FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton; + //FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton; uint8_t *buff=last_page_buff; diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 7e3a6d1fa0..d63539a7a5 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -340,7 +340,7 @@ FileAccessPack::~FileAccessPack() { ////////////////////////////////////////////////////////////////////////////////// -bool DirAccessPack::list_dir_begin() { +Error DirAccessPack::list_dir_begin() { list_dirs.clear(); @@ -356,7 +356,7 @@ bool DirAccessPack::list_dir_begin() { list_files.push_back(E->get()); } - return true; + return OK; } String DirAccessPack::get_next(){ diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 83340a662b..0a1320e57b 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -209,7 +209,7 @@ class DirAccessPack : public DirAccess { public: - virtual bool list_dir_begin(); + virtual Error list_dir_begin(); virtual String get_next(); virtual bool current_is_dir() const; virtual bool current_is_hidden() const; diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index c4439f2599..87f07cb7b1 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -165,7 +165,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const { bool ZipArchive::try_open_pack(const String& p_name) { //printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); - if (p_name.extension().nocasecmp_to("zip") != 0 && p_name.extension().nocasecmp_to("pcz") != 0) + if (p_name.get_extension().nocasecmp_to("zip") != 0 && p_name.get_extension().nocasecmp_to("pcz") != 0) return false; zlib_filefunc_def io; diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 5e57f55f87..63c8abbbad 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -33,7 +33,7 @@ void HTTPClient::set_ip_type(IP::Type p_type) { ip_type = p_type; } -Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){ +Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){ close(); tcp_connection->set_ip_type(ip_type); @@ -57,7 +57,7 @@ Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_ve if (conn_host.is_valid_ip_address()) { //is ip - Error err = tcp_connection->connect(IP_Address(conn_host),p_port); + Error err = tcp_connection->connect_to_host(IP_Address(conn_host),p_port); if (err) { status=STATUS_CANT_CONNECT; return err; @@ -232,7 +232,7 @@ Error HTTPClient::get_response_headers(List<String> *r_response) { void HTTPClient::close(){ if (tcp_connection->get_status()!=StreamPeerTCP::STATUS_NONE) - tcp_connection->disconnect(); + tcp_connection->disconnect_from_host(); connection.unref(); status=STATUS_DISCONNECTED; @@ -267,7 +267,7 @@ Error HTTPClient::poll(){ case IP::RESOLVER_STATUS_DONE: { IP_Address host = IP::get_singleton()->get_resolve_item_address(resolving); - Error err = tcp_connection->connect(host,conn_port); + Error err = tcp_connection->connect_to_host(host,conn_port); IP::get_singleton()->erase_resolve_item(resolving); resolving=IP::RESOLVER_INVALID_ID; if (err) { @@ -300,7 +300,7 @@ Error HTTPClient::poll(){ case StreamPeerTCP::STATUS_CONNECTED: { if (ssl) { Ref<StreamPeerSSL> ssl = StreamPeerSSL::create(); - Error err = ssl->connect(tcp_connection,true,ssl_verify_host?conn_host:String()); + Error err = ssl->connect_to_stream(tcp_connection,true,ssl_verify_host?conn_host:String()); if (err!=OK) { close(); status=STATUS_SSL_HANDSHAKE_ERROR; @@ -640,7 +640,7 @@ Error HTTPClient::_get_http_data(uint8_t* p_buffer, int p_bytes,int &r_received) void HTTPClient::_bind_methods() { ClassDB::bind_method(_MD("set_ip_type","ip_type"),&HTTPClient::set_ip_type); - ClassDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); + ClassDB::bind_method(_MD("connect_to_host:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect_to_host,DEFVAL(false),DEFVAL(true)); ClassDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection); ClassDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection); ClassDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw); diff --git a/core/io/http_client.h b/core/io/http_client.h index c6f96db1d6..496d22530b 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -167,7 +167,7 @@ public: void set_ip_type(IP::Type p_type); //Error connect_and_get(const String& p_url,bool p_verify_host=true); //connects to a full url and perform request - Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true); + Error connect_to_host(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true); void set_connection(const Ref<StreamPeer>& p_connection); Ref<StreamPeer> get_connection() const; diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp index d4d10e2126..2b01e865f4 100644 --- a/core/io/image_loader.cpp +++ b/core/io/image_loader.cpp @@ -36,7 +36,7 @@ bool ImageFormatLoader::recognize(const String& p_extension) const { get_recognized_extensions(&extensions); for (List<String>::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(p_extension.extension())==0) + if (E->get().nocasecmp_to(p_extension.get_extension())==0) return true; } @@ -56,7 +56,7 @@ Error ImageLoader::load_image(String p_file,Image *p_image, FileAccess *p_custom } } - String extension = p_file.extension(); + String extension = p_file.get_extension(); for (int i=0;i<loader_count;i++) { diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index 91d1fc5f98..9fec807bfb 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -36,7 +36,7 @@ String PacketPeerUDP::_get_packet_ip() const { return get_packet_address(); } -Error PacketPeerUDP::_set_send_address(const String& p_address, int p_port) { +Error PacketPeerUDP::_set_dest_address(const String& p_address, int p_port) { IP_Address ip; if (p_address.is_valid_ip_address()) { @@ -47,7 +47,7 @@ Error PacketPeerUDP::_set_send_address(const String& p_address, int p_port) { return ERR_CANT_RESOLVE; } - set_send_address(ip,p_port); + set_dest_address(ip,p_port); return OK; } @@ -66,7 +66,7 @@ void PacketPeerUDP::_bind_methods() { ClassDB::bind_method(_MD("get_packet_ip"),&PacketPeerUDP::_get_packet_ip); //ClassDB::bind_method(_MD("get_packet_address"),&PacketPeerUDP::_get_packet_address); ClassDB::bind_method(_MD("get_packet_port"),&PacketPeerUDP::get_packet_port); - ClassDB::bind_method(_MD("set_send_address","host","port"),&PacketPeerUDP::_set_send_address); + ClassDB::bind_method(_MD("set_dest_address","host","port"),&PacketPeerUDP::_set_dest_address); } diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h index 17a2817f34..17952b4ac1 100644 --- a/core/io/packet_peer_udp.h +++ b/core/io/packet_peer_udp.h @@ -45,7 +45,7 @@ protected: String _get_packet_ip() const; - virtual Error _set_send_address(const String& p_address,int p_port); + virtual Error _set_dest_address(const String& p_address,int p_port); public: @@ -56,7 +56,7 @@ public: virtual bool is_listening() const=0; virtual IP_Address get_packet_address() const=0; virtual int get_packet_port() const=0; - virtual void set_send_address(const IP_Address& p_address,int p_port)=0; + virtual void set_dest_address(const IP_Address& p_address,int p_port)=0; static Ref<PacketPeerUDP> create_ref(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index c093b087b8..4af3503434 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1059,7 +1059,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->open(f); @@ -1114,7 +1114,7 @@ Error ResourceFormatLoaderBinary::load_import_metadata(const String &p_path, Ref Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->recognize(f); if(ria->error!=OK) return ERR_FILE_UNRECOGNIZED; @@ -1159,14 +1159,14 @@ void ResourceFormatLoaderBinary::get_dependencies(const String& p_path,List<Stri Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->get_dependencies(f,p_dependencies,p_add_types); } Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path,const Map<String,String>& p_map) { -// Error error=OK; + //Error error=OK; FileAccess *f=FileAccess::open(p_path,FileAccess::READ); @@ -1250,7 +1250,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path,const ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; ria->remaps=p_map; - // ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->open(f); err = ria->poll(); @@ -1384,7 +1384,7 @@ String ResourceFormatLoaderBinary::get_resource_type(const String &p_path) const Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); String r = ria->recognize(f); return r; @@ -1708,8 +1708,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, for(List<Variant>::Element *E=keys.front();E;E=E->next()) { - //if (!_check_type(dict[E->get()])) - // continue; + /* + if (!_check_type(dict[E->get()])) + continue; + */ write_variant(E->get()); write_variant(d[E->get()]); @@ -2150,7 +2152,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_ } Vector<uint64_t> ofs_table; -// int saved_idx=0; + //int saved_idx=0; //now actually save the resources for(List<ResourceData>::Element *E=resources.front();E;E=E->next()) { diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index cc3c8ce006..354efaa83f 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -55,7 +55,7 @@ bool ResourceFormatLoader::recognize(const String& p_extension) const { get_recognized_extensions(&extensions); for (List<String>::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(p_extension.extension())==0) + if (E->get().nocasecmp_to(p_extension.get_extension())==0) return true; } @@ -182,7 +182,7 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p if (OS::get_singleton()->is_stdout_verbose()) print_line("load resource: "+remapped_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); bool found=false; for (int i=0;i<loader_count;i++) { @@ -230,7 +230,7 @@ Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p else local_path = GlobalConfig::get_singleton()->localize_path(p_path); - String extension=p_path.extension(); + String extension=p_path.get_extension(); Ref<ResourceImportMetadata> ret; for (int i=0;i<loader_count;i++) { @@ -331,7 +331,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); bool found=false; for (int i=0;i<loader_count;i++) { @@ -385,14 +385,16 @@ void ResourceLoader::get_dependencies(const String& p_path, List<String> *p_depe String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i<loader_count;i++) { if (!loader[i]->recognize(extension)) continue; - //if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) - // continue; + /* + if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) + continue; + */ loader[i]->get_dependencies(remapped_path,p_dependencies,p_add_types); @@ -410,14 +412,16 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Map<String, String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i<loader_count;i++) { if (!loader[i]->recognize(extension)) continue; - //if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) - // continue; + /* + if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) + continue; + */ return loader[i]->rename_dependencies(p_path,p_map); @@ -449,7 +453,7 @@ String ResourceLoader::get_resource_type(const String &p_path) { local_path = GlobalConfig::get_singleton()->localize_path(p_path); String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i<loader_count;i++) { diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 9081adaa8f..222d3e6bc0 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -40,7 +40,7 @@ ResourceSavedCallback ResourceSaver::save_callback=0; Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_flags) { - String extension=p_path.extension(); + String extension=p_path.get_extension(); Error err=ERR_FILE_UNRECOGNIZED; for (int i=0;i<saver_count;i++) { @@ -54,7 +54,7 @@ Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_ for (List<String>::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(extension.extension())==0) + if (E->get().nocasecmp_to(extension.get_extension())==0) recognized=true; } diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index aab42a2989..fc535e94b0 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -57,10 +57,10 @@ bool StreamPeerSSL::is_available() { void StreamPeerSSL::_bind_methods() { - ClassDB::bind_method(_MD("accept:Error","stream:StreamPeer"),&StreamPeerSSL::accept); - ClassDB::bind_method(_MD("connect:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect,DEFVAL(false),DEFVAL(String())); + ClassDB::bind_method(_MD("accept_stream:Error","stream:StreamPeer"),&StreamPeerSSL::accept_stream); + ClassDB::bind_method(_MD("connect_to_stream:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect_to_stream,DEFVAL(false),DEFVAL(String())); ClassDB::bind_method(_MD("get_status"),&StreamPeerSSL::get_status); - ClassDB::bind_method(_MD("disconnect"),&StreamPeerSSL::disconnect); + ClassDB::bind_method(_MD("disconnect_from_stream"),&StreamPeerSSL::disconnect_from_stream); BIND_CONSTANT( STATUS_DISCONNECTED ); BIND_CONSTANT( STATUS_CONNECTED ); BIND_CONSTANT( STATUS_ERROR_NO_CERTIFICATE ); diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h index 8675433a30..9aafac874d 100644 --- a/core/io/stream_peer_ssl.h +++ b/core/io/stream_peer_ssl.h @@ -57,11 +57,11 @@ public: STATUS_ERROR_HOSTNAME_MISMATCH }; - virtual Error accept(Ref<StreamPeer> p_base)=0; - virtual Error connect(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String())=0; + virtual Error accept_stream(Ref<StreamPeer> p_base)=0; + virtual Error connect_to_stream(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String())=0; virtual Status get_status() const=0; - virtual void disconnect()=0; + virtual void disconnect_from_stream()=0; static StreamPeerSSL* create(); diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 2218057cf7..0a59c32995 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -41,24 +41,24 @@ Error StreamPeerTCP::_connect(const String& p_address,int p_port) { return ERR_CANT_RESOLVE; } - connect(ip,p_port); + connect_to_host(ip,p_port); return OK; } void StreamPeerTCP::set_ip_type(IP::Type p_type) { - disconnect(); + disconnect_from_host(); ip_type = p_type; } void StreamPeerTCP::_bind_methods() { ClassDB::bind_method(_MD("set_ip_type","ip_type"),&StreamPeerTCP::set_ip_type); - ClassDB::bind_method(_MD("connect","host","port"),&StreamPeerTCP::_connect); - ClassDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected); + ClassDB::bind_method(_MD("connect_to_host","host","port"),&StreamPeerTCP::_connect); + ClassDB::bind_method(_MD("is_connected_to_host"),&StreamPeerTCP::is_connected_to_host); ClassDB::bind_method(_MD("get_status"),&StreamPeerTCP::get_status); ClassDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host); ClassDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port); - ClassDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect); + ClassDB::bind_method(_MD("disconnect_from_host"),&StreamPeerTCP::disconnect_from_host); BIND_CONSTANT( STATUS_NONE ); BIND_CONSTANT( STATUS_CONNECTING ); diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h index 8f6dfaf3f8..2b25f31739 100644 --- a/core/io/stream_peer_tcp.h +++ b/core/io/stream_peer_tcp.h @@ -60,13 +60,13 @@ protected: public: virtual void set_ip_type(IP::Type p_type); - virtual Error connect(const IP_Address& p_host, uint16_t p_port)=0; + virtual Error connect_to_host(const IP_Address& p_host, uint16_t p_port)=0; //read/write from streampeer - virtual bool is_connected() const=0; + virtual bool is_connected_to_host() const=0; virtual Status get_status() const=0; - virtual void disconnect()=0; + virtual void disconnect_from_host()=0; virtual IP_Address get_connected_host() const=0; virtual uint16_t get_connected_port() const=0; virtual void set_nodelay(bool p_enabled)=0; diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 8c4c1c8180..bee38e037f 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -204,7 +204,7 @@ bool TranslationLoaderPO::handles_type(const String& p_type) const{ String TranslationLoaderPO::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="po") + if (p_path.get_extension().to_lower()=="po") return "Translation"; return ""; } diff --git a/core/io/zip.c b/core/io/zip.c index 44c79195d9..27a3d3cdc1 100644 --- a/core/io/zip.c +++ b/core/io/zip.c @@ -855,7 +855,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl ziinit.z_filefunc.zseek32_file = NULL; ziinit.z_filefunc.ztell32_file = NULL; if (pzlib_filefunc64_32_def==NULL) { -// fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); + //fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); } else ziinit.z_filefunc = *pzlib_filefunc64_32_def; diff --git a/core/map.h b/core/map.h index af35fec332..9448389169 100644 --- a/core/map.h +++ b/core/map.h @@ -149,7 +149,7 @@ private: #ifdef GLOBALNIL_DISABLED memdelete_allocator<Element,A>(_nil); #endif -// memdelete_allocator<Element,A>(_root); + //memdelete_allocator<Element,A>(_root); } }; diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index b888b6b56c..e2526f5134 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -390,8 +390,10 @@ static int _bsp_create_node(const Face3 *p_faces,const Vector<int>& p_indices,Ve const Face3& f=p_faces[ indices[i] ]; - //if (f.get_plane().is_almost_like(divisor_plane)) - // continue; + /* + if (f.get_plane().is_almost_like(divisor_plane)) + continue; + */ int over_count=0; int under_count=0; @@ -546,7 +548,7 @@ BSP_Tree::BSP_Tree(const Variant& p_variant) { error_radius = d["error"]; aabb = d["aabb"]; -// int node_count = src_nodes.size(); + //int node_count = src_nodes.size(); nodes.resize(src_nodes.size()/3); PoolVector<int>::Read r = src_nodes.read(); diff --git a/core/math/geometry.h b/core/math/geometry.h index 9800e5513c..d5b3a3068c 100644 --- a/core/math/geometry.h +++ b/core/math/geometry.h @@ -750,9 +750,7 @@ public: return Vector<Vector3>(); //empty } -// long count = 0; long previous = polygon.size() - 1; - Vector<Vector3> clipped; for (int index = 0; index < polygon.size(); index++) { diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 7896299c24..a24c4266ee 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -154,7 +154,7 @@ struct Vector2 { Vector2 floor() const; Vector2 snapped(const Vector2& p_by) const; - real_t get_aspect() const { return width/height; } + real_t aspect() const { return width/height; } operator String() const { return String::num(x)+", "+String::num(y); } diff --git a/core/math/octree.h b/core/math/octree.h index 1a41413a76..483ba1d510 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -130,8 +130,10 @@ private: ~Octant() { - //for (int i=0;i<8;i++) - // memdelete_notnull(children[i]); + /* + for (int i=0;i<8;i++) + memdelete_notnull(children[i]); + */ } }; @@ -250,8 +252,10 @@ private: E->get().eA=p_A->pair_list.push_back(&E->get()); E->get().eB=p_B->pair_list.push_back(&E->get()); -// if (pair_callback) -// pair_callback(pair_callback_userdata,p_A->userdata,p_B->userdata); + /* + if (pair_callback) + pair_callback(pair_callback_userdata,p_A->userdata,p_B->userdata); + */ } else { E->get().refcount++; @@ -970,8 +974,10 @@ void Octree<T,use_pairs,AL>::move(OctreeElementID p_id, const Rect3& p_aabb) { Octant *o=E->get().octant; typename List<typename Element::OctantOwner,AL>::Element *N=E->next(); -// if (!use_pairs) -// o->elements.erase( E->get().E ); + /* + if (!use_pairs) + o->elements.erase( E->get().E ); + */ if (use_pairs && e.pairable) o->pairable_elements.erase( E->get().E ); diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index ab81a068d4..756e48d0b4 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -483,7 +483,7 @@ Error QuickHull::build(const Vector<Vector3>& p_points, Geometry::MeshData &r_me //fill mesh r_mesh.faces.clear(); r_mesh.faces.resize(ret_faces.size()); -// print_line("FACECOUNT: "+itos(r_mesh.faces.size())); + //print_line("FACECOUNT: "+itos(r_mesh.faces.size())); int idx=0; for (List<Geometry::MeshData::Face>::Element *E=ret_faces.front();E;E=E->next()) { diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index fc5f55066b..74c4656771 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -320,7 +320,7 @@ bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end bool valid = b.aabb.intersects_segment(p_begin,p_end); -// bool valid = b.aabb.intersects(ray_aabb); + //bool valid = b.aabb.intersects(ray_aabb); if (!valid) { diff --git a/core/math/triangulator.cpp b/core/math/triangulator.cpp index 8f82d76823..75b2b064c4 100644 --- a/core/math/triangulator.cpp +++ b/core/math/triangulator.cpp @@ -1128,7 +1128,7 @@ int TriangulatorPartition::MonotonePartition(List<TriangulatorPoly> *inpolys, Li //this makes deleting existing edges much faster Set<ScanLineEdge>::Element **edgeTreeIterators,*edgeIter; edgeTreeIterators = new Set<ScanLineEdge>::Element*[maxnumvertices]; -// Pair<Set<ScanLineEdge>::Element*,bool> edgeTreeRet; + //Pair<Set<ScanLineEdge>::Element*,bool> edgeTreeRet; for(i = 0; i<numvertices; i++) edgeTreeIterators[i] = NULL; //for each vertex diff --git a/core/object.cpp b/core/object.cpp index 3bb917bd38..8af088122e 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -369,8 +369,10 @@ void Object::set(const String& p_name, const Variant& p_value) { _setv(p_name,p_value); - //if (!_use_builtin_script()) -// return; + /* + if (!_use_builtin_script()) + return; + */ bool success; ClassDB::set_property(this,p_name,p_value,success); @@ -410,8 +412,10 @@ void Object::set(const StringName& p_name, const Variant& p_value, bool *r_valid //try built-in setgetter { if (ClassDB::set_property(this,p_name,p_value,r_valid)) { - //if (r_valid) - // *r_valid=true; + /* + if (r_valid) + *r_valid=true; + */ return; } } @@ -1689,12 +1693,12 @@ void Object::_bind_methods() { //todo reimplement this per language so all 5 arguments can be called -// ClassDB::bind_method(_MD("call","method","arg1","arg2","arg3","arg4"),&Object::_call_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); -// ClassDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); + //ClassDB::bind_method(_MD("call","method","arg1","arg2","arg3","arg4"),&Object::_call_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); + //ClassDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); ClassDB::bind_method(_MD("add_user_signal","signal","arguments"),&Object::_add_user_signal,DEFVAL(Array())); ClassDB::bind_method(_MD("has_user_signal","signal"),&Object::_has_user_signal); -// ClassDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array())); + //ClassDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array())); { diff --git a/core/object.h b/core/object.h index a54693eab6..6ce579ea99 100644 --- a/core/object.h +++ b/core/object.h @@ -579,8 +579,8 @@ public: } /* IAPI */ -// void set(const String& p_name, const Variant& p_value); -// Variant get(const String& p_name) const; + //void set(const String& p_name, const Variant& p_value); + //Variant get(const String& p_name) const; void set(const StringName& p_name, const Variant& p_value, bool *r_valid=NULL); Variant get(const StringName& p_name, bool *r_valid=NULL) const; diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index f3bb37421f..24b9c26e71 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -897,7 +897,7 @@ bool ClassDB::set_property(Object* p_object,const StringName& p_property, const if (psg->index>=0) { Variant index=psg->index; const Variant* arg[2]={&index,&p_value}; -// p_object->call(psg->setter,arg,2,ce); + //p_object->call(psg->setter,arg,2,ce); if (psg->_setptr) { psg->_setptr->call(p_object,arg,2,ce); } else { @@ -1111,6 +1111,15 @@ MethodBind* ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const String instance_type=p_bind->get_instance_class(); +#ifdef DEBUG_ENABLED + + if (has_method(instance_type,mdname)) { + ERR_EXPLAIN("Class "+String(instance_type)+" already has a method "+String(mdname)); + ERR_FAIL_V(NULL); + } +#endif + + ClassInfo *type=classes.getptr(instance_type); if (!type) { ERR_PRINTS("Couldn't bind method '"+mdname+"' for instance: "+instance_type); diff --git a/core/os/dir_access.h b/core/os/dir_access.h index f824b5f319..7c173fc780 100644 --- a/core/os/dir_access.h +++ b/core/os/dir_access.h @@ -72,7 +72,7 @@ protected: public: - virtual bool list_dir_begin()=0; ///< This starts dir listing + virtual Error list_dir_begin()=0; ///< This starts dir listing virtual String get_next(bool* p_is_dir); // compatibility virtual String get_next()=0; virtual bool current_is_dir() const=0; diff --git a/core/os/input.cpp b/core/os/input.cpp index d2bd433ed9..acfd5ba540 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -74,7 +74,7 @@ void Input::_bind_methods() { ClassDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer); ClassDB::bind_method(_MD("get_gyroscope"),&Input::get_gyroscope); //ClassDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want - ClassDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed); + ClassDB::bind_method(_MD("get_last_mouse_speed"),&Input::get_last_mouse_speed); ClassDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask); ClassDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode); ClassDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode); diff --git a/core/os/input.h b/core/os/input.h index c365894f46..a1b60ba0c8 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -77,7 +77,7 @@ public: virtual void stop_joy_vibration(int p_device)=0; virtual Point2 get_mouse_pos() const=0; - virtual Point2 get_mouse_speed() const=0; + virtual Point2 get_last_mouse_speed() const=0; virtual int get_mouse_button_mask() const=0; virtual void warp_mouse_pos(const Vector2& p_to)=0; diff --git a/core/os/memory.h b/core/os/memory.h index 0e6dea48d3..49424037ff 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -97,8 +97,8 @@ _ALWAYS_INLINE_ T *_post_initialize(T *p_obj) { #define memnew(m_class) _post_initialize(new("") m_class) _ALWAYS_INLINE_ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_description) { -// void *failptr=0; -// ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ + //void *failptr=0; + //ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ return p_pointer; } diff --git a/core/os/os.cpp b/core/os/os.cpp index f4c13dabcc..3a8e15a692 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -166,7 +166,7 @@ const char *OS::get_last_error() const { void OS::dump_memory_to_file(const char* p_file) { -// Memory::dump_static_mem_to_file(p_file); + //Memory::dump_static_mem_to_file(p_file); } static FileAccess *_OSPRF=NULL; diff --git a/core/path_remap.cpp b/core/path_remap.cpp index fd5b38fa79..42383e212d 100644 --- a/core/path_remap.cpp +++ b/core/path_remap.cpp @@ -142,7 +142,7 @@ void PathRemap::load_remaps() { // platform remaps second, so override remaps = GlobalConfig::get_singleton()->get("remap/"+OS::get_singleton()->get_name()); -// remaps = Globals::get_singleton()->get("remap/PSP"); + //remaps = Globals::get_singleton()->get("remap/PSP"); { int rlen = remaps.size(); @@ -152,7 +152,7 @@ void PathRemap::load_remaps() { String from = r[i*2+0]; String to = r[i*2+1]; -// print_line("add remap: "+from+" -> "+to); + //print_line("add remap: "+from+" -> "+to); add_remap(from,to); } } diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index d97323a95e..85fa5d27c0 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -123,7 +123,7 @@ void register_core_types() { ClassDB::register_virtual_class<PacketPeer>(); ClassDB::register_class<PacketPeerStream>(); ClassDB::register_class<MainLoop>(); -// ClassDB::register_type<OptimizedSaver>(); + //ClassDB::register_type<OptimizedSaver>(); ClassDB::register_class<Translation>(); ClassDB::register_class<PHashTranslation>(); ClassDB::register_class<UndoRedo>(); diff --git a/core/resource.cpp b/core/resource.cpp index db4d2ec0db..3369e4a5a2 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -522,11 +522,12 @@ void ResourceCache::clear() { void ResourceCache::reload_externals() { - //const String *K=NULL; - //while ((K=resources.next(K))) { -// resources[*K]->reload_external_data(); -// } - + /* + const String *K=NULL; + while ((K=resources.next(K))) { + resources[*K]->reload_external_data(); + } + */ } bool ResourceCache::has(const String& p_path) { diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index a120a28896..bb0109467e 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -66,7 +66,7 @@ Error ScriptDebuggerRemote::connect_to_host(const String& p_host,uint16_t p_port int port = p_port; int tries = 3; - tcp_client->connect(ip, port); + tcp_client->connect_to_host(ip, port); while (tries--) { @@ -129,7 +129,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { //or when execution is paused from editor - if (!tcp_client->is_connected()) { + if (!tcp_client->is_connected_to_host()) { ERR_EXPLAIN("Script Debugger failed to connect, but being used anyway."); ERR_FAIL(); } @@ -446,7 +446,7 @@ void ScriptDebuggerRemote::_err_handler(void* ud,const char* p_func,const char*p sdr->mutex->lock(); - if (!sdr->locking && sdr->tcp_client->is_connected()) { + if (!sdr->locking && sdr->tcp_client->is_connected_to_host()) { sdr->errors.push_back(oe); } @@ -887,7 +887,7 @@ void ScriptDebuggerRemote::idle_poll() { void ScriptDebuggerRemote::send_message(const String& p_message, const Array &p_args) { mutex->lock(); - if (!locking && tcp_client->is_connected()) { + if (!locking && tcp_client->is_connected_to_host()) { Message msg; msg.message=p_message; @@ -928,7 +928,7 @@ void ScriptDebuggerRemote::_print_handler(void *p_this,const String& p_string) { } sdr->mutex->lock(); - if (!sdr->locking && sdr->tcp_client->is_connected()) { + if (!sdr->locking && sdr->tcp_client->is_connected_to_host()) { sdr->output_strings.push_back(s); } diff --git a/core/set.h b/core/set.h index 9da2887671..13c2b3a4f6 100644 --- a/core/set.h +++ b/core/set.h @@ -141,7 +141,7 @@ private: #ifdef GLOBALNIL_DISABLED memdelete_allocator<Element,A>(_nil); #endif -// memdelete_allocator<Element,A>(_root); + //memdelete_allocator<Element,A>(_root); } }; @@ -307,7 +307,7 @@ private: new_node->right=_data._nil; new_node->left=_data._nil; new_node->value=p_value; -// new_node->data=_data; + //new_node->data=_data; if (new_parent==_data._root || less(p_value,new_parent->value)) { new_parent->left=new_node; diff --git a/core/ustring.cpp b/core/ustring.cpp index 27bb8eac72..9fb8cfc00f 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -560,7 +560,7 @@ String String::get_slice(String p_splitter, int p_slice) const { int pos=0; int prev_pos=0; -// int slices=1; + //int slices=1; if (p_slice<0) return ""; if (find(p_splitter)==-1) @@ -574,7 +574,7 @@ String String::get_slice(String p_splitter, int p_slice) const { pos=length(); //reached end int from=prev_pos; - // int to=pos; + //int to=pos; if (p_slice==i) { @@ -1420,7 +1420,7 @@ bool String::parse_utf8(const char* p_utf8,int p_len) { } } -// printf("char %i, len %i\n",unichar,len); + //printf("char %i, len %i\n",unichar,len); if (sizeof(wchar_t)==2 && unichar>0xFFFF) { unichar=' '; //too long for windows @@ -2951,6 +2951,78 @@ bool String::matchn(const String& p_wildcard) const { } +String String::format(const Variant& values,String placeholder) const { + + String new_string = String( this->ptr() ); + + if( values.get_type() == Variant::ARRAY ) { + Array values_arr = values; + + for(int i=0;i<values_arr.size();i++) { + String i_as_str = String::num_int64( i ); + + if( values_arr[i].get_type() == Variant::ARRAY ) {//Array in Array structure [["name","RobotGuy"],[0,"godot"],["strength",9000.91]] + Array value_arr = values_arr[i]; + + if( value_arr.size()==2 ) { + Variant v_key = value_arr[0]; + String key; + + key = v_key.get_construct_string(); + if( key.left(1)=="\"" && key.right(key.length()-1)=="\"" ) { + key = key.substr(1,key.length()-2); + } + + Variant v_val = value_arr[1]; + String val; + val = v_val.get_construct_string(); + + if( val.left(1)=="\"" && val.right(val.length()-1)=="\"" ) { + val = val.substr(1,val.length()-2); + } + + new_string = new_string.replacen( placeholder.replace("_", key ), val ); + }else { + ERR_PRINT(String("STRING.format Inner Array size != 2 ").ascii().get_data()); + } + } else {//Array structure ["RobotGuy","Logis","rookie"] + Variant v_val = values_arr[i]; + String val; + val = v_val.get_construct_string(); + + if( val.left(1)=="\"" && val.right(val.length()-1)=="\"" ) { + val = val.substr(1,val.length()-2); + } + + new_string = new_string.replacen( placeholder.replace("_", i_as_str ), val ); + } + } + }else if( values.get_type() == Variant::DICTIONARY ) { + Dictionary d = values; + List<Variant> keys; + d.get_key_list(&keys); + + for (List<Variant>::Element *E=keys.front();E;E=E->next()) { + String key = E->get().get_construct_string(); + String val = d[E->get()].get_construct_string(); + + if( key.left(1)=="\"" && key.right(key.length()-1)=="\"" ) { + key = key.substr(1,key.length()-2); + } + + if( val.left(1)=="\"" && val.right(val.length()-1)=="\"" ) { + val = val.substr(1,val.length()-2); + } + + new_string = new_string.replacen( placeholder.replace("_", key ), val ); + } + }else{ + ERR_PRINT(String("Invalid type: use Array or Dictionary.").ascii().get_data()); + } + + return new_string; +} + String String::replace(String p_key,String p_with) const { String new_string; @@ -3812,7 +3884,7 @@ String String::get_file() const { return substr(sep+1,length()); } -String String::extension() const { +String String::get_extension() const { int pos = find_last("."); if (pos<0) @@ -3891,7 +3963,7 @@ String String::percent_decode() const { return String::utf8(pe.ptr()); } -String String::basename() const { +String String::get_basename() const { int pos = find_last("."); if (pos<0) @@ -4211,4 +4283,3 @@ String RTR(const String& p_text) { return p_text; } - diff --git a/core/ustring.h b/core/ustring.h index 9a145143d0..426762a9e1 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -125,6 +125,7 @@ public: bool is_subsequence_ofi(const String& p_string) const; Vector<String> bigrams() const; float similarity(const String& p_string) const; + String format(const Variant& values,String placeholder="{_}") const; String replace_first(String p_key,String p_with) const; String replace(String p_key,String p_with) const; String replacen(String p_key,String p_with) const; @@ -176,8 +177,8 @@ public: String right(int p_pos) const; String strip_edges(bool left = true, bool right = true) const; String strip_escapes() const; - String extension() const; - String basename() const; + String get_extension() const; + String get_basename() const; String plus_file(const String& p_file) const; CharType ord_at(int p_idx) const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 0c8b40539d..51ad115d46 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -146,7 +146,7 @@ struct _VariantCall { Arg(Variant::Type p_type,const StringName &p_name) { name=p_name; type=p_type; } }; -// void addfunc(Variant::Type p_type, const StringName& p_name,VariantFunc p_func); + //void addfunc(Variant::Type p_type, const StringName& p_name,VariantFunc p_func); static void make_func_return_variant(Variant::Type p_type,const StringName& p_name) { @@ -261,6 +261,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM1R(String,is_subsequence_ofi); VCALL_LOCALMEM0R(String,bigrams); VCALL_LOCALMEM1R(String,similarity); + VCALL_LOCALMEM2R(String,format); VCALL_LOCALMEM2R(String,replace); VCALL_LOCALMEM2R(String,replacen); VCALL_LOCALMEM2R(String,insert); @@ -272,8 +273,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM1R(String,left); VCALL_LOCALMEM1R(String,right); VCALL_LOCALMEM2R(String,strip_edges); - VCALL_LOCALMEM0R(String,extension); - VCALL_LOCALMEM0R(String,basename); + VCALL_LOCALMEM0R(String,get_extension); + VCALL_LOCALMEM0R(String,get_basename); VCALL_LOCALMEM1R(String,plus_file); VCALL_LOCALMEM1R(String,ord_at); VCALL_LOCALMEM2(String,erase); @@ -349,12 +350,12 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Vector2,tangent); VCALL_LOCALMEM0R(Vector2,floor); VCALL_LOCALMEM1R(Vector2,snapped); - VCALL_LOCALMEM0R(Vector2,get_aspect); + VCALL_LOCALMEM0R(Vector2,aspect); VCALL_LOCALMEM1R(Vector2,dot); VCALL_LOCALMEM1R(Vector2,slide); VCALL_LOCALMEM1R(Vector2,reflect); VCALL_LOCALMEM0R(Vector2,angle); -// VCALL_LOCALMEM1R(Vector2,cross); + //VCALL_LOCALMEM1R(Vector2,cross); VCALL_LOCALMEM0R(Vector2,abs); VCALL_LOCALMEM1R(Vector2,clamped); @@ -1392,6 +1393,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(STRING,POOL_STRING_ARRAY,String,bigrams,varray()); ADDFUNC1(STRING,REAL,String,similarity,STRING,"text",varray()); + ADDFUNC2(STRING,STRING,String,format,NIL,"values",STRING,"placeholder",varray("{_}")); ADDFUNC2(STRING,STRING,String,replace,STRING,"what",STRING,"forwhat",varray()); ADDFUNC2(STRING,STRING,String,replacen,STRING,"what",STRING,"forwhat",varray()); ADDFUNC2(STRING,STRING,String,insert,INT,"pos",STRING,"what",varray()); @@ -1405,8 +1407,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(STRING,STRING,String,left,INT,"pos",varray()); ADDFUNC1(STRING,STRING,String,right,INT,"pos",varray()); ADDFUNC2(STRING,STRING,String,strip_edges,BOOL,"left",BOOL,"right",varray(true,true)); - ADDFUNC0(STRING,STRING,String,extension,varray()); - ADDFUNC0(STRING,STRING,String,basename,varray()); + ADDFUNC0(STRING,STRING,String,get_extension,varray()); + ADDFUNC0(STRING,STRING,String,get_basename,varray()); ADDFUNC1(STRING,STRING,String,plus_file,STRING,"file",varray()); ADDFUNC1(STRING,INT,String,ord_at,INT,"at",varray()); ADDFUNC2(STRING,NIL,String,erase,INT,"pos",INT,"chars", varray()); @@ -1457,7 +1459,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(VECTOR2,VECTOR2,Vector2,tangent,varray()); ADDFUNC0(VECTOR2,VECTOR2,Vector2,floor,varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,snapped,VECTOR2,"by",varray()); - ADDFUNC0(VECTOR2,REAL,Vector2,get_aspect,varray()); + ADDFUNC0(VECTOR2,REAL,Vector2,aspect,varray()); ADDFUNC1(VECTOR2,REAL,Vector2,dot,VECTOR2,"with",varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,slide,VECTOR2,"vec",varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray()); diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 402c8d41da..ca748b7fd3 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -2094,8 +2094,10 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud,"{ "); for(List<Variant>::Element *E=keys.front();E;E=E->next()) { - //if (!_check_type(dict[E->get()])) - // continue; + /* + if (!_check_type(dict[E->get()])) + continue; + */ write(E->get(),p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud); p_store_string_func(p_store_string_ud,":"); write(dict[E->get()],p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud); |