mirror of
https://github.com/glest/glest-source.git
synced 2025-08-30 19:29:47 +02:00
- finally fixing issue #102 (bad cell visible handling when fog of war turned off)
This commit is contained in:
@@ -260,7 +260,6 @@ public:
|
||||
|
||||
inline float dist(const Vec2<T> &v) const{
|
||||
float distance = Vec2<T>(v-*this).length();
|
||||
distance = truncateDecimal<float>(distance,6);
|
||||
return distance;
|
||||
}
|
||||
|
||||
@@ -270,8 +269,12 @@ public:
|
||||
}
|
||||
|
||||
inline float length() const {
|
||||
#ifdef USE_STREFLOP
|
||||
float len = static_cast<float>(streflop::sqrt(static_cast<streflop::Simple>(x*x + y*y)));
|
||||
#else
|
||||
float len = static_cast<float>(std::sqrt(static_cast<float>(x*x + y*y)));
|
||||
len = truncateDecimal<float>(len,6);
|
||||
#endif
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -494,13 +497,16 @@ public:
|
||||
|
||||
inline float dist(const Vec3<T> &v) const {
|
||||
float distance = Vec3<T>(v-*this).length();
|
||||
distance = truncateDecimal<float>(distance,6);
|
||||
return distance;
|
||||
}
|
||||
|
||||
inline float length() const {
|
||||
#ifdef USE_STREFLOP
|
||||
float len = static_cast<float>(streflop::sqrt(static_cast<streflop::Simple>(x*x + y*y + z*z)));
|
||||
#else
|
||||
float len = static_cast<float>(std::sqrt(x*x + y*y + z*z));
|
||||
len = truncateDecimal<float>(len,6);
|
||||
#endif
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@@ -79,6 +79,7 @@ private:
|
||||
static Mutex mutexthreadList;
|
||||
static vector<Thread *> threadList;
|
||||
static bool enableVerboseMode;
|
||||
static unsigned long mainThreadId;
|
||||
|
||||
protected:
|
||||
void addThreadToList();
|
||||
@@ -90,6 +91,11 @@ public:
|
||||
Thread();
|
||||
virtual ~Thread();
|
||||
|
||||
static unsigned long getCurrentThreadId();
|
||||
static unsigned long getMainThreadId() { return mainThreadId; }
|
||||
static void setMainThreadId();
|
||||
static bool isCurrentThreadMainThread();
|
||||
|
||||
static void setEnableVerboseMode(bool value) { enableVerboseMode = value; }
|
||||
static bool getEnableVerboseMode() { return enableVerboseMode; }
|
||||
|
||||
|
@@ -74,6 +74,7 @@ public:
|
||||
debugNetwork,
|
||||
debugPerformance,
|
||||
debugWorldSynch,
|
||||
debugWorldSynchMax,
|
||||
debugUnitCommands,
|
||||
debugPathFinder,
|
||||
debugLUA,
|
||||
|
@@ -686,7 +686,7 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
|
||||
for(int ipIdx = 0; myhostent->h_addr_list[ipIdx] != NULL; ++ipIdx) {
|
||||
Ip::Inet_NtoA(SockAddrToUint32((struct in_addr *)myhostent->h_addr_list[ipIdx]), myhostaddr);
|
||||
|
||||
printf("ipIdx = %d [%s]\n",ipIdx,myhostaddr);
|
||||
//printf("ipIdx = %d [%s]\n",ipIdx,myhostaddr);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] myhostaddr = [%s]\n",__FILE__,__FUNCTION__,__LINE__,myhostaddr);
|
||||
|
||||
if(strlen(myhostaddr) > 0 &&
|
||||
|
@@ -26,6 +26,7 @@ namespace Shared { namespace Platform {
|
||||
bool Thread::enableVerboseMode = false;
|
||||
Mutex Thread::mutexthreadList;
|
||||
vector<Thread *> Thread::threadList;
|
||||
unsigned long Thread::mainThreadId = -1;
|
||||
|
||||
auto_ptr<Mutex> Mutex::mutexMutexList(new Mutex(CODE_AT_LINE));
|
||||
vector<Mutex *> Mutex::mutexList;
|
||||
@@ -138,6 +139,16 @@ Thread::Thread() : thread(NULL),
|
||||
addThreadToList();
|
||||
}
|
||||
|
||||
unsigned long Thread::getCurrentThreadId() {
|
||||
return SDL_ThreadID();
|
||||
}
|
||||
void Thread::setMainThreadId() {
|
||||
mainThreadId = getCurrentThreadId();
|
||||
}
|
||||
bool Thread::isCurrentThreadMainThread() {
|
||||
return getCurrentThreadId() == mainThreadId;
|
||||
}
|
||||
|
||||
void Thread::addThreadToList() {
|
||||
MutexSafeWrapper safeMutex(&Thread::mutexthreadList);
|
||||
Thread::threadList.push_back(this);
|
||||
|
@@ -31,7 +31,7 @@ const int RandomGen::m= 714025;
|
||||
const int RandomGen::a= 1366;
|
||||
const int RandomGen::b= 150889;
|
||||
|
||||
RandomGen::RandomGen(){
|
||||
RandomGen::RandomGen() {
|
||||
lastNumber= 0;
|
||||
disableLastCallerTracking = false;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ int RandomGen::randRange(int min, int max,string lastCaller) {
|
||||
}
|
||||
|
||||
int diff= max-min;
|
||||
float numerator = static_cast<float>(diff + 1) * static_cast<float>(RandomGen::rand(lastCaller));
|
||||
float numerator = static_cast<float>(diff + 1) * static_cast<float>(this->rand(lastCaller));
|
||||
int res= min + static_cast<int>(truncateDecimal<float>(numerator / static_cast<float>(m),6));
|
||||
if(res < min || res > max) {
|
||||
char szBuf[8096]="";
|
||||
@@ -94,7 +94,7 @@ float RandomGen::randRange(float min, float max,string lastCaller) {
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
float rand01 = static_cast<float>(RandomGen::rand(lastCaller)) / (m-1);
|
||||
float rand01 = static_cast<float>(this->rand(lastCaller)) / (m-1);
|
||||
float res= min + (max - min) * rand01;
|
||||
res = truncateDecimal<float>(res,6);
|
||||
|
||||
|
Reference in New Issue
Block a user