mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 07:31:21 +02:00
- Cleanup of logging code to properly manage multiple logs etc
- Cleaned up a bunch of compiler warnings (conversion from int to float and vice versa)
This commit is contained in:
@@ -547,8 +547,8 @@ void Renderer::renderMouse2d(int x, int y, int anim, float fade){
|
|||||||
|
|
||||||
anim= anim*2-maxMouse2dAnim;
|
anim= anim*2-maxMouse2dAnim;
|
||||||
|
|
||||||
color2= (abs(anim*fadeFactor)/static_cast<float>(maxMouse2dAnim))/2.f+0.4f;
|
color2= (abs(anim * (int)fadeFactor) / static_cast<float>(maxMouse2dAnim)) / 2.f + 0.4f;
|
||||||
color1= (abs(anim*fadeFactor)/static_cast<float>(maxMouse2dAnim))/2.f+0.8f;
|
color1= (abs(anim * (int)fadeFactor) / static_cast<float>(maxMouse2dAnim)) / 2.f + 0.8f;
|
||||||
|
|
||||||
glPushAttrib(GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_LINE_BIT);
|
glPushAttrib(GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_LINE_BIT);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
@@ -618,7 +618,7 @@ void Renderer::renderMouse3d() {
|
|||||||
throw runtime_error(szBuf);
|
throw runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3f pos3f= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
|
Vec3f pos3f= Vec3f((float)pos.x, map->getCell(pos)->getHeight(), (float)pos.y);
|
||||||
|
|
||||||
if(gui->isPlacingBuilding()){
|
if(gui->isPlacingBuilding()){
|
||||||
|
|
||||||
@@ -921,7 +921,7 @@ void Renderer::renderTextShadow(const string &text, const Font2D *font,const Vec
|
|||||||
textRenderer->begin(font);
|
textRenderer->begin(font);
|
||||||
glColor3f(0.0f, 0.0f, 0.0f);
|
glColor3f(0.0f, 0.0f, 0.0f);
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
textRenderer->render(text, pos.x-1.0f, pos.y-1.0f);
|
textRenderer->render(text, pos.x - 1, pos.y - 1);
|
||||||
}
|
}
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
glColor3f(color.x,color.y,color.z);
|
glColor3f(color.x,color.y,color.z);
|
||||||
@@ -984,16 +984,16 @@ void Renderer::renderButton(const GraphicButton *button){
|
|||||||
|
|
||||||
glBegin(GL_TRIANGLE_STRIP);
|
glBegin(GL_TRIANGLE_STRIP);
|
||||||
glTexCoord2f(0.f, 0.f);
|
glTexCoord2f(0.f, 0.f);
|
||||||
glVertex2f(x, y);
|
glVertex2f((float)x, (float)y);
|
||||||
|
|
||||||
glTexCoord2f(0.f, 1.f);
|
glTexCoord2f(0.f, 1.f);
|
||||||
glVertex2f(x, y+h);
|
glVertex2f((float)x, (float)(y+h));
|
||||||
|
|
||||||
glTexCoord2f(1.f, 0.f);
|
glTexCoord2f(1.f, 0.f);
|
||||||
glVertex2f(x+w, y);
|
glVertex2f((float)(x+w), (float)y);
|
||||||
|
|
||||||
glTexCoord2f(1.f, 1.f);
|
glTexCoord2f(1.f, 1.f);
|
||||||
glVertex2f(x+w, y+h);
|
glVertex2f((float)(x+w), (float)(y+h));
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
@@ -1011,25 +1011,25 @@ void Renderer::renderButton(const GraphicButton *button){
|
|||||||
glBegin(GL_TRIANGLE_FAN);
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
|
|
||||||
glColor4fv(color2.ptr());
|
glColor4fv(color2.ptr());
|
||||||
glVertex2f(x+w/2, y+h/2);
|
glVertex2f((float)(x+w/2), (float)(y+h/2));
|
||||||
|
|
||||||
glColor4fv(color1.ptr());
|
glColor4fv(color1.ptr());
|
||||||
glVertex2f(x-lightSize, y-lightSize);
|
glVertex2f((float)(x-lightSize), (float)(y-lightSize));
|
||||||
|
|
||||||
glColor4fv(color1.ptr());
|
glColor4fv(color1.ptr());
|
||||||
glVertex2f(x+w+lightSize, y-lightSize);
|
glVertex2f((float)(x+w+lightSize), (float)(y-lightSize));
|
||||||
|
|
||||||
glColor4fv(color1.ptr());
|
glColor4fv(color1.ptr());
|
||||||
glVertex2f(x+w+lightSize, y+h+lightSize);
|
glVertex2f((float)(x+w+lightSize), (float)(y+h+lightSize));
|
||||||
|
|
||||||
glColor4fv(color1.ptr());
|
glColor4fv(color1.ptr());
|
||||||
glVertex2f(x+w+lightSize, y+h+lightSize);
|
glVertex2f((float)(x+w+lightSize), (float)(y+h+lightSize));
|
||||||
|
|
||||||
glColor4fv(color1.ptr());
|
glColor4fv(color1.ptr());
|
||||||
glVertex2f(x-lightSize, y+h+lightSize);
|
glVertex2f((float)(x-lightSize), (float)(y+h+lightSize));
|
||||||
|
|
||||||
glColor4fv(color1.ptr());
|
glColor4fv(color1.ptr());
|
||||||
glVertex2f(x-lightSize, y-lightSize);
|
glVertex2f((float)(x-lightSize), (float)(y-lightSize));
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
@@ -1377,7 +1377,7 @@ void Renderer::renderWater(){
|
|||||||
GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
||||||
computeWaterColor(waterLevel, tc1->getHeight()).ptr());
|
computeWaterColor(waterLevel, tc1->getHeight()).ptr());
|
||||||
glMultiTexCoord2fv(GL_TEXTURE1, tc1->getFowTexCoord().ptr());
|
glMultiTexCoord2fv(GL_TEXTURE1, tc1->getFowTexCoord().ptr());
|
||||||
glTexCoord3f(i, 1.f, waterAnim);
|
glTexCoord3f((float)i, 1.f, waterAnim);
|
||||||
glVertex3f(
|
glVertex3f(
|
||||||
static_cast<float>(i)*Map::mapScale,
|
static_cast<float>(i)*Map::mapScale,
|
||||||
waterLevel,
|
waterLevel,
|
||||||
@@ -1388,7 +1388,7 @@ void Renderer::renderWater(){
|
|||||||
GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
||||||
computeWaterColor(waterLevel, tc0->getHeight()).ptr());
|
computeWaterColor(waterLevel, tc0->getHeight()).ptr());
|
||||||
glMultiTexCoord2fv(GL_TEXTURE1, tc0->getFowTexCoord().ptr());
|
glMultiTexCoord2fv(GL_TEXTURE1, tc0->getFowTexCoord().ptr());
|
||||||
glTexCoord3f(i, 0.f, waterAnim);
|
glTexCoord3f((float)i, 0.f, waterAnim);
|
||||||
glVertex3f(
|
glVertex3f(
|
||||||
static_cast<float>(i)*Map::mapScale,
|
static_cast<float>(i)*Map::mapScale,
|
||||||
waterLevel,
|
waterLevel,
|
||||||
@@ -1405,7 +1405,7 @@ void Renderer::renderWater(){
|
|||||||
GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
||||||
computeWaterColor(waterLevel, tc1->getHeight()).ptr());
|
computeWaterColor(waterLevel, tc1->getHeight()).ptr());
|
||||||
glMultiTexCoord2fv(GL_TEXTURE1, tc1->getFowTexCoord().ptr());
|
glMultiTexCoord2fv(GL_TEXTURE1, tc1->getFowTexCoord().ptr());
|
||||||
glTexCoord3f(i, 1.f, waterAnim);
|
glTexCoord3f((float)i, 1.f, waterAnim);
|
||||||
glVertex3f(
|
glVertex3f(
|
||||||
static_cast<float>(i)*Map::mapScale,
|
static_cast<float>(i)*Map::mapScale,
|
||||||
waterLevel,
|
waterLevel,
|
||||||
@@ -1416,7 +1416,7 @@ void Renderer::renderWater(){
|
|||||||
GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
||||||
computeWaterColor(waterLevel, tc0->getHeight()).ptr());
|
computeWaterColor(waterLevel, tc0->getHeight()).ptr());
|
||||||
glMultiTexCoord2fv(GL_TEXTURE1, tc0->getFowTexCoord().ptr());
|
glMultiTexCoord2fv(GL_TEXTURE1, tc0->getFowTexCoord().ptr());
|
||||||
glTexCoord3f(i, 0.f, waterAnim);
|
glTexCoord3f((float)i, 0.f, waterAnim);
|
||||||
glVertex3f(
|
glVertex3f(
|
||||||
static_cast<float>(i)*Map::mapScale,
|
static_cast<float>(i)*Map::mapScale,
|
||||||
waterLevel,
|
waterLevel,
|
||||||
@@ -1588,7 +1588,7 @@ void Renderer::renderSelectionEffects(){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Vec2i pos= c->getPos();
|
Vec2i pos= c->getPos();
|
||||||
arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
|
arrowTarget= Vec3f((float)pos.x, map->getCell(pos)->getHeight(), (float)pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderArrow(unit->getCurrVectorFlat(), arrowTarget, arrowColor, 0.3f);
|
renderArrow(unit->getCurrVectorFlat(), arrowTarget, arrowColor, 0.3f);
|
||||||
@@ -1598,7 +1598,7 @@ void Renderer::renderSelectionEffects(){
|
|||||||
//meeting point arrow
|
//meeting point arrow
|
||||||
if(unit->getType()->getMeetingPoint()){
|
if(unit->getType()->getMeetingPoint()){
|
||||||
Vec2i pos= unit->getMeetingPos();
|
Vec2i pos= unit->getMeetingPos();
|
||||||
Vec3f arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
|
Vec3f arrowTarget= Vec3f((float)pos.x, map->getCell(pos)->getHeight(), (float)pos.y);
|
||||||
renderArrow(unit->getCurrVectorFlat(), arrowTarget, Vec3f(0.f, 0.f, 1.f), 0.3f);
|
renderArrow(unit->getCurrVectorFlat(), arrowTarget, Vec3f(0.f, 0.f, 1.f), 0.3f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1964,9 +1964,9 @@ void Renderer::renderMenuBackground(const MenuBackground *menuBackground){
|
|||||||
glBegin(GL_TRIANGLE_STRIP);
|
glBegin(GL_TRIANGLE_STRIP);
|
||||||
for(int j=1; j<waterTesselation; ++j){
|
for(int j=1; j<waterTesselation; ++j){
|
||||||
glTexCoord2i(1, 2 % j);
|
glTexCoord2i(1, 2 % j);
|
||||||
glVertex3f(-waterSize+i*waterQuadSize, waterHeight, -waterSize+j*waterQuadSize);
|
glVertex3f((float)(-waterSize+i * waterQuadSize), waterHeight, (float)(-waterSize + j * waterQuadSize));
|
||||||
glTexCoord2i(0, 2 % j);
|
glTexCoord2i(0, 2 % j);
|
||||||
glVertex3f(-waterSize+(i+1)*waterQuadSize, waterHeight, -waterSize+j*waterQuadSize);
|
glVertex3f((float)(-waterSize + (i+1) * waterQuadSize), waterHeight, (float)(-waterSize + j * waterQuadSize));
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
@@ -2166,7 +2166,7 @@ void Renderer::renderShadowsToTexture(){
|
|||||||
glRotatef(90, 0, 1, 0);
|
glRotatef(90, 0, 1, 0);
|
||||||
Vec3f pos= game->getGameCamera()->getPos();
|
Vec3f pos= game->getGameCamera()->getPos();
|
||||||
|
|
||||||
glTranslatef(static_cast<int>(-pos.x), 0, static_cast<int>(-pos.z));
|
glTranslatef(static_cast<float>(-pos.x), 0.0f, static_cast<float>(-pos.z));
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@@ -413,7 +413,7 @@ void Unit::setPos(const Vec2i &pos){
|
|||||||
void Unit::setTargetPos(const Vec2i &targetPos){
|
void Unit::setTargetPos(const Vec2i &targetPos){
|
||||||
|
|
||||||
Vec2i relPos= targetPos - pos;
|
Vec2i relPos= targetPos - pos;
|
||||||
Vec2f relPosf= Vec2f(relPos.x, relPos.y);
|
Vec2f relPosf= Vec2f((float)relPos.x, (float)relPos.y);
|
||||||
targetRotation= radToDeg(streflop::atan2(relPosf.x, relPosf.y));
|
targetRotation= radToDeg(streflop::atan2(relPosf.x, relPosf.y));
|
||||||
targetRef= NULL;
|
targetRef= NULL;
|
||||||
|
|
||||||
@@ -717,7 +717,7 @@ bool Unit::update(){
|
|||||||
const int rotFactor= 2;
|
const int rotFactor= 2;
|
||||||
if(progress<1.f/rotFactor){
|
if(progress<1.f/rotFactor){
|
||||||
if(type->getFirstStOfClass(scMove)){
|
if(type->getFirstStOfClass(scMove)){
|
||||||
if(abs(lastRotation-targetRotation)<180)
|
if(abs((int)(lastRotation-targetRotation)) < 180)
|
||||||
rotation= lastRotation+(targetRotation-lastRotation)*progress*rotFactor;
|
rotation= lastRotation+(targetRotation-lastRotation)*progress*rotFactor;
|
||||||
else{
|
else{
|
||||||
float rotationTerm= targetRotation>lastRotation? -360.f: +360.f;
|
float rotationTerm= targetRotation>lastRotation? -360.f: +360.f;
|
||||||
@@ -991,7 +991,7 @@ void Unit::updateTarget(){
|
|||||||
//update target pos
|
//update target pos
|
||||||
targetPos= target->getCellPos();
|
targetPos= target->getCellPos();
|
||||||
Vec2i relPos= targetPos - pos;
|
Vec2i relPos= targetPos - pos;
|
||||||
Vec2f relPosf= Vec2f(relPos.x, relPos.y);
|
Vec2f relPosf= Vec2f((float)relPos.x, (float)relPos.y);
|
||||||
targetRotation= radToDeg(streflop::atan2(relPosf.x, relPosf.y));
|
targetRotation= radToDeg(streflop::atan2(relPosf.x, relPosf.y));
|
||||||
|
|
||||||
//update target vec
|
//update target vec
|
||||||
|
@@ -290,7 +290,7 @@ string AttackStoppedCommandType::getDesc(const TotalUpgrade *totalUpgrade) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//attack distance
|
//attack distance
|
||||||
str+= lang.get("AttackDistance")+": "+floatToStr(attackSkillType->getAttackRange());
|
str+= lang.get("AttackDistance")+": "+intToStr(attackSkillType->getAttackRange());
|
||||||
if(totalUpgrade->getAttackRange()!=0){
|
if(totalUpgrade->getAttackRange()!=0){
|
||||||
str+= "+"+intToStr(totalUpgrade->getAttackRange()!=0);
|
str+= "+"+intToStr(totalUpgrade->getAttackRange()!=0);
|
||||||
}
|
}
|
||||||
|
@@ -708,7 +708,7 @@ void UnitUpdater::hit(Unit *attacker, const AttackSkillType* ast, const Vec2i &t
|
|||||||
void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attacked, float distance){
|
void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attacked, float distance){
|
||||||
|
|
||||||
//get vars
|
//get vars
|
||||||
float damage= ast->getTotalAttackStrength(attacker->getTotalUpgrade());
|
int damage= ast->getTotalAttackStrength(attacker->getTotalUpgrade());
|
||||||
int var= ast->getAttackVar();
|
int var= ast->getAttackVar();
|
||||||
int armor= attacked->getType()->getTotalArmor(attacked->getTotalUpgrade());
|
int armor= attacked->getType()->getTotalArmor(attacked->getTotalUpgrade());
|
||||||
float damageMultiplier= world->getTechTree()->getDamageMultiplier(ast->getAttackType(), attacked->getType()->getArmorType());
|
float damageMultiplier= world->getTechTree()->getDamageMultiplier(ast->getAttackType(), attacked->getType()->getArmorType());
|
||||||
@@ -839,7 +839,7 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr, con
|
|||||||
for(int j=center.y-range; j<center.y+range+size; ++j){
|
for(int j=center.y-range; j<center.y+range+size; ++j){
|
||||||
|
|
||||||
//cells insede map and in range
|
//cells insede map and in range
|
||||||
if(map->isInside(i, j) && streflop::floor(floatCenter.dist(Vec2f(i, j))) <= (range+1)){
|
if(map->isInside(i, j) && streflop::floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){
|
||||||
|
|
||||||
//all fields
|
//all fields
|
||||||
for(int k=0; k<fieldCount; k++){
|
for(int k=0; k<fieldCount; k++){
|
||||||
|
@@ -44,13 +44,6 @@ void SystemFlags::init() {
|
|||||||
SystemFlags::debugLogFileList[SystemFlags::debugWorldSynch] = SystemFlags::SystemFlagsType(SystemFlags::debugWorldSynch);
|
SystemFlags::debugLogFileList[SystemFlags::debugWorldSynch] = SystemFlags::SystemFlagsType(SystemFlags::debugWorldSynch);
|
||||||
}
|
}
|
||||||
|
|
||||||
//bool SystemFlags::enableDebugText = false;
|
|
||||||
//bool SystemFlags::enableNetworkDebugInfo = false;
|
|
||||||
//bool SystemFlags::enablePerformanceDebugInfo = false;
|
|
||||||
//bool SystemFlags::enableWorldSynchDebugInfo = false;
|
|
||||||
|
|
||||||
//const char * SystemFlags::debugLogFile = NULL;
|
|
||||||
//ofstream SystemFlags::fileStream;
|
|
||||||
int SystemFlags::lockFile = -1;
|
int SystemFlags::lockFile = -1;
|
||||||
string SystemFlags::lockfilename = "";
|
string SystemFlags::lockfilename = "";
|
||||||
|
|
||||||
@@ -90,14 +83,18 @@ void SystemFlags::Close() {
|
|||||||
currentDebugLog.fileStream = NULL;
|
currentDebugLog.fileStream = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::lockfilename != "") {
|
if(SystemFlags::lockFile != -1) {
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
close(SystemFlags::lockFile);
|
close(SystemFlags::lockFile);
|
||||||
#else
|
#else
|
||||||
_close(SystemFlags::lockFile);
|
_close(SystemFlags::lockFile);
|
||||||
#endif
|
#endif
|
||||||
remove(SystemFlags::lockfilename.c_str());
|
SystemFlags::lockFile = -1;
|
||||||
SystemFlags::lockfilename = "";
|
|
||||||
|
if(SystemFlags::lockfilename != "") {
|
||||||
|
remove(SystemFlags::lockfilename.c_str());
|
||||||
|
SystemFlags::lockfilename = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,38 +140,40 @@ void SystemFlags::OutputDebug(DebugType type, const char *fmt, ...) {
|
|||||||
string debugLog = currentDebugLog.debugLogFileName;
|
string debugLog = currentDebugLog.debugLogFileName;
|
||||||
printf("Opening logfile [%s] type = %d, appendToFileOnly = %d\n",debugLog.c_str(),type, appendToFileOnly);
|
printf("Opening logfile [%s] type = %d, appendToFileOnly = %d\n",debugLog.c_str(),type, appendToFileOnly);
|
||||||
|
|
||||||
const string lock_file_name = "debug.lck";
|
if(SystemFlags::lockFile == -1) {
|
||||||
string lockfile = extractDirectoryPathFromFile(debugLog);
|
const string lock_file_name = "debug.lck";
|
||||||
lockfile += lock_file_name;
|
string lockfile = extractDirectoryPathFromFile(debugLog);
|
||||||
SystemFlags::lockfilename = lockfile;
|
lockfile += lock_file_name;
|
||||||
|
SystemFlags::lockfilename = lockfile;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
//SystemFlags::lockFile = open(lockfile.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR|S_IWUSR);
|
//SystemFlags::lockFile = open(lockfile.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR|S_IWUSR);
|
||||||
SystemFlags::lockFile = open(lockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
SystemFlags::lockFile = open(lockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
||||||
#else
|
#else
|
||||||
SystemFlags::lockFile = _open(lockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
SystemFlags::lockFile = _open(lockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
||||||
#endif
|
#endif
|
||||||
if (SystemFlags::lockFile < 0 || acquire_file_lock(SystemFlags::lockFile) == false) {
|
if (SystemFlags::lockFile < 0 || acquire_file_lock(SystemFlags::lockFile) == false) {
|
||||||
string newlockfile = lockfile;
|
string newlockfile = lockfile;
|
||||||
int idx = 1;
|
int idx = 1;
|
||||||
for(idx = 1; idx <= 100; ++idx) {
|
for(idx = 1; idx <= 100; ++idx) {
|
||||||
newlockfile = lockfile + intToStr(idx);
|
newlockfile = lockfile + intToStr(idx);
|
||||||
//SystemFlags::lockFile = open(newlockfile.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR|S_IWUSR);
|
//SystemFlags::lockFile = open(newlockfile.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR|S_IWUSR);
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
SystemFlags::lockFile = open(newlockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
SystemFlags::lockFile = open(newlockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
||||||
#else
|
#else
|
||||||
SystemFlags::lockFile = _open(newlockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
SystemFlags::lockFile = _open(newlockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
||||||
#endif
|
#endif
|
||||||
if(SystemFlags::lockFile >= 0 && acquire_file_lock(SystemFlags::lockFile) == true) {
|
if(SystemFlags::lockFile >= 0 && acquire_file_lock(SystemFlags::lockFile) == true) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::lockfilename = newlockfile;
|
SystemFlags::lockfilename = newlockfile;
|
||||||
debugLog += intToStr(idx);
|
debugLog += intToStr(idx);
|
||||||
|
|
||||||
printf("Opening additional logfile [%s]\n",debugLog.c_str());
|
printf("Opening additional logfile [%s]\n",debugLog.c_str());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(currentDebugLog.fileStream == NULL) {
|
if(currentDebugLog.fileStream == NULL) {
|
||||||
currentDebugLog.fileStream = new std::ofstream();
|
currentDebugLog.fileStream = new std::ofstream();
|
||||||
|
Reference in New Issue
Block a user