tile: don't duplicate std::string::find_last_of
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Wed, 8 Feb 2012 10:49:22 +0000 (11:49 +0100)
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>
Fri, 24 Feb 2012 22:26:14 +0000 (23:26 +0100)
src/tile.cpp

index bc4c49cb1717a548babd6a5204f67c58cdd8e43d..0fa2e1029afd6015f45b040c2776e14641c2c7ea 100644 (file)
@@ -1023,15 +1023,9 @@ video::IImage* generate_image_from_scratch(std::string name,
        char separator = '^';
 
        // Find last meta separator in name
-       s32 last_separator_position = -1;
-       for(s32 i=name.size()-1; i>=0; i--)
-       {
-               if(name[i] == separator)
-               {
-                       last_separator_position = i;
-                       break;
-               }
-       }
+       s32 last_separator_position = name.find_last_of(separator);
+       //if(last_separator_position == std::npos)
+       //      last_separator_position = -1;
 
        /*infostream<<"generate_image_from_scratch(): "
                        <<"last_separator_position="<<last_separator_position