summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2014-05-12 14:32:50 -0300
committerreduz <reduzio@gmail.com>2014-05-12 14:32:50 -0300
commit8905be042d4c0a28c58b317b603e9545e8ee9c12 (patch)
tree1d8ae3ec9383339f8c38e99891e67d247e733d8a
parent1b45a38fb531f448caf515d9423683c136ad4545 (diff)
parent56d9faebab57000c8c82fb631dbf187c55604664 (diff)
Merge pull request #408 from marynate/PR-string-right
Make String::right count from pos instead of pos+1
-rw-r--r--core/ustring.cpp2
-rw-r--r--scene/audio/sample_player.cpp2
-rw-r--r--tools/editor/property_editor.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index d119e341c3..188818bc2a 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2640,7 +2640,7 @@ String String::right(int p_pos) const {
if (p_pos<0)
return "";
- return substr(p_pos+1,(length()-p_pos)-1);
+ return substr(p_pos,(length()-p_pos));
}
CharType String::ord_at(int p_idx) const {
diff --git a/scene/audio/sample_player.cpp b/scene/audio/sample_player.cpp
index be53b8243e..90994f01b4 100644
--- a/scene/audio/sample_player.cpp
+++ b/scene/audio/sample_player.cpp
@@ -52,7 +52,7 @@ bool SamplePlayer::_set(const StringName& p_name, const Variant& p_value) {
set_voice_count(p_value);
else if (name.begins_with("default/")) {
- String what=name.right(7);
+ String what=name.right(8);
if (what=="volume_db")
set_default_volume_db(p_value);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index c2243bcc03..8c16207887 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -1941,7 +1941,7 @@ TreeItem *PropertyEditor::get_parent_node(String p_path,HashMap<String,TreeItem*
TreeItem *parent = get_parent_node( p_path.left( p_path.find_last("/") ),item_paths,root );
item = tree->create_item( parent );
- String name = (p_path.find("/")!=-1)?p_path.right( p_path.find_last("/") ):p_path;
+ String name = (p_path.find("/")!=-1)?p_path.right( p_path.find_last("/")+1 ):p_path;
if (capitalize_paths)
item->set_text(0, name.capitalize() );
else
@@ -2099,7 +2099,7 @@ void PropertyEditor::update_tree() {
TreeItem * item = tree->create_item( parent );
- String name = (p.name.find("/")!=-1)?p.name.right( p.name.find_last("/") ):p.name;
+ String name = (p.name.find("/")!=-1)?p.name.right( p.name.find_last("/")+1 ):p.name;
if (level>0) {
item->set_custom_bg_color(0,col);