]> git.mxchange.org Git - quix0rs-blobwars.git/blob - src/CMath.h
Add doc/samples which more accurately tracks samples origin
[quix0rs-blobwars.git] / src / CMath.h
1 /*
2 Copyright (C) 2004-2010 Parallel Realities
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20
21 class Math {
22
23         private:
24
25                 Math(){}
26
27         public:
28         
29                 static long pSeed;
30
31         static void limitChar(signed char *in, int low, int high);
32         static void limitChar(unsigned char *in, int low, int high);
33         static void limitInt(int *in, int low, int high);
34         static void limitFloat(float *in, float low, float high);
35         static void wrapChar(signed char *in, signed char low, signed char high);
36         static void wrapInt(int *in, int low, int high);
37         static void wrapFloat(float *in, float low, float high);
38         static long prand();
39         static long rrand(int min, int max);
40         static bool boolFromWord(const char *word);
41         static void addBit(long *currentBits, long newBits);
42         static void removeBit(long *currentBits, long oldBits);
43         static void calculateSlope(float x, float y, float x2, float y2, float *dx, float *dy);
44         static char *formatTime(int seconds);
45 };