diff --git a/src/auth.h b/src/auth.h index 5df4320..712418d 100644 --- a/src/auth.h +++ b/src/auth.h @@ -42,10 +42,8 @@ const uint64_t PRIV_BUILD = 1; // Can build - i.e. modify the world const uint64_t PRIV_TELEPORT = 2; // Can teleport const uint64_t PRIV_SETTIME = 4; // Can set the time const uint64_t PRIV_PRIVS = 8; // Can grant and revoke privileges -const uint64_t PRIV_SERVER = 16; // Can manage the server (e.g. shutodwn - // ,settings) -const uint64_t PRIV_SHOUT = 32; // Can broadcast chat messages to all - // players +const uint64_t PRIV_SERVER = 16; // Can manage the server (e.g. shutodwn, settings) +const uint64_t PRIV_SHOUT = 32; // Can broadcast chat messages to all players const uint64_t PRIV_BAN = 64; // Can ban players // Default privileges - these can be overriden for new players using the diff --git a/src/base64.cpp b/src/base64.cpp index 0a456bb..3e53ed6 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -1,41 +1,40 @@ /* - base64.cpp and base64.h + base64.cpp and base64.h - Copyright (C) 2004-2008 René Nyffenegger + Copyright (C) 2004-2008 René Nyffenegger - This source code is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. + This source code is provided 'as-is', without any express or implied + warranty. In no event will the author be held liable for any damages + arising from the use of this software. - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: - 1. The origin of this source code must not be misrepresented; you must not - claim that you wrote the original source code. If you use this source code - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. + 1. The origin of this source code must not be misrepresented; you must not + claim that you wrote the original source code. If you use this source code + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original source code. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original source code. - 3. This notice may not be removed or altered from any source distribution. - - René Nyffenegger rene.nyffenegger@adp-gmbh.ch + 3. This notice may not be removed or altered from any source distribution. + René Nyffenegger rene.nyffenegger@adp-gmbh.ch */ #include "base64.h" #include static const std::string base64_chars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; static inline bool is_base64(unsigned char c) { - return (isalnum(c) || (c == '+') || (c == '/')); + return (isalnum(c) || (c == '+') || (c == '/')); } bool base64_is_valid(std::string const& s) @@ -48,86 +47,81 @@ bool base64_is_valid(std::string const& s) } std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) { - std::string ret; - int i = 0; - int j = 0; - unsigned char char_array_3[3]; - unsigned char char_array_4[4]; + std::string ret; + int i = 0; + int j = 0; + unsigned char char_array_3[3]; + unsigned char char_array_4[4]; - while (in_len--) { - char_array_3[i++] = *(bytes_to_encode++); - if (i == 3) { - char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; - char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); - char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); - char_array_4[3] = char_array_3[2] & 0x3f; + while (in_len--) { + char_array_3[i++] = *(bytes_to_encode++); + if (i == 3) { + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; - for(i = 0; (i <4) ; i++) - ret += base64_chars[char_array_4[i]]; - i = 0; - } - } + for(i = 0; (i <4) ; i++) + ret += base64_chars[char_array_4[i]]; + i = 0; + } + } - if (i) - { - for(j = i; j < 3; j++) - char_array_3[j] = '\0'; + if (i) + { + for(j = i; j < 3; j++) + char_array_3[j] = '\0'; - char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; - char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); - char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); - char_array_4[3] = char_array_3[2] & 0x3f; + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; - for (j = 0; (j < i + 1); j++) - ret += base64_chars[char_array_4[j]]; - - // Don't pad it with = - /*while((i++ < 3)) - ret += '=';*/ - - } - - return ret; + for (j = 0; (j < i + 1); j++) + ret += base64_chars[char_array_4[j]]; + } + return ret; } std::string base64_decode(std::string const& encoded_string) { - int in_len = encoded_string.size(); - int i = 0; - int j = 0; - int in_ = 0; - unsigned char char_array_4[4], char_array_3[3]; - std::string ret; + int in_len = encoded_string.size(); + int i = 0; + int j = 0; + int in_ = 0; + unsigned char char_array_4[4], char_array_3[3]; + std::string ret; - while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) { - char_array_4[i++] = encoded_string[in_]; in_++; - if (i ==4) { - for (i = 0; i <4; i++) - char_array_4[i] = base64_chars.find(char_array_4[i]); + while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) { + char_array_4[i++] = encoded_string[in_]; in_++; + if (i ==4) { + for (i = 0; i <4; i++) + char_array_4[i] = base64_chars.find(char_array_4[i]); - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - for (i = 0; (i < 3); i++) - ret += char_array_3[i]; - i = 0; - } - } + for (i = 0; (i < 3); i++) + ret += char_array_3[i]; + i = 0; + } + } - if (i) { - for (j = i; j <4; j++) - char_array_4[j] = 0; + if (i) { + for (j = i; j <4; j++) + char_array_4[j] = 0; - for (j = 0; j <4; j++) - char_array_4[j] = base64_chars.find(char_array_4[j]); + for (j = 0; j <4; j++) + char_array_4[j] = base64_chars.find(char_array_4[j]); - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - for (j = 0; (j < i - 1); j++) ret += char_array_3[j]; - } + for (j = 0; (j < i - 1); j++) ret += char_array_3[j]; + } - return ret; + return ret; } + diff --git a/src/clientobject.h b/src/clientobject.h index 9c73d82..2a9baa1 100644 --- a/src/clientobject.h +++ b/src/clientobject.h @@ -31,15 +31,13 @@ #include "mapnode.h" /* - -Some planning -------------- - +* Some planning +* * Client receives a network packet with information of added objects - in it +* in it +* * Client supplies the information to its ClientEnvironment * The environment adds the specified objects to itself - */ class ClientEnvironment; diff --git a/src/clientserver.h b/src/clientserver.h index 794d557..95cfbe8 100644 --- a/src/clientserver.h +++ b/src/clientserver.h @@ -38,8 +38,7 @@ #define PROTOCOL_ID 0x4f457403 -#define PASSWORD_SIZE 28 // Maximum password length. Allows for - // base64-encoded SHA-1 (27+\0). +#define PASSWORD_SIZE 28 // Maximum password length. Allows for base64-encoded SHA-1 (27+\0). enum ToClientCommand { diff --git a/src/connection.h b/src/connection.h index 9dcba0e..e4423c1 100644 --- a/src/connection.h +++ b/src/connection.h @@ -238,31 +238,35 @@ checking at all. #define TYPE_ORIGINAL 1 #define ORIGINAL_HEADER_SIZE 1 /* -SPLIT: These are sequences of packets forming one bigger piece of -data. -- When processed and all the packet_nums 0...packet_count-1 are - present (this should be buffered), the resulting data shall be - directly handed to the user. -- If the data fails to come up in a reasonable time, the buffer shall - be silently discarded. -- These can be sent as-is or atop of a RELIABLE packet stream. - Header (7 bytes): - [0] u8 type - [1] u16 seqnum - [3] u16 chunk_count - [5] u16 chunk_num +* SPLIT: These are sequences of packets forming one bigger piece of +* data. +* +* When processed and all the packet_nums 0...packet_count-1 are +* present (this should be buffered), the resulting data shall be +* directly handed to the user. +* +* If the data fails to come up in a reasonable time, the buffer shall +* be silently discarded. +* +* These can be sent as-is or atop of a RELIABLE packet stream. +* Header (7 bytes): +* [0] u8 type +* [1] u16 seqnum +* [3] u16 chunk_count +* [5] u16 chunk_num */ #define TYPE_SPLIT 2 /* -RELIABLE: Delivery of all RELIABLE packets shall be forced by ACKs, -and they shall be delivered in the same order as sent. This is done -with a buffer in the receiving and transmitting end. -- When this is processed, the contents of each packet is recursively - processed as packets. - Header (3 bytes): - [0] u8 type - [1] u16 seqnum - +* RELIABLE: Delivery of all RELIABLE packets shall be forced by ACKs, +* and they shall be delivered in the same order as sent. This is done +* with a buffer in the receiving and transmitting end. +* +* When this is processed, the contents of each packet is recursively +* processed as packets. +* +* Header (3 bytes): +* [0] u8 type +* [1] u16 seqnum */ #define TYPE_RELIABLE 3 #define RELIABLE_HEADER_SIZE 3 diff --git a/src/content_mob.h b/src/content_mob.h index 1a1614f..30557e4 100644 --- a/src/content_mob.h +++ b/src/content_mob.h @@ -156,8 +156,8 @@ struct MobFeatures { /* Gets list of node boxes */ - std::vector getNodeBoxes() - { + std::vector getNodeBoxes() + { return nodeboxes; } diff --git a/src/filesys.cpp b/src/filesys.cpp index e8ae6ef..5dfeca2 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -184,14 +184,14 @@ std::vector GetDirListing(std::string pathstring) { std::vector listing; - DIR *dp; - struct dirent *dirp; - if((dp = opendir(pathstring.c_str())) == NULL) { + DIR *dp; + struct dirent *dirp; + if((dp = opendir(pathstring.c_str())) == NULL) { //std::cout<<"Error("< GetDirListing(std::string pathstring) if(node.name != "." && node.name != "..") listing.push_back(node); } - } - closedir(dp); + } + closedir(dp); return listing; } diff --git a/src/hex.h b/src/hex.h index cc4acc1..ed037e6 100644 --- a/src/hex.h +++ b/src/hex.h @@ -49,7 +49,7 @@ static inline std::string hex_encode(const char *data, unsigned int data_size) static inline std::string hex_encode(const std::string &data) { - return hex_encode(data.c_str(), data.size()); + return hex_encode(data.c_str(), data.size()); } static inline bool hex_digit_decode(char hexdigit, unsigned char &value) diff --git a/src/intlGUIEditBox.cpp b/src/intlGUIEditBox.cpp index 00858e6..aa1eed4 100644 --- a/src/intlGUIEditBox.cpp +++ b/src/intlGUIEditBox.cpp @@ -191,11 +191,11 @@ void intlGUIEditBox::setWordWrap(bool enable) void intlGUIEditBox::updateAbsolutePosition() { - core::rect oldAbsoluteRect(AbsoluteRect); + core::rect oldAbsoluteRect(AbsoluteRect); IGUIElement::updateAbsolutePosition(); if ( oldAbsoluteRect != AbsoluteRect ) { - breakText(); + breakText(); } } @@ -270,20 +270,20 @@ bool intlGUIEditBox::OnEvent(const SEvent& event) } break; case EET_KEY_INPUT_EVENT: - { + { #if (defined(linux) || defined(__linux) || defined(__FreeBSD__)) - // ################################################################ + // ################################################################ // ValkaTR: - // This part is the difference from the original intlGUIEditBox - // It converts UTF-8 character into a UCS-2 (wchar_t) - wchar_t wc = L'_'; - mbtowc( &wc, (char *) &event.KeyInput.Char, sizeof(event.KeyInput.Char) ); + // This part is the difference from the original intlGUIEditBox + // It converts UTF-8 character into a UCS-2 (wchar_t) + wchar_t wc = L'_'; + mbtowc( &wc, (char *) &event.KeyInput.Char, sizeof(event.KeyInput.Char) ); - //printf( "char: %lc (%u) \r\n", wc, wc ); + //printf( "char: %lc (%u) \r\n", wc, wc ); - SEvent irrevent(event); - irrevent.KeyInput.Char = wc; - // ################################################################ + SEvent irrevent(event); + irrevent.KeyInput.Char = wc; + // ################################################################ if (processKey(irrevent)) return true; @@ -293,7 +293,7 @@ bool intlGUIEditBox::OnEvent(const SEvent& event) #endif // defined(linux) break; - } + } case EET_MOUSE_INPUT_EVENT: if (processMouse(event)) return true; @@ -531,7 +531,7 @@ bool intlGUIEditBox::processKey(const SEvent& event) } else { - sendGuiEvent( EGET_EDITBOX_ENTER ); + sendGuiEvent( EGET_EDITBOX_ENTER ); } break; case KEY_LEFT: @@ -779,8 +779,8 @@ bool intlGUIEditBox::processKey(const SEvent& event) return true; } - // Set new text markers - setTextMarkers( newMarkBegin, newMarkEnd ); + // Set new text markers + setTextMarkers( newMarkBegin, newMarkEnd ); // break the text if it has changed if (textChanged) @@ -1062,7 +1062,7 @@ bool intlGUIEditBox::processMouse(const SEvent& event) CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y); if (MouseMarking) { - setTextMarkers( MarkBegin, CursorPos ); + setTextMarkers( MarkBegin, CursorPos ); } MouseMarking = false; calculateScrollPos(); @@ -1102,7 +1102,7 @@ bool intlGUIEditBox::processMouse(const SEvent& event) // move cursor CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y); - s32 newMarkBegin = MarkBegin; + s32 newMarkBegin = MarkBegin; if (!MouseMarking) newMarkBegin = CursorPos; @@ -1465,12 +1465,12 @@ void intlGUIEditBox::calculateScrollPos() //! set text markers void intlGUIEditBox::setTextMarkers(s32 begin, s32 end) { - if ( begin != MarkBegin || end != MarkEnd ) - { - MarkBegin = begin; - MarkEnd = end; - sendGuiEvent(EGET_EDITBOX_MARKING_CHANGED); - } + if ( begin != MarkBegin || end != MarkEnd ) + { + MarkBegin = begin; + MarkEnd = end; + sendGuiEvent(EGET_EDITBOX_MARKING_CHANGED); + } } //! send some gui event to parent @@ -1478,13 +1478,13 @@ void intlGUIEditBox::sendGuiEvent(EGUI_EVENT_TYPE type) { if ( Parent ) { - SEvent e; - e.EventType = EET_GUI_EVENT; - e.GUIEvent.Caller = this; - e.GUIEvent.Element = 0; - e.GUIEvent.EventType = type; + SEvent e; + e.EventType = EET_GUI_EVENT; + e.GUIEvent.Caller = this; + e.GUIEvent.Element = 0; + e.GUIEvent.EventType = type; - Parent->OnEvent(e); + Parent->OnEvent(e); } } diff --git a/src/inventory.cpp b/src/inventory.cpp index 67af765..0dc7861 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -974,30 +974,30 @@ std::string InventoryLocation::dump() const void InventoryLocation::serialize(std::ostream &os) const { - switch (type) { - case InventoryLocation::UNDEFINED: - { + switch (type) { + case InventoryLocation::UNDEFINED: + { os<<"undefined"; } - break; - case InventoryLocation::CURRENT_PLAYER: - { + break; + case InventoryLocation::CURRENT_PLAYER: + { os<<"current_player"; } - break; - case InventoryLocation::PLAYER: - { + break; + case InventoryLocation::PLAYER: + { os<<"player:"< /* A key press, consisting of either an Irrlicht keycode - or an actual char */ +or an actual char */ class KeyPress { diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 651103c..459925e 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -87,7 +87,7 @@ std::vector transformNodeBox(MapNode &n, std::vector ContentFeatures::getNodeBoxes(MapNode &n) const { - return transformNodeBox(n, nodeboxes); + return transformNodeBox(n, nodeboxes); } std::vector ContentFeatures::getWieldNodeBoxes() const diff --git a/src/mapnode.h b/src/mapnode.h index fc82b04..9fb272c 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -514,7 +514,7 @@ struct ContentFeatures /* Gets list of node boxes (used for collision) */ - std::vector getNodeBoxes(MapNode &n) const; + std::vector getNodeBoxes(MapNode &n) const; void setNodeBox(NodeBox nb) { @@ -527,7 +527,7 @@ struct ContentFeatures nodeboxes.push_back(nb); } - std::vector getWieldNodeBoxes() const; + std::vector getWieldNodeBoxes() const; void setWieldNodeBox(NodeBox nb) { @@ -761,7 +761,7 @@ enum LightBank /* Masks for MapNode.param2 of flowing liquids - */ +*/ #define LIQUID_LEVEL_MASK 0x07 #define LIQUID_FLOW_DOWN_MASK 0x08 diff --git a/src/noise.cpp b/src/noise.cpp index c81c693..70b8103 100644 --- a/src/noise.cpp +++ b/src/noise.cpp @@ -39,21 +39,21 @@ double cos_lookup[16] = { }; inline double dotProduct(double vx, double vy, double wx, double wy){ - return vx*wx+vy*wy; + return vx*wx+vy*wy; } inline double linearInterpolation(double x0, double x1, double t){ - return x0+(x1-x0)*t; + return x0+(x1-x0)*t; } double biLinearInterpolation(double x0y0, double x1y0, double x0y1, double x1y1, double x, double y){ - double tx = easeCurve(x); - double ty = easeCurve(y); + double tx = easeCurve(x); + double ty = easeCurve(y); /*double tx = x; double ty = y;*/ - double u = linearInterpolation(x0y0,x1y0,tx); - double v = linearInterpolation(x0y1,x1y1,tx); - return linearInterpolation(u,v,ty); + double u = linearInterpolation(x0y0,x1y0,tx); + double v = linearInterpolation(x0y1,x1y1,tx); + return linearInterpolation(u,v,ty); } double triLinearInterpolation( @@ -61,12 +61,12 @@ double triLinearInterpolation( double v001, double v101, double v011, double v111, double x, double y, double z) { - /*double tx = easeCurve(x); - double ty = easeCurve(y); - double tz = easeCurve(z);*/ - double tx = x; - double ty = y; - double tz = z; + /*double tx = easeCurve(x); + double ty = easeCurve(y); + double tz = easeCurve(z);*/ + double tx = x; + double ty = y; + double tz = z; return( v000*(1-tx)*(1-ty)*(1-tz) + v100*tx*(1-ty)*(1-tz) + diff --git a/src/player.cpp b/src/player.cpp index 887d184..629ee6f 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -679,7 +679,7 @@ LocalPlayer::~LocalPlayer() } void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d, - core::list *collision_info) + core::list *collision_info) { v3f position = getPosition(); v3f oldpos = position; diff --git a/src/porting.cpp b/src/porting.cpp index 2f1d960..f82265d 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -271,23 +271,23 @@ void initializePaths() #elif defined(__APPLE__) #include - // Code based on - // http://stackoverflow.com/questions/516200/relative-paths-not-working-in-xcode-c - CFBundleRef main_bundle = CFBundleGetMainBundle(); - CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL(main_bundle); - char path[PATH_MAX]; - if(CFURLGetFileSystemRepresentation(resources_url, TRUE, (UInt8 *)path, PATH_MAX)) + // Code based on + // http://stackoverflow.com/questions/516200/relative-paths-not-working-in-xcode-c + CFBundleRef main_bundle = CFBundleGetMainBundle(); + CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL(main_bundle); + char path[PATH_MAX]; + if(CFURLGetFileSystemRepresentation(resources_url, TRUE, (UInt8 *)path, PATH_MAX)) { dstream<<"Bundle resource path: "<=tek.size()"<=tek.size()"<=tek.size()) return true; - return false; - } - WStrfnd(std::wstring s){ - start(s); - } + return palautus; + } + bool atend(){ + if(p>=tek.size()) return true; + return false; + } + WStrfnd(std::wstring s){ + start(s); + } }; inline std::string trim(const std::string &s) { std::string str = s; - while( - str.length()>0 - && - ( - str.substr(0, 1)==" " || - str.substr(0, 1)=="\t" || - str.substr(0, 1)=="\r" || - str.substr(0, 1)=="\n" || - str.substr(str.length()-1, 1)==" " || - str.substr(str.length()-1, 1)=="\t" || - str.substr(str.length()-1, 1)=="\r" || - str.substr(str.length()-1, 1)=="\n" - ) - ) - { - if (str.substr(0, 1)==" ") + while( + str.length()>0 + && + ( + str.substr(0, 1)==" " || + str.substr(0, 1)=="\t" || + str.substr(0, 1)=="\r" || + str.substr(0, 1)=="\n" || + str.substr(str.length()-1, 1)==" " || + str.substr(str.length()-1, 1)=="\t" || + str.substr(str.length()-1, 1)=="\r" || + str.substr(str.length()-1, 1)=="\n" + ) + ) + { + if (str.substr(0, 1)==" ") str = str.substr(1,str.length()-1); - else if (str.substr(0, 1)=="\t") + else if (str.substr(0, 1)=="\t") str = str.substr(1,str.length()-1); - else if (str.substr(0, 1)=="\r") + else if (str.substr(0, 1)=="\r") str = str.substr(1,str.length()-1); - else if (str.substr(0, 1)=="\n") + else if (str.substr(0, 1)=="\n") str = str.substr(1,str.length()-1); - else if (str.substr(str.length()-1, 1)==" ") + else if (str.substr(str.length()-1, 1)==" ") str = str.substr(0,str.length()-1); - else if (str.substr(str.length()-1, 1)=="\t") + else if (str.substr(str.length()-1, 1)=="\t") str = str.substr(0,str.length()-1); - else if (str.substr(str.length()-1, 1)=="\r") + else if (str.substr(str.length()-1, 1)=="\r") str = str.substr(0,str.length()-1); - else if (str.substr(str.length()-1, 1)=="\n") + else if (str.substr(str.length()-1, 1)=="\n") str = str.substr(0,str.length()-1); - } - return str; + } + return str; } #endif diff --git a/src/tile.cpp b/src/tile.cpp index 57f34be..f77b230 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -241,7 +241,7 @@ u32 TextureSource::getTextureIdDirect(const std::string &name) base_image_name = name.substr(0, last_separator_position); /*infostream<<"getTextureIdDirect(): Calling itself recursively" " to get base image of \""<