a bunch more code cleanup from cppcheck
This commit is contained in:
parent
c1ca53f50d
commit
2c1b181bc7
|
@ -128,7 +128,7 @@ enum GAME_ARG_TYPE {
|
|||
GAME_ARG_VERBOSE,
|
||||
};
|
||||
|
||||
bool hasCommandArgument(int argc, wxChar** argv,const string argName,
|
||||
bool hasCommandArgument(int argc, wxChar** argv,const string &argName,
|
||||
int *foundIndex=NULL, int startLookupIndex=1,
|
||||
bool useArgParamLen=false) {
|
||||
bool result = false;
|
||||
|
@ -294,7 +294,6 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
Properties::setApplicationPath(executable_path(appPath));
|
||||
|
||||
Config &config = Config::getInstance();
|
||||
string iniFilePath = extractDirectoryPathFromFile(config.getFileName(false));
|
||||
//getGlPlatformExtensions();
|
||||
|
||||
isControlKeyPressed = false;
|
||||
|
@ -410,6 +409,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
|
||||
#else
|
||||
wxIcon icon;
|
||||
string iniFilePath = extractDirectoryPathFromFile(config.getFileName(false));
|
||||
string icon_file = iniFilePath + "g3dviewer.ico";
|
||||
std::ifstream testFile(icon_file.c_str());
|
||||
if(testFile.good()) {
|
||||
|
@ -2446,8 +2446,6 @@ bool App::OnInit() {
|
|||
|
||||
}
|
||||
|
||||
string appPath = "";
|
||||
|
||||
//#if defined(__MINGW32__)
|
||||
// const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(argv[0]));
|
||||
// appPath = tmp_buf;
|
||||
|
@ -2464,12 +2462,12 @@ bool App::OnInit() {
|
|||
//#if defined(__MINGW32__)
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
appPath = tmp_buf;
|
||||
string appPath = tmp_buf;
|
||||
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||
appPath = utf8_encode(wstr.get());
|
||||
#else
|
||||
appPath = wxFNCONV(exe_path);
|
||||
string appPath(wxFNCONV(exe_path));
|
||||
#endif
|
||||
|
||||
//#else
|
||||
|
|
|
@ -966,7 +966,7 @@ void Ai::massiveAttack(const Vec2i &pos, Field field, bool ultraAttack){
|
|||
|
||||
void Ai::returnBase(int unitIndex) {
|
||||
Vec2i pos;
|
||||
std::pair<CommandResult,string> r(crFailUndefined,"");
|
||||
//std::pair<CommandResult,string> r(crFailUndefined,"");
|
||||
aiInterface->getFactionIndex();
|
||||
pos= Vec2i(
|
||||
random.randRange(-villageRadius, villageRadius),
|
||||
|
@ -974,7 +974,8 @@ void Ai::returnBase(int unitIndex) {
|
|||
getRandomHomePosition();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
r= aiInterface->giveCommand(unitIndex, ccMove, pos);
|
||||
//r= aiInterface->giveCommand(unitIndex, ccMove, pos);
|
||||
aiInterface->giveCommand(unitIndex, ccMove, pos);
|
||||
|
||||
//aiInterface->printLog(1, "Order return to base pos:" + intToStr(pos.x)+", "+intToStr(pos.y)+": "+rrToStr(r)+"\n");
|
||||
}
|
||||
|
@ -1159,7 +1160,8 @@ void Ai::unblockUnits() {
|
|||
unitGroupCommandId = aiInterface->getWorld()->getNextCommandGroupId();
|
||||
}
|
||||
|
||||
std::pair<CommandResult,string> r = aiInterface->giveCommand(adjacentUnit,ct, pos, unitGroupCommandId);
|
||||
//std::pair<CommandResult,string> r = aiInterface->giveCommand(adjacentUnit,ct, pos, unitGroupCommandId);
|
||||
aiInterface->giveCommand(adjacentUnit,ct, pos, unitGroupCommandId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1945,7 +1945,8 @@ void Game::update() {
|
|||
if(newThreadManager == true) {
|
||||
int currentFrameCount = world.getFrameCount();
|
||||
masterController.signalSlaves(¤tFrameCount);
|
||||
bool slavesCompleted = masterController.waitTillSlavesTrigger(20000);
|
||||
//bool slavesCompleted = masterController.waitTillSlavesTrigger(20000);
|
||||
masterController.waitTillSlavesTrigger(20000);
|
||||
}
|
||||
else {
|
||||
// Signal the faction threads to do any pre-processing
|
||||
|
|
|
@ -46,7 +46,7 @@ const float GameCamera::centerOffsetZ= 8.0f;
|
|||
|
||||
GameCamera::GameCamera() : pos(0.f, defaultHeight, 0.f),
|
||||
destPos(0.f, defaultHeight, 0.f), destAng(startingVAng, startingHAng) {
|
||||
Config &config = Config::getInstance();
|
||||
//Config &config = Config::getInstance();
|
||||
calculatedDefault=defaultHeight;
|
||||
state= sGame;
|
||||
|
||||
|
|
|
@ -54,9 +54,9 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
int buttonRowPos=50;
|
||||
int buttonStartPos=170;
|
||||
//int captionOffset=75;
|
||||
int currentLabelStart=leftLabelStart;
|
||||
int currentColumnStart=leftColumnStart;
|
||||
int currentLine=700;
|
||||
//int currentLabelStart=leftLabelStart;
|
||||
//int currentColumnStart=leftColumnStart;
|
||||
//int currentLine=700;
|
||||
int lineOffset=30;
|
||||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
|
@ -98,9 +98,9 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonKeyboardSetup.setText(lang.get("Keyboardsetup"));
|
||||
|
||||
currentLine=650; // reset line pos
|
||||
currentLabelStart=leftLabelStart; // set to right side
|
||||
currentColumnStart=leftColumnStart; // set to right side
|
||||
int currentLine=650; // reset line pos
|
||||
int currentLabelStart=leftLabelStart; // set to right side
|
||||
int currentColumnStart=leftColumnStart; // set to right side
|
||||
|
||||
//lang
|
||||
labelLang.registerGraphicComponent(containerName,"labelLang");
|
||||
|
|
|
@ -56,9 +56,9 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
int buttonRowPos=50;
|
||||
int buttonStartPos=170;
|
||||
//int captionOffset=75;
|
||||
int currentLabelStart=leftLabelStart;
|
||||
int currentColumnStart=leftColumnStart;
|
||||
int currentLine=700;
|
||||
//int currentLabelStart=leftLabelStart;
|
||||
//int currentColumnStart=leftColumnStart;
|
||||
//int currentLine=700;
|
||||
int lineOffset=30;
|
||||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
|
@ -100,9 +100,9 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonKeyboardSetup.setText(lang.get("Keyboardsetup"));
|
||||
|
||||
currentLine=650; // reset line pos
|
||||
currentLabelStart=leftLabelStart; // set to right side
|
||||
currentColumnStart=leftColumnStart; // set to right side
|
||||
int currentLine=650; // reset line pos
|
||||
int currentLabelStart=leftLabelStart; // set to right side
|
||||
int currentColumnStart=leftColumnStart; // set to right side
|
||||
|
||||
//resolution
|
||||
labelScreenModes.registerGraphicComponent(containerName,"labelScreenModes");
|
||||
|
|
|
@ -52,9 +52,9 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
|
|||
int buttonRowPos=50;
|
||||
int buttonStartPos=170;
|
||||
//int captionOffset=75;
|
||||
int currentLabelStart=leftLabelStart;
|
||||
int currentColumnStart=leftColumnStart;
|
||||
int currentLine=700;
|
||||
//int currentLabelStart=leftLabelStart;
|
||||
//int currentColumnStart=leftColumnStart;
|
||||
//int currentLine=700;
|
||||
int lineOffset=30;
|
||||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
|
@ -96,9 +96,9 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
|
|||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonKeyboardSetup.setText(lang.get("Keyboardsetup"));
|
||||
|
||||
currentLine=650; // reset line pos
|
||||
currentLabelStart=leftLabelStart; // set to right side
|
||||
currentColumnStart=leftColumnStart; // set to right side
|
||||
int currentLine=650; // reset line pos
|
||||
int currentLabelStart=leftLabelStart; // set to right side
|
||||
int currentColumnStart=leftColumnStart; // set to right side
|
||||
|
||||
|
||||
// external server port
|
||||
|
|
|
@ -52,9 +52,9 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
|
|||
int buttonRowPos=50;
|
||||
int buttonStartPos=170;
|
||||
//int captionOffset=75;
|
||||
int currentLabelStart=leftLabelStart;
|
||||
int currentColumnStart=leftColumnStart;
|
||||
int currentLine=700;
|
||||
//int currentLabelStart=leftLabelStart;
|
||||
//int currentColumnStart=leftColumnStart;
|
||||
//int currentLine=700;
|
||||
int lineOffset=30;
|
||||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
|
@ -96,9 +96,9 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
|
|||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonKeyboardSetup.setText(lang.get("Keyboardsetup"));
|
||||
|
||||
currentLine=650; // reset line pos
|
||||
currentLabelStart=leftLabelStart; // set to right side
|
||||
currentColumnStart=leftColumnStart; // set to right side
|
||||
int currentLine=650; // reset line pos
|
||||
int currentLabelStart=leftLabelStart; // set to right side
|
||||
int currentColumnStart=leftColumnStart; // set to right side
|
||||
|
||||
//soundboxes
|
||||
labelSoundFactory.registerGraphicComponent(containerName,"labelSoundFactory");
|
||||
|
|
|
@ -484,7 +484,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] BEFORE accept new client connection, serverInterface->getOpenSlotCount() = %d\n",__FILE__,__FUNCTION__,__LINE__,serverInterface->getOpenSlotCount());
|
||||
//bool hasOpenSlots = (serverInterface->getOpenSlotCount() > 0);
|
||||
bool hasOpenSlots = true;
|
||||
//bool hasOpenSlots = true;
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
|
||||
|
@ -584,30 +584,31 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] accepted new client connection, serverInterface->getOpenSlotCount() = %d, sessionKey = %d\n",__FILE__,__FUNCTION__,__LINE__,serverInterface->getOpenSlotCount(),sessionKey);
|
||||
|
||||
if(hasOpenSlots == false) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] !!!!!!!!WARNING - no open slots, disconnecting client\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//if(this->getSocket() != NULL) {
|
||||
NetworkMessageIntro networkMessageIntro(
|
||||
sessionKey,
|
||||
getNetworkVersionSVNString(),
|
||||
getHostName(),
|
||||
playerIndex,
|
||||
nmgstNoSlots,
|
||||
0,
|
||||
ServerSocket::getFTPServerPort(),
|
||||
"",
|
||||
serverInterface->getGameHasBeenInitiated());
|
||||
sendMessage(&networkMessageIntro);
|
||||
//}
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
|
||||
//printf("No open slots available\n");
|
||||
|
||||
close();
|
||||
}
|
||||
else {
|
||||
// if(hasOpenSlots == false) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] !!!!!!!!WARNING - no open slots, disconnecting client\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//
|
||||
// //if(this->getSocket() != NULL) {
|
||||
// NetworkMessageIntro networkMessageIntro(
|
||||
// sessionKey,
|
||||
// getNetworkVersionSVNString(),
|
||||
// getHostName(),
|
||||
// playerIndex,
|
||||
// nmgstNoSlots,
|
||||
// 0,
|
||||
// ServerSocket::getFTPServerPort(),
|
||||
// "",
|
||||
// serverInterface->getGameHasBeenInitiated());
|
||||
// sendMessage(&networkMessageIntro);
|
||||
// //}
|
||||
//
|
||||
// //if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
//
|
||||
// //printf("No open slots available\n");
|
||||
//
|
||||
// close();
|
||||
// }
|
||||
// else {
|
||||
{
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] client will be assigned to the next open slot\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//if(this->getSocket() != NULL) {
|
||||
|
|
|
@ -427,7 +427,8 @@ bool NetworkMessageReady::receive(Socket* socket){
|
|||
}
|
||||
else {
|
||||
unsigned char *buf = new unsigned char[getPackedSize()+1];
|
||||
bool result = NetworkMessage::receive(socket, buf, getPackedSize(), true);
|
||||
//bool result = NetworkMessage::receive(socket, buf, getPackedSize(), true);
|
||||
NetworkMessage::receive(socket, buf, getPackedSize(), true);
|
||||
unpackMessage(buf);
|
||||
//printf("Got packet size = %u data.messageType = %d\n%s\n",getPackedSize(),data.messageType,buf);
|
||||
delete [] buf;
|
||||
|
@ -1236,7 +1237,7 @@ unsigned int NetworkMessageCommandList::getPackedSizeDetail(int count) {
|
|||
void NetworkMessageCommandList::unpackMessageDetail(unsigned char *buf,int count) {
|
||||
data.commands.clear();
|
||||
data.commands.resize(count);
|
||||
unsigned int bytes_processed_total = 0;
|
||||
//unsigned int bytes_processed_total = 0;
|
||||
unsigned char *bufMove = buf;
|
||||
for(unsigned int i = 0; i < count; ++i) {
|
||||
unsigned int bytes_processed = unpack(bufMove, getPackedMessageFormatDetail(),
|
||||
|
@ -1255,7 +1256,7 @@ void NetworkMessageCommandList::unpackMessageDetail(unsigned char *buf,int count
|
|||
&data.commands[i].commandStateValue,
|
||||
&data.commands[i].unitCommandGroupId);
|
||||
bufMove += bytes_processed;
|
||||
bytes_processed_total += bytes_processed;
|
||||
//bytes_processed_total += bytes_processed;
|
||||
}
|
||||
//printf("\nUnPacked detail size = %u\n",bytes_processed_total);
|
||||
}
|
||||
|
@ -1264,7 +1265,7 @@ unsigned char * NetworkMessageCommandList::packMessageDetail(uint16 totalCommand
|
|||
int packetSize = getPackedSizeDetail(totalCommand) +1;
|
||||
unsigned char *buf = new unsigned char[packetSize];
|
||||
unsigned char *bufMove = buf;
|
||||
unsigned int bytes_processed_total = 0;
|
||||
//unsigned int bytes_processed_total = 0;
|
||||
for(unsigned int i = 0; i < totalCommand; ++i) {
|
||||
unsigned int bytes_processed = pack(bufMove, getPackedMessageFormatDetail(),
|
||||
data.commands[i].networkCommandType,
|
||||
|
@ -1282,7 +1283,7 @@ unsigned char * NetworkMessageCommandList::packMessageDetail(uint16 totalCommand
|
|||
data.commands[i].commandStateValue,
|
||||
data.commands[i].unitCommandGroupId);
|
||||
bufMove += bytes_processed;
|
||||
bytes_processed_total += bytes_processed;
|
||||
//bytes_processed_total += bytes_processed;
|
||||
}
|
||||
//printf("\nPacked detail size = %u, allocated = %d\n",bytes_processed_total,packetSize);
|
||||
return buf;
|
||||
|
@ -1363,7 +1364,7 @@ void NetworkMessageCommandList::send(Socket* socket) {
|
|||
toEndianHeader();
|
||||
|
||||
unsigned char *buf = NULL;
|
||||
bool result = false;
|
||||
//bool result = false;
|
||||
if(useOldProtocol == true) {
|
||||
NetworkMessage::send(socket, &data.header, commandListHeaderSize);
|
||||
}
|
||||
|
@ -1380,7 +1381,7 @@ void NetworkMessageCommandList::send(Socket* socket) {
|
|||
toEndianDetail(totalCommand);
|
||||
//printf("\n#3 Send packet commandcount [%u] framecount [%d]\n",totalCommand,data.header.frameCount);
|
||||
|
||||
bool result = false;
|
||||
//bool result = false;
|
||||
if(useOldProtocol == true) {
|
||||
NetworkMessage::send(socket, &data.commands[0], (sizeof(NetworkCommand) * totalCommand));
|
||||
}
|
||||
|
|
|
@ -880,9 +880,8 @@ void ServerInterface::signalClientsToRecieveData(std::map<PLATFORM_SOCKET,bool>
|
|||
MutexSafeWrapper safeMutexSlot(slotAccessorMutexes[i],CODE_AT_LINE_X(i));
|
||||
ConnectionSlot* connectionSlot = slots[i];
|
||||
|
||||
bool socketTriggered = false;
|
||||
|
||||
if(connectionSlot != NULL) {
|
||||
bool socketTriggered = false;
|
||||
PLATFORM_SOCKET clientSocket = connectionSlot->getSocketId();
|
||||
if(Socket::isSocketValid(&clientSocket)) {
|
||||
socketTriggered = socketTriggeredList[clientSocket];
|
||||
|
@ -913,7 +912,8 @@ void ServerInterface::checkForCompletedClients(std::map<int,bool> & mapSlotSigna
|
|||
if(newThreadManager == true) {
|
||||
|
||||
//printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
bool slavesCompleted = masterController.waitTillSlavesTrigger(1000 * MAX_SLOT_THREAD_WAIT_TIME);
|
||||
//bool slavesCompleted = masterController.waitTillSlavesTrigger(1000 * MAX_SLOT_THREAD_WAIT_TIME);
|
||||
masterController.waitTillSlavesTrigger(1000 * MAX_SLOT_THREAD_WAIT_TIME);
|
||||
masterController.clearSlaves(true);
|
||||
//printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
|
|
|
@ -444,17 +444,18 @@ void Tileset::addSurfTex(int leftUp, int rightUp, int leftDown, int rightDown, V
|
|||
if(leftUp == rightUp && leftUp == leftDown && leftUp == rightDown) {
|
||||
//texture variation according to probability
|
||||
float r= random.randRange(0.f, 1.f);
|
||||
int var= 0;
|
||||
float max= 0.f;
|
||||
const Pixmap2D* pixmap;
|
||||
if(surfProbs[leftUp][0]<0)
|
||||
{// big textures use coordinates
|
||||
int parts=partsArray[leftUp];
|
||||
pixmap=getSurfPixmap(leftUp, (mapY%parts)*parts+(mapX%parts));
|
||||
const Pixmap2D *pixmap = NULL;
|
||||
|
||||
if(surfProbs[leftUp][0] < 0) {
|
||||
// big textures use coordinates
|
||||
int parts = partsArray[leftUp];
|
||||
pixmap = getSurfPixmap(leftUp, (mapY % parts) * parts + (mapX % parts));
|
||||
}
|
||||
else{
|
||||
else {
|
||||
float max= 0.f;
|
||||
int var= 0;
|
||||
for(int i=0; i < surfProbs[leftUp].size(); ++i) {
|
||||
max+= surfProbs[leftUp][i];
|
||||
max += surfProbs[leftUp][i];
|
||||
if(r <= max) {
|
||||
var= i;
|
||||
break;
|
||||
|
|
|
@ -362,7 +362,7 @@ void MainWindow::init(string fname) {
|
|||
toolbar2->Realize();
|
||||
|
||||
Config &config = Config::getInstance();
|
||||
string iniFilePath = extractDirectoryPathFromFile(config.getFileName(false));
|
||||
|
||||
string userData = config.getString("UserData_Root","");
|
||||
if(userData != "") {
|
||||
endPathWithSlash(userData);
|
||||
|
@ -381,6 +381,7 @@ void MainWindow::init(string fname) {
|
|||
#else
|
||||
//std::cout << "B" << std::endl;
|
||||
wxIcon icon;
|
||||
string iniFilePath = extractDirectoryPathFromFile(config.getFileName(false));
|
||||
string icon_file = iniFilePath + "editor.ico";
|
||||
std::ifstream testFile(icon_file.c_str());
|
||||
if(testFile.good()) {
|
||||
|
@ -1536,7 +1537,7 @@ bool App::OnInit() {
|
|||
//exe_path = exe_path.BeforeLast(path_separator[0]);
|
||||
//exe_path += path_separator;
|
||||
|
||||
string appPath = "";
|
||||
string appPath;
|
||||
//#if defined(__MINGW32__)
|
||||
|
||||
#ifdef WIN32
|
||||
|
|
|
@ -154,6 +154,8 @@ Program::Program(int w, int h) {
|
|||
}
|
||||
|
||||
void Program::init() {
|
||||
undoStack = ChangeStack();
|
||||
redoStack = ChangeStack();
|
||||
cellSize = 6;
|
||||
grid=false;
|
||||
ofsetX = 0;
|
||||
|
|
|
@ -76,6 +76,7 @@ class ChangeStack : public std::stack<UndoPoint> {
|
|||
public:
|
||||
static const unsigned int maxSize = 100;
|
||||
|
||||
ChangeStack() : std::stack<UndoPoint>() { }
|
||||
void clear() { c.clear(); }
|
||||
|
||||
void push(UndoPoint p) {
|
||||
|
|
|
@ -103,7 +103,7 @@ int zipfile_tool(int argc, const char *argv[]) {
|
|||
pSrc_filename = argv[p++];
|
||||
pDst_filename = argv[p++];
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED)printf("Mode: %c, Level: %u\nInput File: \"%s\"\nOutput File: \"%s\"\n", pMode[0], level, pSrc_filename, pDst_filename);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED)printf("Mode: %c, Level: %d\nInput File: \"%s\"\nOutput File: \"%s\"\n", pMode[0], level, pSrc_filename, pDst_filename);
|
||||
|
||||
// Open input file.
|
||||
pInfile = fopen(pSrc_filename, "rb");
|
||||
|
|
|
@ -84,7 +84,7 @@ TextFTGL::TextFTGL(FontTextHandlerType type) : Text(type) {
|
|||
|
||||
GLenum error = glGetError();
|
||||
if(error != GL_NO_ERROR) {
|
||||
printf("\n[%s::%s] Line %d Error = %d [%s] for size = %d res = %d\n",__FILE__,__FUNCTION__,__LINE__,error,gluErrorString(error),defSize,TextFTGL::faceResolution);
|
||||
printf("\n[%s::%s] Line %d Error = %d [%s] for size = %u res = %d\n",__FILE__,__FUNCTION__,__LINE__,error,gluErrorString(error),defSize,TextFTGL::faceResolution);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
|
|
@ -551,7 +551,7 @@ bool VideoPlayer::initPlayer(string mediaURL) {
|
|||
#if defined(WIN32)
|
||||
if(verboseEnabled) _putenv("VLC_VERBOSE=2");
|
||||
#endif
|
||||
int vlc_argc = ctxPtr->vlc_argv.size();
|
||||
|
||||
|
||||
// char const *vlc_argv[] =
|
||||
// {
|
||||
|
@ -591,6 +591,7 @@ bool VideoPlayer::initPlayer(string mediaURL) {
|
|||
ctxPtr->libvlc = libvlc_new(ctxPtr->vlc_argc, &ctxPtr->vlc_argv[0],&ex);
|
||||
catchError(&ex);
|
||||
#else
|
||||
int vlc_argc = ctxPtr->vlc_argv.size();
|
||||
ctxPtr->libvlc = libvlc_new(vlc_argc, &ctxPtr->vlc_argv[0]);
|
||||
#endif
|
||||
|
||||
|
@ -1322,8 +1323,9 @@ bool VideoPlayer::playFrame(bool swapBuffers) {
|
|||
ctxPtr != NULL && ctxPtr->isPlaying == true &&
|
||||
finished == false && stop == false) {
|
||||
|
||||
int action = 0, pause = 0, n = 0;
|
||||
action = 0;
|
||||
//int action = 0, pause = 0, n = 0;
|
||||
//int action = 0, n = 0;
|
||||
int action = 0;
|
||||
|
||||
SDL_Event event;
|
||||
/* Keys: enter (fullscreen), space (pause), escape (quit) */
|
||||
|
@ -1353,14 +1355,14 @@ bool VideoPlayer::playFrame(bool swapBuffers) {
|
|||
//screen = SDL_SetVideoMode(WIDTH, HEIGHT, 0, options);
|
||||
finished = true;
|
||||
break;
|
||||
case ' ':
|
||||
//pause = !pause;
|
||||
break;
|
||||
//case ' ':
|
||||
// //pause = !pause;
|
||||
// break;
|
||||
}
|
||||
|
||||
if(pause == 0) {
|
||||
n++;
|
||||
}
|
||||
//if(pause == 0) {
|
||||
//n++;
|
||||
//}
|
||||
|
||||
//assertGl();
|
||||
|
||||
|
|
|
@ -504,9 +504,8 @@ void event_numeric(irc_session_t * session, unsigned int event, const char * ori
|
|||
#endif
|
||||
|
||||
bool IRCThread::getEventDataDone() {
|
||||
bool result = false;
|
||||
MutexSafeWrapper safeMutex(&mutexEventDataDone,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
result = eventDataDone;
|
||||
bool result = eventDataDone;
|
||||
safeMutex.ReleaseLock();
|
||||
|
||||
return result;
|
||||
|
|
|
@ -598,7 +598,7 @@ string getNetworkInterfaceBroadcastAddress(string ipAddress)
|
|||
|
||||
// Now lookup the appropriate adaptor-name in the pAdaptorInfos, if we can find it
|
||||
const char * name = NULL;
|
||||
const char * desc = NULL;
|
||||
//const char * desc = NULL;
|
||||
if (pAdapterInfo)
|
||||
{
|
||||
IP_ADAPTER_INFO * next = pAdapterInfo;
|
||||
|
@ -610,7 +610,7 @@ string getNetworkInterfaceBroadcastAddress(string ipAddress)
|
|||
if (Inet_AtoN(ipAddr->IpAddress.String) == ntohl(row.dwAddr))
|
||||
{
|
||||
name = next->AdapterName;
|
||||
desc = next->Description;
|
||||
//desc = next->Description;
|
||||
break;
|
||||
}
|
||||
ipAddr = ipAddr->Next;
|
||||
|
@ -1361,8 +1361,6 @@ int Socket::send(const void *data, int dataSize) {
|
|||
}
|
||||
|
||||
int Socket::receive(void *data, int dataSize, bool tryReceiveUntilDataSizeMet) {
|
||||
const int MAX_RECV_WAIT_SECONDS = 3;
|
||||
|
||||
ssize_t bytesReceived = 0;
|
||||
|
||||
if(isSocketValid() == true) {
|
||||
|
@ -1387,6 +1385,7 @@ int Socket::receive(void *data, int dataSize, bool tryReceiveUntilDataSizeMet) {
|
|||
else if(bytesReceived < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during receive, trying again...\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
const int MAX_RECV_WAIT_SECONDS = 3;
|
||||
time_t tStartTimer = time(NULL);
|
||||
while((bytesReceived < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
(difftime((long int)time(NULL),tStartTimer) <= MAX_RECV_WAIT_SECONDS)) {
|
||||
|
@ -1480,8 +1479,6 @@ int Socket::peek(void *data, int dataSize,bool mustGetData,int *pLastSocketError
|
|||
Chrono chrono;
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) chrono.start();
|
||||
|
||||
const int MAX_PEEK_WAIT_SECONDS = 3;
|
||||
|
||||
int lastSocketError = 0;
|
||||
int err = 0;
|
||||
if(isSocketValid() == true) {
|
||||
|
@ -1539,6 +1536,7 @@ int Socket::peek(void *data, int dataSize,bool mustGetData,int *pLastSocketError
|
|||
|
||||
//printf("Peek #2 err = %d\n",err);
|
||||
|
||||
const int MAX_PEEK_WAIT_SECONDS = 3;
|
||||
time_t tStartTimer = time(NULL);
|
||||
while((err < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
isSocketValid() == true &&
|
||||
|
@ -2033,7 +2031,6 @@ void BroadCastClientSocketThread::execute() {
|
|||
struct sockaddr_in bcaddr; // The broadcast address for the receiver.
|
||||
PLATFORM_SOCKET bcfd; // The file descriptor used for the broadcast.
|
||||
//bool one = true; // Parameter for "setscokopt".
|
||||
char buff[10024]=""; // Buffers the data to be broadcasted.
|
||||
socklen_t alen=0;
|
||||
|
||||
port = htons( Socket::getBroadCastPort() );
|
||||
|
@ -2067,6 +2064,7 @@ void BroadCastClientSocketThread::execute() {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
try {
|
||||
char buff[10024]=""; // Buffers the data to be broadcasted.
|
||||
// Keep getting packets forever.
|
||||
for( time_t elapsed = time(NULL); difftime((long int)time(NULL),elapsed) <= 5; ) {
|
||||
alen = sizeof(struct sockaddr);
|
||||
|
@ -2515,7 +2513,6 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||
int result = -1;
|
||||
struct UPNPDev *devlist = NULL;
|
||||
struct UPNPDev *dev = NULL;
|
||||
char *descXML = NULL;
|
||||
int descXMLsize = 0;
|
||||
char buf[255] = "";
|
||||
// Callers MUST pass in NULL or a UPNPInitInterface *
|
||||
|
@ -2575,9 +2572,9 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||
|
||||
//printf("UPnP device found: [%s] [%s] lanaddr [%s]\n", dev->descURL, dev->st,lanaddr);
|
||||
#if !defined(MINIUPNPC_VERSION_PRE1_7) && !defined(MINIUPNPC_VERSION_PRE1_6)
|
||||
descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, (sizeof(lanaddr) / sizeof(lanaddr[0])),0);
|
||||
char *descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, (sizeof(lanaddr) / sizeof(lanaddr[0])),0);
|
||||
#else
|
||||
descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, (sizeof(lanaddr) / sizeof(lanaddr[0])));
|
||||
char *descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, (sizeof(lanaddr) / sizeof(lanaddr[0])));
|
||||
#endif
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"LAN address: %s\n", lanaddr);
|
||||
|
||||
|
@ -2656,9 +2653,6 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||
|
||||
bool UPNP_Tools::upnp_add_redirect(int ports[2],bool mutexLock) {
|
||||
bool result = true;
|
||||
char externalIP[16] = "";
|
||||
char ext_port_str[16] = "";
|
||||
char int_port_str[16] = "";
|
||||
|
||||
//printf("SERVER SOCKET upnp_add_redirect - START\n");
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] upnp_add_redir(%d : %d)\n",__FILE__,__FUNCTION__,__LINE__,ports[0],ports[1]);
|
||||
|
@ -2679,12 +2673,15 @@ bool UPNP_Tools::upnp_add_redirect(int ports[2],bool mutexLock) {
|
|||
result = false;
|
||||
}
|
||||
else {
|
||||
char externalIP[16] = "";
|
||||
#ifndef MINIUPNPC_VERSION_PRE1_5
|
||||
UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIP);
|
||||
#else
|
||||
UPNP_GetExternalIPAddress(urls.controlURL, data.servicetype, externalIP);
|
||||
#endif
|
||||
|
||||
char ext_port_str[16] = "";
|
||||
char int_port_str[16] = "";
|
||||
sprintf(ext_port_str, "%d", ports[0]);
|
||||
sprintf(int_port_str, "%d", ports[1]);
|
||||
|
||||
|
|
|
@ -632,7 +632,6 @@ void Window::toggleFullscreen() {
|
|||
|
||||
void Window::handleMouseDown(SDL_Event event) {
|
||||
static const Uint32 DOUBLECLICKTIME = 500;
|
||||
static const int DOUBLECLICKDELTA = 5;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
|
@ -663,6 +662,7 @@ void Window::handleMouseDown(SDL_Event event) {
|
|||
if(n >= 0 && n < mbCount) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
static const int DOUBLECLICKDELTA = 5;
|
||||
if(ticks - lastMouseDown[n] < DOUBLECLICKTIME
|
||||
&& abs(lastMouseX[n] - event.button.x) < DOUBLECLICKDELTA
|
||||
&& abs(lastMouseY[n] - event.button.y) < DOUBLECLICKDELTA) {
|
||||
|
@ -944,7 +944,7 @@ wchar_t extractKeyPressedUnicode(SDL_KeyboardEvent input) {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||
string inputKeyName = SDL_GetKeyName(input.keysym.sym);
|
||||
//string inputKeyName = SDL_GetKeyName(input.keysym.sym);
|
||||
|
||||
//printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n",
|
||||
// c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod);
|
||||
|
@ -1010,7 +1010,7 @@ SDLKey extractKeyPressed(SDL_KeyboardEvent input) {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||
string inputKeyName = SDL_GetKeyName(input.keysym.sym);
|
||||
//string inputKeyName = SDL_GetKeyName(input.keysym.sym);
|
||||
|
||||
//printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n",
|
||||
// c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod);
|
||||
|
@ -1177,7 +1177,7 @@ wchar_t Window::extractLastKeyPressed() {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||
string inputKeyName = SDL_GetKeyName(keystate.sym);
|
||||
//string inputKeyName = SDL_GetKeyName(keystate.sym);
|
||||
|
||||
//printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n",
|
||||
// c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod);
|
||||
|
|
|
@ -261,7 +261,6 @@ bool Checksum::addFileToSum(const string &path) {
|
|||
addString(lastFile(path));
|
||||
|
||||
bool isXMLFile = (EndsWith(path, ".xml") == true);
|
||||
bool inCommentTag=false;
|
||||
|
||||
// Determine the file length
|
||||
ifs.seekg(0, ios::end);
|
||||
|
@ -277,6 +276,7 @@ bool Checksum::addFileToSum(const string &path) {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] buf.size() = %d, path [%s], isXMLFile = %d\n",__FILE__,__FUNCTION__,__LINE__,buf.size(), path.c_str(),isXMLFile);
|
||||
|
||||
if(isXMLFile == true) {
|
||||
bool inCommentTag=false;
|
||||
for(std::size_t i = 0; i < buf.size(); ++i) {
|
||||
// Ignore Spaces in XML files as they are
|
||||
// ONLY for formatting
|
||||
|
@ -343,7 +343,8 @@ uint32 Checksum::getSum() {
|
|||
MutexSafeWrapper safeMutexSocketDestructorFlag(&Checksum::fileListCacheSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
if(Checksum::fileListCache.find(iterMap->first) == Checksum::fileListCache.end()) {
|
||||
Checksum fileResult;
|
||||
bool fileAddedOk = fileResult.addFileToSum(iterMap->first);
|
||||
//bool fileAddedOk = fileResult.addFileToSum(iterMap->first);
|
||||
fileResult.addFileToSum(iterMap->first);
|
||||
Checksum::fileListCache[iterMap->first] = fileResult.getSum();
|
||||
//printf("fileAddedOk = %d for file [%s] CRC [%d]\n",fileAddedOk,iterMap->first.c_str(),Checksum::fileListCache[iterMap->first]);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ int g3d2xml(FILE *infile, FILE *outfile)
|
|||
free(fdata);
|
||||
return FALSE;
|
||||
}
|
||||
fprintf(outfile, "\t\t<Vertices frame=\"%d\">\n",
|
||||
fprintf(outfile, "\t\t<Vertices frame=\"%u\">\n",
|
||||
jj);
|
||||
for (kk=0; kk < meshHeader.vertexCount; kk++)
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ int g3d2xml(FILE *infile, FILE *outfile)
|
|||
free(fdata);
|
||||
return FALSE;
|
||||
}
|
||||
fprintf(outfile, "\t\t<Normals frame=\"%d\">\n",
|
||||
fprintf(outfile, "\t\t<Normals frame=\"%u\">\n",
|
||||
jj);
|
||||
for (kk=0; kk < meshHeader.vertexCount; kk++)
|
||||
{
|
||||
|
|
|
@ -521,7 +521,7 @@ int processVertices(xmlNode *n, FILE *outfile, uint32 vertexCount)
|
|||
/* check that the correct number of vertices were processed */
|
||||
if (counted_vertices != vertexCount)
|
||||
{
|
||||
printf("Found %d vertices, expected %d!\n",
|
||||
printf("Found %u vertices, expected %u!\n",
|
||||
counted_vertices, vertexCount);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ int processNormals(xmlNode *n, FILE *outfile, uint32 vertexCount)
|
|||
/* check that the correct number of normals were processed */
|
||||
if (counted_normals != vertexCount)
|
||||
{
|
||||
printf("Found %d normals, expected %d!\n",
|
||||
printf("Found %u normals, expected %u!\n",
|
||||
counted_normals, vertexCount);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ int processTexcoords(xmlNode *n, FILE *outfile, uint32 vertexCount)
|
|||
/* check that the correct number of texco were processed */
|
||||
if (counted_texco != vertexCount)
|
||||
{
|
||||
printf("Found %d texture coordinates, expected %d!\n",
|
||||
printf("Found %u texture coordinates, expected %u!\n",
|
||||
counted_texco, vertexCount);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ int processIndices(xmlNode *n, FILE *outfile, uint32 indexCount)
|
|||
/* check that the correct number of indices were processed */
|
||||
if (counted_indices != indexCount)
|
||||
{
|
||||
printf("Found %d indices, expected %d!\n",
|
||||
printf("Found %u indices, expected %u!\n",
|
||||
counted_indices, indexCount);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue