code cleanup based on cppcheck results

This commit is contained in:
Mark Vejvoda 2013-05-17 05:01:23 +00:00
parent 2fd5c2241e
commit c55b9c3ffe
10 changed files with 37 additions and 6 deletions

View File

@ -87,6 +87,13 @@ public:
AiInterface(Game &game, int factionIndex, int teamIndex, int useStartLocation=-1); AiInterface(Game &game, int factionIndex, int teamIndex, int useStartLocation=-1);
~AiInterface(); ~AiInterface();
AiInterface(const AiInterface& obj) {
throw megaglest_runtime_error("class AiInterface is NOT safe to copy!");
}
AiInterface & operator=(const AiInterface& obj) {
throw megaglest_runtime_error("class AiInterface is NOT safe to assign!");
}
//main //main
void update(); void update();

View File

@ -158,6 +158,14 @@ public:
PathFinder(); PathFinder();
PathFinder(const Map *map); PathFinder(const Map *map);
~PathFinder(); ~PathFinder();
PathFinder(const PathFinder& obj) {
throw megaglest_runtime_error("class PathFinder is NOT safe to copy!");
}
PathFinder & operator=(const PathFinder& obj) {
throw megaglest_runtime_error("class PathFinder is NOT safe to assign!");
}
void init(const Map *map); void init(const Map *map);
TravelState findPath(Unit *unit, const Vec2i &finalPos, bool *wasStuck=NULL,int frameIndex=-1); TravelState findPath(Unit *unit, const Vec2i &finalPos, bool *wasStuck=NULL,int frameIndex=-1);
void clearUnitPrecache(Unit *unit); void clearUnitPrecache(Unit *unit);

View File

@ -2257,7 +2257,7 @@ void Game::update() {
this->speed = 1; this->speed = 1;
Lang &lang= Lang::getInstance(); //Lang &lang= Lang::getInstance();
bool pauseAndSaveGameForNewClient = false; bool pauseAndSaveGameForNewClient = false;
for(int i = 0; i < world.getFactionCount(); ++i) { for(int i = 0; i < world.getFactionCount(); ++i) {
Faction *faction = world.getFaction(i); Faction *faction = world.getFaction(i);
@ -4803,7 +4803,7 @@ void Game::exitGameState(Program *program, Stats &endStats) {
game->endGame(); game->endGame();
} }
if(game != NULL && game->isMasterserverMode() == true || if((game != NULL && game->isMasterserverMode() == true) ||
Config::getInstance().getBool("AutoTest") == true) { Config::getInstance().getBool("AutoTest") == true) {
printf("Game ending with stats:\n"); printf("Game ending with stats:\n");
printf("-----------------------\n"); printf("-----------------------\n");

View File

@ -190,6 +190,8 @@ Config::Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> f
} }
#endif #endif
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("foundPath = [%d]\n",foundPath);
if(fileMustExist.first == true && fileExists(fileName.first) == false) { if(fileMustExist.first == true && fileExists(fileName.first) == false) {
//string currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath()); //string currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath());
fileName.first = currentpath + fileName.first; fileName.first = currentpath + fileName.first;

View File

@ -49,7 +49,7 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
int leftLabelStart=50; int leftLabelStart=50;
int leftColumnStart=leftLabelStart+280; int leftColumnStart=leftLabelStart+280;
int rightLabelStart=450; //int rightLabelStart=450;
//int rightColumnStart=rightLabelStart+280; //int rightColumnStart=rightLabelStart+280;
int buttonRowPos=50; int buttonRowPos=50;
int buttonStartPos=170; int buttonStartPos=170;

View File

@ -48,7 +48,7 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
int leftLabelStart=50; int leftLabelStart=50;
int leftColumnStart=leftLabelStart+280; int leftColumnStart=leftLabelStart+280;
int rightLabelStart=450; int rightLabelStart=450;
int rightColumnStart=rightLabelStart+280; //int rightColumnStart=rightLabelStart+280;
int buttonRowPos=50; int buttonRowPos=50;
int buttonStartPos=170; int buttonStartPos=170;
//int captionOffset=75; //int captionOffset=75;

View File

@ -268,7 +268,7 @@ void MenuStateRoot::render() {
logoMainW, logoMainH, logoMainW, logoMainH,
extraLogo, GraphicComponent::getFade()); extraLogo, GraphicComponent::getFade());
currentX += extraLogo->getPixmap()->getW(); //currentX += extraLogo->getPixmap()->getW();
} }
renderer.renderButton(&buttonNewGame); renderer.renderButton(&buttonNewGame);

View File

@ -168,7 +168,7 @@ MenuStateScenario::MenuStateScenario(Program *program, MainMenu *mainMenu,
showMessageBox( "Error: " + string(ex.what()), "Error detected", false); showMessageBox( "Error: " + string(ex.what()), "Error detected", false);
} }
if(scenarioErrors.size() > 0) { if(scenarioErrors.empty() == false) {
mainMessageBoxState=1; mainMessageBoxState=1;
string errorMsg = ""; string errorMsg = "";

View File

@ -195,6 +195,13 @@ public:
NetworkInterface(); NetworkInterface();
virtual ~NetworkInterface(); virtual ~NetworkInterface();
NetworkInterface(const NetworkInterface& obj) {
throw megaglest_runtime_error("class NetworkInterface is NOT safe to copy!");
}
NetworkInterface & operator=(const NetworkInterface& obj) {
throw megaglest_runtime_error("class NetworkInterface is NOT safe to assign!");
}
virtual Socket* getSocket(bool mutexLock=true)= 0; virtual Socket* getSocket(bool mutexLock=true)= 0;
virtual void close()= 0; virtual void close()= 0;
virtual string getHumanPlayerName(int index=-1) = 0; virtual string getHumanPlayerName(int index=-1) = 0;

View File

@ -107,6 +107,13 @@ public:
Program(int w, int h); Program(int w, int h);
~Program(); ~Program();
Program(const Program& obj) {
throw runtime_error("class Program is NOT safe to copy!");
}
Program & operator=(const Program& obj) {
throw runtime_error("class Program is NOT safe to assign!");
}
//map cell change //map cell change
void glestChangeMapHeight(int x, int y, int Height, int radius); void glestChangeMapHeight(int x, int y, int Height, int radius);
void pirateChangeMapHeight(int x, int y, int Height, int radius); void pirateChangeMapHeight(int x, int y, int Height, int radius);