git repos / blockattack-game

commit 90e6c797

sago007 · 2015-11-22 21:46
90e6c797baf6b9e5580988274f3125f3ae64beff patch · browse files
parent cdb45e211fbd6e078eba33c87d88a71b8fa2ee29

Removed some "using namespace" from headers and some unused files

Changed files

M source/code/highscore.h before
M source/code/joypad.h before
M source/code/listFiles.cpp before
M source/code/listFiles.h before
M source/code/main.cpp before
M source/code/mainVars.hpp before
D source/code/menu/MenuItemCommand.cpp before
D source/code/menu/MenuItemCommand.hpp before
M source/code/ttfont.h before
diff --git a/source/code/highscore.h b/source/code/highscore.h index ad24efe..5e241df 100644 --- a/source/code/highscore.h +++ b/source/code/highscore.h
@@ -36,8 +36,6 @@ http://blockattack.sf.net
#include <shlobj.h>
#endif
-using namespace std;
-
const int top = 10;
struct record
@@ -50,7 +48,7 @@ class Highscore
{
private:
record tabel[top];
- string filename;
+ std::string filename;
int ourType; //This is ugly, remove me, plz!
void writeFile();
public:
diff --git a/source/code/joypad.h b/source/code/joypad.h index b8dff90..6237b46 100644 --- a/source/code/joypad.h +++ b/source/code/joypad.h
@@ -30,8 +30,6 @@ http://blockattack.sf.net
#define NRofPADS 4
#define NRofBUTTONS 12
-using namespace std;
-
struct Joypad_status
{
bool padLeft[NRofPADS];
diff --git a/source/code/listFiles.cpp b/source/code/listFiles.cpp index d47a21b..b53c634 100644 --- a/source/code/listFiles.cpp +++ b/source/code/listFiles.cpp
@@ -27,15 +27,7 @@ listFiles.cpp
#include "listFiles.h"
-/*ListFiles::ListFiles()
-{
-
-}
-
-ListFiles::~ListFiles()
-{
-
-}*/
+using namespace std;
void ListFiles::setDirectory(const string &directory)
diff --git a/source/code/listFiles.h b/source/code/listFiles.h index 22e3554..f2d8637 100644 --- a/source/code/listFiles.h +++ b/source/code/listFiles.h
@@ -40,28 +40,26 @@ http://blockattack.sf.net
#define FIRST_FILE 1
#endif
-using namespace std;
-
class ListFiles
{
private:
int startFileNr; //The first fileto belisted
- string filenames[MAX_NR_OF_FILES];
+ std::string filenames[MAX_NR_OF_FILES];
int nrOfFiles;
#if defined(_WIN32)
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
#endif
- bool isInList(const string &name); //The name is already in the list
+ bool isInList(const std::string &name); //The name is already in the list
public:
//ListFiles();
//~ListFiles();
- void setDirectory(const string &dictory); //Find file in BlockAttack folder
- void setDirectory2(const string &dictory); //Second directory we also look in
+ void setDirectory(const std::string &dictory); //Find file in BlockAttack folder
+ void setDirectory2(const std::string &dictory); //Second directory we also look in
//void setDirecctoryInHome(string dictory); //Find files in home folder (it should work...)
- string getFileName(int); //Returns the filename of a file
+ std::string getFileName(int); //Returns the filename of a file
bool fileExists(int);
void forward(); //inclease startFile by 10
void back(); //decrease startFile by 10
- string getRandom(); //Return the name of a random file in the directory, empty if none
+ std::string getRandom(); //Return the name of a random file in the directory, empty if none
};
diff --git a/source/code/main.cpp b/source/code/main.cpp index 8777376..65f89a7 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp
@@ -99,6 +99,8 @@ http://blockattack.sf.net
*******************************************************************************/
#include "mainVars.hpp"
+using namespace std;
+
static void MakeBackground(int,int);
SDL_Surface * IMG_Load2(const char* path)
diff --git a/source/code/mainVars.hpp b/source/code/mainVars.hpp index 42e4b36..a769bd4 100644 --- a/source/code/mainVars.hpp +++ b/source/code/mainVars.hpp
@@ -33,8 +33,6 @@ http://blockattack.sf.net
#define BOMBTIME 200
#define CURSORTIME 200
-
-using namespace std; //remove it if you dare...
const char sharedir[] = SHAREDIR;
//All graphic in the game (as pointers):
@@ -203,12 +201,12 @@ char player1name[30];
char player2name[30];
//paths
-static string stageClearSavePath;
+static std::string stageClearSavePath;
static const int nrOfStageLevels = 50; //number of stages in stage Clear
-vector<bool> stageCleared(nrOfStageLevels); //vector that tells if a stage is cleared
-vector<Uint32> stageTimes(nrOfStageLevels); //For statistical puposes
-vector<Uint32> stageScores(nrOfStageLevels); //--||--
+std::vector<bool> stageCleared(nrOfStageLevels); //vector that tells if a stage is cleared
+std::vector<Uint32> stageTimes(nrOfStageLevels); //For statistical puposes
+std::vector<Uint32> stageScores(nrOfStageLevels); //--||--
bool twoPlayers; //True if two players are playing
//Old mouse position:
@@ -221,7 +219,7 @@ static char forceredraw; //If 1: always redraw, if 2: rarely redraw
static bool singlePuzzle = false; //if true we are just in a little 300x600 window
static int singlePuzzleNr = 0;
-static string singlePuzzleFile;
+static std::string singlePuzzleFile;
#if DEBUG
//frame counter (fps)
diff --git a/source/code/menu/MenuItemCommand.cpp b/source/code/menu/MenuItemCommand.cpp deleted file mode 100644 index cdfb9e2..0000000 --- a/source/code/menu/MenuItemCommand.cpp +++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * File: MenuItemCommand.cpp
- * Author: poul
- *
- * Created on 11. marts 2011, 20:46
- */
-
-#include "MenuItemCommand.hpp"
-
-MenuItemCommand::MenuItemCommand()
-{
- selected = false;
-}
-
-MenuItemCommand::MenuItemCommand(string text, void(*pt2Function)() )
-{
- this->text = text;
- command = pt2Function;
- selected = false;
-}
-
-MenuItemCommand::MenuItemCommand(const MenuItemCommand& orig)
-{
-}
-
-MenuItemCommand::~MenuItemCommand()
-{
-}
-
-void MenuItemCommand::SetSelected(bool selected)
-{
- this->selected = selected;
-}
-
-void MenuItemCommand::Activated()
-{
- //Add execode
- command();
-}
-
-string MenuItemCommand::GetType()
-{
- return "MenuItemCommand";
-}
-
-string MenuItemCommand::GetText()
-{
- return text;
-}
-
-void MenuItemCommand::SetText(string text)
-{
- this->text = text;
-}
\ No newline at end of file
diff --git a/source/code/menu/MenuItemCommand.hpp b/source/code/menu/MenuItemCommand.hpp deleted file mode 100644 index 26ee49d..0000000 --- a/source/code/menu/MenuItemCommand.hpp +++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * File: MenuItemCommand.hpp
- * Author: poul
- *
- * Created on 11. marts 2011, 20:46
- */
-
-#ifndef _MENUITEMCOMMAND_HPP
-#define _MENUITEMCOMMAND_HPP
-
-#include "MenuItem.hpp"
-
-class MenuItemCommand : MenuItem
-{
-public:
- MenuItemCommand();
- MenuItemCommand(string text, void (*pt2Function)(void));
- MenuItemCommand(const MenuItemCommand& orig);
- virtual ~MenuItemCommand();
- void SetSelected(bool selected);
- void Activated();
- string GetText();
- string GetType();
- void SetText(string text);
-private:
- bool selected;
- string text;
- void (*command)(void);
-};
-
-#endif /* _MENUITEMCOMMAND_HPP */
-
diff --git a/source/code/ttfont.h b/source/code/ttfont.h index d1cff5c..1d3d652 100644 --- a/source/code/ttfont.h +++ b/source/code/ttfont.h
@@ -37,7 +37,6 @@ http://blockattack.sf.net
#include "SDL.h"
//#include "SDL_ttf.h" //To use True Type Fonts in SDL
-using namespace std;
class TTFont
{