--- deliantra/server/include/util.h 2009/05/05 04:51:56 1.88
+++ deliantra/server/include/util.h 2009/10/20 05:57:08 1.92
@@ -3,18 +3,19 @@
*
* Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
*
- * Deliantra is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Deliantra is free software: you can redistribute it and/or modify it under
+ * the terms of the Affero GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * You should have received a copy of the Affero GNU General Public License
+ * and the GNU General Public License along with this program. If not, see
+ * .
*
* The authors can be reached via e-mail to
*/
@@ -215,6 +216,20 @@
return (int)sqrtf ((float)n);
}
+// this is kind of like the ^^ operator, if it would exist, without sequence point.
+// more handy than it looks like, due to the implicit !! done on its arguments
+inline bool
+logical_xor (bool a, bool b)
+{
+ return a != b;
+}
+
+inline bool
+logical_implies (bool a, bool b)
+{
+ return a <= b;
+}
+
// this is only twice as fast as naive sqrtf (dx*dy+dy*dy)
#if 0
// and has a max. error of 6 in the range -100..+100.
@@ -707,8 +722,12 @@
int similar_direction (int a, int b);
-// like sprintf, but returns a "static" buffer
-const char *format (const char *format, ...);
+// like v?sprintf, but returns a "static" buffer
+char *vformat (const char *format, va_list ap);
+char *format (const char *format, ...);
+
+// safety-check player input which will become object->msg
+bool msg_is_safe (const char *msg);
/////////////////////////////////////////////////////////////////////////////
// threads, very very thin wrappers around pthreads