summaryrefslogtreecommitdiff
path: root/src/utility.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-02-12 20:15:57 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-02-12 20:15:57 +0200
commit3bb040043c0241f911aacc234bab16737b2e8f19 (patch)
tree7e8b7e14648981036fa4e3a7d32e2e8419db2f26 /src/utility.h
parente9fe2303817c9d4d7efd84054733f146ee84b8ab (diff)
downloadminetest-3bb040043c0241f911aacc234bab16737b2e8f19.tar.gz
minetest-3bb040043c0241f911aacc234bab16737b2e8f19.tar.bz2
minetest-3bb040043c0241f911aacc234bab16737b2e8f19.zip
hopefully a fix for the majority of the windows 7 problems - thanks to zerochen
Diffstat (limited to 'src/utility.h')
-rw-r--r--src/utility.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/utility.h b/src/utility.h
index b3816c8a7..46277cd42 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -1687,6 +1687,22 @@ inline bool string_allowed(const std::string &s, const std::string &allowed_char
}
/*
+ Forcefully wraps string into rows using \n
+ (no word wrap, used for showing paths in gui)
+*/
+inline std::string wrap_rows(const std::string &from, u32 rowlen)
+{
+ std::string to;
+ for(u32 i=0; i<from.size(); i++)
+ {
+ if(i != 0 && i%rowlen == 0)
+ to += '\n';
+ to += from[i];
+ }
+ return to;
+}
+
+/*
Some helper stuff
*/
#define MYMIN(a,b) ((a)<(b)?(a):(b))