diff options
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/config_file.cpp | 9 | ||||
-rw-r--r-- | core/io/marshalls.h | 2 | ||||
-rw-r--r-- | core/io/packet_peer_udp.cpp | 7 | ||||
-rw-r--r-- | core/io/packet_peer_udp.h | 4 | ||||
-rw-r--r-- | core/io/xml_parser.cpp | 2 |
5 files changed, 20 insertions, 4 deletions
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 052a83168d..6560302083 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -82,8 +82,13 @@ void ConfigFile::set_value(const String &p_section, const String &p_key, const V } Variant ConfigFile::get_value(const String &p_section, const String &p_key, Variant p_default) const { - ERR_FAIL_COND_V(!values.has(p_section), p_default); - ERR_FAIL_COND_V(!values[p_section].has(p_key), p_default); + if (!values.has(p_section) || !values[p_section].has(p_key)) { + if (p_default.get_type() == Variant::NIL) { + ERR_EXPLAIN("Couldn't find the given section/key and no default was given"); + ERR_FAIL_V(p_default); + } + return p_default; + } return values[p_section][p_key]; } diff --git a/core/io/marshalls.h b/core/io/marshalls.h index 939ed9cea9..b322410929 100644 --- a/core/io/marshalls.h +++ b/core/io/marshalls.h @@ -34,7 +34,7 @@ #include "variant.h" /** - * Miscelaneous helpers for marshalling data types, and encoding + * Miscellaneous helpers for marshalling data types, and encoding * in an endian independent way */ diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index 46accf420a..3bc116f1b6 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -31,6 +31,11 @@ PacketPeerUDP *(*PacketPeerUDP::_create)() = NULL; +void PacketPeerUDP::set_blocking_mode(bool p_enable) { + + blocking = p_enable; +} + String PacketPeerUDP::_get_packet_ip() const { return get_packet_address(); @@ -78,4 +83,6 @@ PacketPeerUDP *PacketPeerUDP::create() { } PacketPeerUDP::PacketPeerUDP() { + + blocking = true; } diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h index c316faad4b..c486f443fb 100644 --- a/core/io/packet_peer_udp.h +++ b/core/io/packet_peer_udp.h @@ -36,6 +36,8 @@ class PacketPeerUDP : public PacketPeer { GDCLASS(PacketPeerUDP, PacketPeer); protected: + bool blocking; + static PacketPeerUDP *(*_create)(); static void _bind_methods(); @@ -44,6 +46,8 @@ protected: Error _set_dest_address(const String &p_address, int p_port); public: + void set_blocking_mode(bool p_enable); + virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536) = 0; virtual void close() = 0; virtual Error wait() = 0; diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index e3b669409a..c5929617c9 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -39,7 +39,7 @@ static bool _equalsn(const CharType *str1, const CharType *str2, int len) { return false; // if one (or both) of the strings was smaller then they - // are only equal if they have the same lenght + // are only equal if they have the same length return (i == len) || (str1[i] == 0 && str2[i] == 0); } |