diff --git a/src/build/util.c b/src/build/util.c index 5a37a6463..8882b9dbc 100644 --- a/src/build/util.c +++ b/src/build/util.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/src/kernel/battle.c b/src/kernel/battle.c index b445b4518..1f6910213 100644 --- a/src/kernel/battle.c +++ b/src/kernel/battle.c @@ -56,7 +56,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/kernel/battle.h b/src/kernel/battle.h index e6b263d0f..77a3917f2 100644 --- a/src/kernel/battle.h +++ b/src/kernel/battle.h @@ -22,8 +22,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. extern "C" { #endif -#include - #define SHOW_KILLS #undef SMALL_BATTLE_MESSAGES diff --git a/src/util.vcxproj b/src/util.vcxproj index d21e79368..db7f763dc 100644 --- a/src/util.vcxproj +++ b/src/util.vcxproj @@ -92,7 +92,6 @@ - @@ -127,7 +126,6 @@ - diff --git a/src/util.vcxproj.filters b/src/util.vcxproj.filters index 1530a0454..685e18404 100644 --- a/src/util.vcxproj.filters +++ b/src/util.vcxproj.filters @@ -26,9 +26,6 @@ Header Files - - Header Files - Header Files @@ -127,9 +124,6 @@ Source Files - - Source Files - Source Files diff --git a/src/util/cvector.c b/src/util/cvector.c deleted file mode 100644 index 27c395908..000000000 --- a/src/util/cvector.c +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright (c) 1998-2010, Enno Rehling - Katja Zedel - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -**/ - -#include -#include "cvector.h" -#include "rng.h" - -#include -#include -#include -#include - -void -cv_init(cvector * cv) -{ - cv->begin = 0; - cv->end = 0; - cv->space = 0; -} - -cvector * -cv_kill(cvector * cv) -{ - if (cv->begin) free(cv->begin); - cv_init(cv); - return cv; -} - -size_t -cv_size(cvector * cv) -{ - return cv->end - cv->begin; -} - -void -cv_reserve(cvector * cv, size_t size) -{ - size_t count = cv->end - cv->begin; - cv->begin = realloc(cv->begin, size * sizeof(void *)); - - cv->space = size; - cv->end = cv->begin + count; -} - -void -cv_pushback(cvector * cv, void *u) -{ - if (cv->space == cv_size(cv)) - cv_reserve(cv, cv->space ? cv->space * 2 : 2); - *(cv->end++) = u; -} - -int -__cv_scramblecmp(const void *p1, const void *p2) -{ - return *((long *) p1) - *((long *) p2); -} - -#define addptr(p,i) ((void *)(((char *)p) + i)) - -/** randomly shuffle an array - * for correctness, see Donald E. Knuth, The Art of Computer Programming - */ -static void -__cv_scramble(void *v1, size_t n, size_t width) -{ - size_t i; - void * temp = malloc(width); - for (i=0;i!=n;++i) { - size_t j = i + (rng_int() % (n-i)); - memcpy(temp, addptr(v1, i*width), width); - memcpy(addptr(v1, i*width), addptr(v1, j*width), width); - memcpy(addptr(v1, j*width), temp, width); - } - free(temp); -} - -void -v_scramble(void **begin, void **end) -{ - __cv_scramble(begin, end - begin, sizeof(void *)); -} diff --git a/src/util/cvector.h b/src/util/cvector.h deleted file mode 100644 index c0e50944d..000000000 --- a/src/util/cvector.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright (c) 1998-2010, Enno Rehling - Katja Zedel - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -**/ - -#ifndef CVECTOR_H -#define CVECTOR_H -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef WIN32 -#ifndef __cdecl -#define __cdecl -#endif -#endif - -#include -typedef struct cvector cvector; - -struct cvector { - void **begin; - void **end; - size_t space; -}; - -typedef int (__cdecl * v_sort_fun) (const void *, const void *); - -void cv_init(cvector * cv); -cvector *cv_kill(cvector * cv); -size_t cv_size(cvector * cv); -void cv_reserve(cvector * cv, size_t size); -void cv_pushback(cvector * cv, void *u); -void v_scramble(void **begin, void **end); - -#define cv_remove(c, i) { void** x = v_find((c)->begin, (c)->end, (i)); if (x) { *x = *(c)->end; (c)->end--; } } -#define cv_foreach(item, vector) \ -{ \ - void **iterator; \ - for (iterator = (vector).begin; iterator<(vector).end; ++iterator) \ - { \ - (item) = *iterator; -#define cv_next(item) } } - -#ifdef __cplusplus -} -#endif -#endif