1 #ifndef _CMD_COLLIDE_H_
2 #define _CMD_COLLIDE_H_
4 #define SAFE_COLLIDE_DEBUG
14 #define COLLIDETABLESIZE sizeof (CTSIZ)
15 #define COLLIDETABLEACCURACY sizeof (CTACCURACY)
16 #define HUGEOBJECT sizeof (CTHUGE)
25 template <
class CTSIZ,
class CTACCURACY,
class CTHUGE >
34 std::set< Unit* >act_huge;
35 std::set< Unit* >acc_huge;
43 static void hash_vec(
double i,
double j,
double k,
int &
x,
int &
y,
int &
z )
50 static void hash_vec(
const QVector &t,
int &x,
int &y,
int &z )
52 hash_vec( t.i, t.j, t.k, x, y, z );
56 activeStarSystem = ss;
62 if (active_huge == &ha) {
70 act_huge.swap( acc_huge );
75 if ( acc_huge.find( un ) == acc_huge.end() ) {
76 acc_huge.insert( un );
78 if ( act_huge.find( un ) == act_huge.end() ) {
79 act_huge.insert( un );
88 return ( (
int) ( ( (aye < 0) ? (aye
95 if ( !hugeobjects.
empty() )
97 if ( this->active_huge.
size() )
99 if ( this->accum_huge.
size() )
106 if ( !table[i][j][k].empty() )
107 table[i][j][k].
clear();
113 retval[0] = active_huge;
115 retval[0] = &hugeobjects;
126 unsigned int sizer = 1;
134 retval[0] = &hugeobjects;
136 retval[0] = active_huge;
145 if ( !table[x][y][z].empty() ) {
146 retval[sizer] = &table[
x][
y][z];
168 if (target->
Mini.i == maxx)
178 *( (double) COLLIDETABLEACCURACY )
180 target->
hhuge =
true;
181 hugeobjects.
prepend( objectToPut );
184 target->
hhuge =
false;
186 for (
double i = target->
Mini.i; i < maxx; i += COLLIDETABLEACCURACY) {
188 for (
double j = target->
Mini.j; j < maxy; j += COLLIDETABLEACCURACY) {
190 for (
double k = target->
Mini.k; k < maxz; k += COLLIDETABLEACCURACY) {
202 while ( (un = *removal) ) {
203 if (un == objectToKill) {
243 if (!ret && !target->
hhuge)
244 fprintf( stderr,
"Nonfatal Collide Error\n" );
245 if (!ret || target->
hhuge)
256 unsigned int blocupdate;