commit 80b830cd
Removed some warnings and unsused variables
Changed files
diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp
index c9cdcde..6b6efae 100644
--- a/source/code/BlockGame.cpp
+++ b/source/code/BlockGame.cpp
@@ -485,7 +485,7 @@ void BlockGame::Demonstration(bool toggle)
//We want to play the replay (must have been loaded beforehand)
void BlockGame::playReplay(int tx, int ty, unsigned int ticks, Replay r)
{
- if(r.getActions().size()==0)
+ if(r.getActions().size()==0)
{
cerr << "Empty replay data" << endl;
return;
@@ -747,7 +747,7 @@ void BlockGame::putStartBlocks(Uint32 n)
//decreases hang for all hanging blocks and wait for waiting blocks
void BlockGame::ReduceStuff()
{
- Uint32 howMuchHang = (ticks - FRAMELENGTH*hangTicks)/FRAMELENGTH;
+ Sint32 howMuchHang = (ticks - FRAMELENGTH*hangTicks)/FRAMELENGTH;
if (howMuchHang>0)
{
for (int i=0; i<7; i++)
@@ -828,6 +828,7 @@ bool BlockGame::CreateGarbage(int wide, int height)
//bGarbageFallLeft = !(bGarbageFallLeft);
return true;
}
+ return false;
}
//Creates garbage using a given wide and height
@@ -853,14 +854,18 @@ bool BlockGame::CreateGreyGarbage()
end=6;
}
for (int i = startPosition; i <startPosition+1; i++)
+ {
for (int j = start; j < end; j++)
{
board[j][i] = 2*1000000+nextGarbageNumber;
}
+ }
nextGarbageNumber++;
- if (nextGarbageNumber>999999) nextGarbageNumber = 10;
+ if (nextGarbageNumber>999999)
+ nextGarbageNumber = 10;
return true;
}
+ return false;
}
@@ -1070,12 +1075,6 @@ void BlockGame::ClearBlocks()
} //for j
} //for i
- bool blockIsFalling[6][30]; //See that is falling
- for (int i=0; i<30; i++)
- for (int j=0; j<6; j++)
- blockIsFalling[j][i] = false;
-
-
combo = 0;
chain = 0;
@@ -2103,23 +2102,24 @@ void BlockGame::Update()
}
}
-bool BlockGame::IsNearDeath() {
- if ((TowerHeight>12)&&(!puzzleMode)&&(!bGameOver))
- return true;
- else
- return false;
+bool BlockGame::IsNearDeath()
+{
+ if ((TowerHeight>12)&&(!puzzleMode)&&(!bGameOver))
+ return true;
+ else
+ return false;
}
-void BlockGame::UpdateInternal(int newtick)
+void BlockGame::UpdateInternal(unsigned int newtick)
{
- while(newtick >= ticks+50)
+ while(newtick >= ticks+50)
{
ticks+=50;
Update();
}
}
-void BlockGame::Update(int newtick)
+void BlockGame::Update(unsigned int newtick)
{
if(bNetworkPlayer)
return;
@@ -2128,14 +2128,14 @@ void BlockGame::Update(int newtick)
/*cout << "Testing " << replayIndex << "<" << theReplay.getActions().size()
<< " && " << theReplay.getActions().at(replayIndex).time << "<=" <<
newtick-gameStartedAt << endl;*/
- while(replayIndex >= 0 && replayIndex < theReplay.getActions().size() &&
- theReplay.getActions().at(replayIndex).time <= newtick-gameStartedAt)
+ while(replayIndex >= 0 && replayIndex < theReplay.getActions().size() &&
+ theReplay.getActions().at(replayIndex).time <= newtick-gameStartedAt)
{
Action a = theReplay.getActions().at(replayIndex);
PerformAction(a.time+gameStartedAt,a.action,a.param);
++replayIndex;
}
-
+
}
else
{
@@ -2143,16 +2143,17 @@ void BlockGame::Update(int newtick)
}
}
-void BlockGame::ActionPerformed(int action, string param)
+void BlockGame::ActionPerformed(int action, string param)
{
if(bGameOver || bReplaying)
return;
theReplay.addAction(ticks-gameStartedAt,action,param);
}
-int BlockGame::GotAction(Sint32 &tick,int &action,string ¶m)
+int BlockGame::GotAction(unsigned int &tick,int &action,string ¶m)
{
- if(actionIndex < theReplay.getActions().size()) {
+ if(actionIndex < theReplay.getActions().size())
+ {
Action a = theReplay.getActions().at(actionIndex);
tick = a.time;
action = a.action;
@@ -2163,14 +2164,14 @@ int BlockGame::GotAction(Sint32 &tick,int &action,string ¶m)
return 0;
}
-void BlockGame::PerformAction(int tick, int action, string param)
+void BlockGame::PerformAction(unsigned int tick, int action, string param)
{
ss.str(std::string());
ss.clear();
ss << param;
int p1,p2;
Uint32 p3;
- switch(action)
+ switch(action)
{
case ACTION_UPDATE:
UpdateInternal(tick);
@@ -2180,12 +2181,12 @@ void BlockGame::PerformAction(int tick, int action, string param)
break;
case ACTION_MOVECURSORTO:
{
-
+
int p1,p2;
ss >> p1 >> p2;
MoveCursorTo(p1,p2);
}
- break;
+ break;
case ACTION_SWITCH:
SwitchAtCursor();
break;
@@ -2197,7 +2198,7 @@ void BlockGame::PerformAction(int tick, int action, string param)
ss >> p1 >> p2;
CreateGarbage(p1,p2);
}
- break;
+ break;
case ACTION_CREATEGRAYGARBAGE:
CreateGreyGarbage();
break;
diff --git a/source/code/BlockGame.hpp b/source/code/BlockGame.hpp
index f5aa929..c6127b7 100644
--- a/source/code/BlockGame.hpp
+++ b/source/code/BlockGame.hpp
@@ -98,10 +98,10 @@ protected:
bool bDisconnected; //The player has disconnected
#endif
unsigned int ticks;
- Sint32 gameStartedAt;
- Sint32 gameEndedAfter; //How long did the game last?
- int replayIndex; //Used during replay to remeber how many replay actions we have performed.
- int actionIndex; //Used during network to remeber how many actions we have sent.
+ unsigned int gameStartedAt;
+ unsigned int gameEndedAfter; //How long did the game last?
+ unsigned int replayIndex; //Used during replay to remeber how many replay actions we have performed.
+ unsigned int actionIndex; //Used during network to remeber how many actions we have sent.
int linesCleared;
int TowerHeight;
BlockGame *garbageTarget;
@@ -206,8 +206,8 @@ public:
void SwitchAtCursor();
//Generates a new line and moves the field one block up (restart puzzle mode)
void PushLine();
- void Update(int newtick);
- void PerformAction(int tick, int action, string param);
+ void Update(unsigned int newtick);
+ void PerformAction(unsigned int tick, int action, string param);
/**
*
* @param tick Tick of the action
@@ -215,7 +215,7 @@ public:
* @param param Params.
* @return 1 if an action was selected
*/
- int GotAction(int &tick,int &action,string ¶m);
+ int GotAction(unsigned int &tick,int &action,string ¶m);
#if NETWORK
//network play
void playNetwork(int tx, int ty,unsigned int ticks);
@@ -311,7 +311,7 @@ private:
void PushLineInternal();
//Updates evrything, if not called nothing happends
void Update();
- void UpdateInternal(int newtick);
+ void UpdateInternal(unsigned int newtick);
};
////////////////////////////////////////////////////////////////////////////////
///////////////////////// BlockAttack class end ////////////////////////////////
diff --git a/source/code/MenuSystem.cc b/source/code/MenuSystem.cc
index 9379daa..f69b179 100644
--- a/source/code/MenuSystem.cc
+++ b/source/code/MenuSystem.cc
@@ -140,7 +140,8 @@ void Button::setGfx(ButtonGfx* gfx)
this->gfx = gfx;
}
-int Button::getHeight() {
+int Button::getHeight()
+{
return this->gfx->ysize;
}
@@ -267,7 +268,8 @@ void Menu::run()
if(event.key.keysym.sym == SDLK_RETURN || event.key.keysym.sym == SDLK_KP_ENTER )
{
- if(marked < buttons.size()) {
+ if(marked < buttons.size())
+ {
buttons.at(marked)->doAction();
if(buttons.at(marked)->isPopOnRun())
running = false;
diff --git a/source/code/NetworkThing.hpp b/source/code/NetworkThing.hpp
index 3067340..34bf99e 100644
--- a/source/code/NetworkThing.hpp
+++ b/source/code/NetworkThing.hpp
@@ -220,7 +220,7 @@ public:
if (weAreConnected)
{
//cout << "Creating package" << endl;
- Sint32 tick;
+ Uint32 tick;
Sint32 action;
Sint32 paramsize;
string param;
@@ -417,7 +417,10 @@ public:
}
ntDisconnect(); //When we will disconnect!
-
+ break;
+
+ case ENET_EVENT_TYPE_NONE:
+ break;
}
}
diff --git a/source/code/ReadKeyboard.cpp b/source/code/ReadKeyboard.cpp
index 6b6ce9b..dd081c2 100644
--- a/source/code/ReadKeyboard.cpp
+++ b/source/code/ReadKeyboard.cpp
@@ -40,7 +40,7 @@ Uint8 ReadKeyboard::CharsBeforeCursor()
return position;
}
-ReadKeyboard::ReadKeyboard(char *oldName)
+ReadKeyboard::ReadKeyboard(const char *oldName)
{
length = 0;
maxLength = 16;
diff --git a/source/code/ReadKeyboard.h b/source/code/ReadKeyboard.h
index 54b452a..8e973fc 100644
--- a/source/code/ReadKeyboard.h
+++ b/source/code/ReadKeyboard.h
@@ -40,7 +40,7 @@ private:
public:
ReadKeyboard(void);
~ReadKeyboard(void);
- ReadKeyboard(char*);
+ ReadKeyboard(const char*);
Uint8 CharsBeforeCursor(); //Where should the cursor be placed?
bool ReadKey(SDLKey); //true if key accepted
const char* GetString(void);
diff --git a/source/code/block.make b/source/code/block.make
index c2efb3f..d89c8a7 100644
--- a/source/code/block.make
+++ b/source/code/block.make
@@ -29,9 +29,9 @@ endif
#Compile with debug information or optimized.
ifeq ($(DEBUG),1)
-BASE_CFLAGS += -g -DDEBUG=1
+BASE_CFLAGS += -g -DDEBUG=1 -Wall
else
-BASE_CFLAGS += -O4
+BASE_CFLAGS += -O3
endif
ifeq ($(NETWORK),1)
diff --git a/source/code/main.cpp b/source/code/main.cpp
index aa229cf..b2eae60 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -675,9 +675,9 @@ static int InitImages()
nf_button_font.drawCenter(60,10,_("Next"));
nf_button_font.setDest(bSkip);
nf_button_font.drawCenter(60,10,_("Skip"));
- nf_button_font.setDest(bBack);
- nf_button_font.drawCenter(60,10,_("Back"));
- nf_button_font.setDest(screen);
+ nf_button_font.setDest(bBack);
+ nf_button_font.drawCenter(60,10,_("Back"));
+ nf_button_font.setDest(screen);
//Loads the sound if sound present
@@ -1644,10 +1644,19 @@ public:
}
if ((bGameOver)&&(!editorMode))
- if (hasWonTheGame)DrawIMG(iWinner, sBoard, 0, 5*bsize);
- else if (bDraw) DrawIMG(iDraw, sBoard, 0, 5*bsize);
+ {
+ if (hasWonTheGame)
+ {
+ DrawIMG(iWinner, sBoard, 0, 5*bsize);
+ }
else
- DrawIMG(iGameOver, sBoard, 0, 5*bsize);
+ {
+ if (bDraw)
+ DrawIMG(iDraw, sBoard, 0, 5*bsize);
+ else
+ DrawIMG(iGameOver, sBoard, 0, 5*bsize);
+ }
+ }
nf_standard_blue_font.setDest(screen);
}
@@ -2020,8 +2029,6 @@ bool OpenFileDialogbox(int x, int y, char *name)
string homeFolder = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/puzzles";
lf.setDirectory2(homeFolder.c_str());
#endif
- Uint8* keys;
- string strHolder;
MakeBackground(xsize,ysize);
DrawIMG(background,screen,0,0);
DrawIMG(bForward,background,x+460,y+420);
@@ -2107,6 +2114,7 @@ bool OpenFileDialogbox(int x, int y, char *name)
mouse.PaintTo(screen,mousex,mousey);
SDL_Flip(screen); //Update screen
}
+ return true;
}
//Slelect a theme
@@ -2123,8 +2131,6 @@ bool SelectThemeDialogbox(int x, int y, char *name)
string homeFolder = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/themes";
lf.setDirectory2(homeFolder.c_str());
#endif
- Uint8* keys;
- string strHolder;
MakeBackground(xsize,ysize);
DrawIMG(background,screen,0,0);
DrawIMG(bForward,background,x+460,y+420);
@@ -2211,6 +2217,7 @@ bool SelectThemeDialogbox(int x, int y, char *name)
mouse.PaintTo(screen,mousex,mousey);
SDL_Flip(screen); //Update screen
}
+ return true;
}
//Open a saved replay
@@ -2231,8 +2238,6 @@ bool OpenReplayDialogbox(int x, int y, char *name)
lf.setDirectory(directory);
if(verboseLevel)
cout << "Directory sat" << endl;
- Uint8* keys;
- string strHolder;
MakeBackground(xsize,ysize);
DrawIMG(background,screen,0,0);
DrawIMG(bForward,background,x+460,y+420);
@@ -2317,10 +2322,10 @@ bool OpenReplayDialogbox(int x, int y, char *name)
}
}
- //DrawIMG(mouse,screen,mousex,mousey);
mouse.PaintTo(screen,mousex,mousey);
SDL_Flip(screen); //Update screen
}
+ return false;
}
//Draws the balls and explosions
@@ -2625,7 +2630,6 @@ int PuzzleLevelSelect(int Type)
{
const int xplace = 200;
const int yplace = 300;
- Uint8 *keys;
int levelNr, mousex, mousey, oldmousex, oldmousey;
bool levelSelected = false;
bool tempBool;
@@ -2640,10 +2644,11 @@ int PuzzleLevelSelect(int Type)
LoadPuzzleStages();
//Keeps track of background;
- int nowTime=SDL_GetTicks();
+ SDL_GetTicks();
MakeBackground(xsize,ysize);
- if(Type == 0) {
+ if(Type == 0)
+ {
ifstream puzzleFile(puzzleSavePath.c_str(),ios::binary);
if (puzzleFile)
{
@@ -2662,7 +2667,8 @@ int PuzzleLevelSelect(int Type)
}
nrOfLevels = nrOfPuzzles;
}
- if(Type == 1) {
+ if(Type == 1)
+ {
ifstream stageFile(stageClearSavePath.c_str(),ios::binary);
if (stageFile)
{
@@ -2712,9 +2718,9 @@ int PuzzleLevelSelect(int Type)
nrOfLevels = nrOfStageLevels;
}
- do
+ while(!levelSelected)
{
- nowTime=SDL_GetTicks();
+ SDL_GetTicks();
DrawIMG(background, screen, 0, 0);
@@ -2772,7 +2778,7 @@ int PuzzleLevelSelect(int Type)
}
}
- keys = SDL_GetKeyState(NULL);
+ SDL_GetKeyState(NULL);
SDL_GetMouseState(&mousex,&mousey);
if(mousex != oldmousex || mousey != oldmousey)
@@ -2818,7 +2824,7 @@ int PuzzleLevelSelect(int Type)
levelNr = levelClicked;
}
}
-
+
if(Type == 1)
{
string scoreString = _("Best score: 0");
@@ -2840,7 +2846,6 @@ int PuzzleLevelSelect(int Type)
SDL_Flip(screen); //draws it all to the screen
}
- while (!levelSelected);
DrawIMG(background, screen, 0, 0);
return levelNr;
}
@@ -2851,7 +2856,6 @@ void startVsMenu()
{
const int xplace = 200;
const int yplace = 100;
- Uint8 *keys;
int mousex, mousey;
bool done = false;
@@ -2923,6 +2927,7 @@ void startVsMenu()
SDL_Event event;
while ( SDL_PollEvent(&event) )
+ {
if ( event.type == SDL_KEYDOWN )
{
if ( event.key.keysym.sym == SDLK_ESCAPE )
@@ -2938,8 +2943,9 @@ void startVsMenu()
done = true;
}
}
+ }
- keys = SDL_GetKeyState(NULL);
+ SDL_GetKeyState(NULL);
SDL_GetMouseState(&mousex,&mousey);
@@ -3027,7 +3033,7 @@ void changePuzzleLevels()
#if NETWORK
#include "NetworkThing.hpp"
//#include "MenuSystem.h"
- NetworkThing nt;
+NetworkThing nt;
#endif
static BlockGameSdl *player1;
@@ -3266,19 +3272,16 @@ int main(int argc, char *argv[])
SoundEnabled = true;
MusicEnabled = true;
- int mousex, mousey; //Mouse coordinates
showOptions = false;
b1playerOpen = false;
b2playersOpen = false;
bReplayOpen = false;
bScreenLocked = false;
twoPlayers = false; //true if two players splitscreen
- bool vsMode = false;
theTopScoresEndless = Highscore(1);
theTopScoresTimeTrial = Highscore(2);
drawBalls = true;
puzzleLoaded = false;
- bool weWhereConnected = false;
theBallManeger = ballManeger();
theExplosionManeger = explosionManeger();
@@ -3318,10 +3321,6 @@ int main(int argc, char *argv[])
#endif
puzzleName="puzzle.levels";
- Uint8 *keys;
-
-
-
//Init SDL
if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
@@ -3333,7 +3332,6 @@ int main(int argc, char *argv[])
SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
Joypad_init(); //Prepare the joysticks
-
Joypad joypad1 = Joypad(); //Creates a joypad
Joypad joypad2 = Joypad(); //Creates a joypad
@@ -3354,8 +3352,8 @@ int main(int argc, char *argv[])
{
//Copyright notice:
cout << "Block Attack - Rise of the Blocks (" << VERSION_NUMBER << ")" << endl << "http://blockattack.sf.net" << endl << "Copyright 2004-2011 Poul Sander" << endl <<
- "A SDL based game (see www.libsdl.org)" << endl <<
- "The game is availeble under the GPL, see COPYING for details." << endl;
+ "A SDL based game (see www.libsdl.org)" << endl <<
+ "The game is availeble under the GPL, see COPYING for details." << endl;
#if defined(_WIN32)
cout << "Windows build" << endl;
#elif defined(__linux__)
@@ -3528,10 +3526,6 @@ int main(int argc, char *argv[])
strcpy(theGame.name, player1name);
strcpy(theGame2.name, player2name);
- //Keeps track of background;
- int nowTime=SDL_GetTicks();
-
-
#if NETWORK
//NetworkThing nt = NetworkThing();
nt.setBGpointers(&theGame,&theGame2);
@@ -3542,7 +3536,6 @@ int main(int argc, char *argv[])
LoadPuzzleStages();
theGame.NewPuzzleGame(singlePuzzleNr,0,0,SDL_GetTicks());
showGame = true;
- vsMode = true;
}
//Draws everything to screen
if (!editorMode)
@@ -3622,7 +3615,6 @@ int runGame(int gametype, int level)
b2playersOpen = false;
bReplayOpen = false;
bScreenLocked = false;
- bool vsMode = false;
theTopScoresEndless = Highscore(1);
theTopScoresTimeTrial = Highscore(2);
drawBalls = true;
@@ -3660,31 +3652,18 @@ int runGame(int gametype, int level)
BlockGameSdl theGame2 = BlockGameSdl(xsize-500,100);
player1 = &theGame;
player2 = &theGame2;
- /*if (singlePuzzle)
- {
- theGame.GetTopY()=0;
- theGame.GetTopX()=0;
- theGame2.GetTopY()=10000;
- theGame2.GetTopX()=10000;
- }*/
theGame.DoPaintJob(); //Makes sure what there is something to paint
theGame2.DoPaintJob();
theGame.SetGameOver(); //sets the game over in the beginning
theGame2.SetGameOver();
-
//Takes names from file instead
strcpy(theGame.name, player1name);
strcpy(theGame2.name, player2name);
-
Joypad joypad1 = Joypad(); //Creates a joypad
Joypad joypad2 = Joypad(); //Creates a joypad
- //Keeps track of background;
- int nowTime=SDL_GetTicks();
-
-
#if NETWORK
//NetworkThing nt = NetworkThing();
nt.setBGpointers(&theGame,&theGame2);
@@ -3695,7 +3674,6 @@ int runGame(int gametype, int level)
LoadPuzzleStages();
theGame.NewPuzzleGame(singlePuzzleNr,0,0,SDL_GetTicks());
showGame = true;
- vsMode = true;
}
//Draws everything to screen
if (!editorMode)
@@ -3734,7 +3712,6 @@ int runGame(int gametype, int level)
twoPlayers =false;
theGame2.SetGameOver();
showGame = true;
- vsMode = false;
strcpy(theGame.name, player1name);
strcpy(theGame2.name, player2name);
}
@@ -3755,7 +3732,6 @@ int runGame(int gametype, int level)
DrawIMG(background, screen, 0, 0);
twoPlayers = true; //Single player, but AI plays
showGame = true;
- vsMode = true;
theGame2.setAIlevel((Uint8)theAIlevel);
int theTime = time(0);
theGame.putStartBlocks(theTime);
@@ -3957,7 +3933,8 @@ int runGame(int gametype, int level)
*/
mustsetupgame = true;
}
- if ( event.key.keysym.sym == SDLK_F10 ) {
+ if ( event.key.keysym.sym == SDLK_F10 )
+ {
StartReplay("/home/poul/.gamesaves/blockattack/quicksave");
}
if ( event.key.keysym.sym == SDLK_F9 )
@@ -3966,7 +3943,8 @@ int runGame(int gametype, int level)
}
if ( event.key.keysym.sym == SDLK_F5 )
{
- if(theGame.isGameOver() && theGame2.isGameOver()) {
+ if(theGame.isGameOver() && theGame2.isGameOver())
+ {
string filename = "/home/poul/.gamesaves/blockattack/quicksave";
if(!twoPlayers)
theGame.theReplay.saveReplay(filename);
@@ -3979,7 +3957,7 @@ int runGame(int gametype, int level)
/*This is the test place, place function to test here*/
StartReplay("/home/poul/.gamesaves/blockattack/bestTT");
-
+
//theGame.CreateGreyGarbage();
//char mitNavn[30];
//SelectThemeDialogbox(300,400,mitNavn);
@@ -4084,6 +4062,7 @@ int runGame(int gametype, int level)
if (joyplay1||joyplay2)
{
if (joypad1.working && !theGame.GetAIenabled())
+ {
if (joyplay1)
{
joypad1.update();
@@ -4156,7 +4135,9 @@ int runGame(int gametype, int level)
if (joypad1.but2)
theGame2.PushLine();
}
+ }
if (joypad2.working && !theGame2.GetAIenabled())
+ {
if (!joyplay2)
{
joypad2.update();
@@ -4229,6 +4210,7 @@ int runGame(int gametype, int level)
if (joypad2.but2)
theGame2.PushLine();
}
+ }
}
/**********************************************************************
@@ -4244,7 +4226,7 @@ int runGame(int gametype, int level)
**************** Here comes mouse play ******************************
********************************************************************/
- if ((mouseplay1)&&((!editorMode)&&(!theGame.GetAIenabled())||(editorModeTest))) //player 1
+ if ((mouseplay1)&&( ( (!editorMode)&&(!theGame.GetAIenabled()) ) ||(editorModeTest))) //player 1
if ((mousex > 50)&&(mousey>100)&&(mousex<50+300)&&(mousey<100+600))
{
int yLine, xLine;
@@ -4461,4 +4443,5 @@ int runGame(int gametype, int level)
mouse.PaintTo(screen,mousex,mousey);
SDL_Flip(screen);
} //game loop
+ return 0;
}
diff --git a/source/code/mainVars.hpp b/source/code/mainVars.hpp
index 47cf09c..b6fd116 100644
--- a/source/code/mainVars.hpp
+++ b/source/code/mainVars.hpp
@@ -40,7 +40,6 @@ const char sharedir[] = SHAREDIR;
//All graphic in the game (as pointers):
static SDL_Surface *background; //Stores background
SDL_Surface *backgroundImage; //Stores the background image
-static int backgroundImageW, backgroundImageH; //size of background image
static SDL_Surface *backBoard; //Stores the background to the board
//static SDL_Surface *b1player;
//static SDL_Surface *b2players;
@@ -204,8 +203,6 @@ static bool editorModeTest = false;
#if NETWORK
static bool networkPlay;
static bool networkActive;
-static Uint8 nrOfNetworkPlayers; //Up to 4 players (inkl. self)
-static bool playerAlive[4];
//sockets here
#define SERVERPORT 41780
#define CLIENTPORT 41781
diff --git a/source/code/menu/MenuItemCommand.cpp b/source/code/menu/MenuItemCommand.cpp
index 2045d77..cdfb9e2 100644
--- a/source/code/menu/MenuItemCommand.cpp
+++ b/source/code/menu/MenuItemCommand.cpp
@@ -1,45 +1,54 @@
-/*
+/*
* File: MenuItemCommand.cpp
* Author: poul
- *
+ *
* Created on 11. marts 2011, 20:46
*/
#include "MenuItemCommand.hpp"
-MenuItemCommand::MenuItemCommand() {
- selected = false;
+MenuItemCommand::MenuItemCommand()
+{
+ selected = false;
}
-MenuItemCommand::MenuItemCommand(string text, void(*pt2Function)() ) {
- this->text = text;
- command = pt2Function;
- selected = false;
+MenuItemCommand::MenuItemCommand(string text, void(*pt2Function)() )
+{
+ this->text = text;
+ command = pt2Function;
+ selected = false;
}
-MenuItemCommand::MenuItemCommand(const MenuItemCommand& orig) {
+MenuItemCommand::MenuItemCommand(const MenuItemCommand& orig)
+{
}
-MenuItemCommand::~MenuItemCommand() {
+MenuItemCommand::~MenuItemCommand()
+{
}
-void MenuItemCommand::SetSelected(bool selected) {
- this->selected = selected;
+void MenuItemCommand::SetSelected(bool selected)
+{
+ this->selected = selected;
}
-void MenuItemCommand::Activated() {
- //Add execode
- command();
+void MenuItemCommand::Activated()
+{
+ //Add execode
+ command();
}
-string MenuItemCommand::GetType() {
- return "MenuItemCommand";
+string MenuItemCommand::GetType()
+{
+ return "MenuItemCommand";
}
-string MenuItemCommand::GetText() {
- return text;
+string MenuItemCommand::GetText()
+{
+ return text;
}
-void MenuItemCommand::SetText(string text) {
- this->text = text;
+void MenuItemCommand::SetText(string text)
+{
+ this->text = text;
}
\ No newline at end of file
diff --git a/source/code/menudef.cpp b/source/code/menudef.cpp
index 3677d55..7ebcc3c 100644
--- a/source/code/menudef.cpp
+++ b/source/code/menudef.cpp
@@ -133,22 +133,22 @@ static void runSinglePlayerVs(Button* b)
runGame(4,b->iGeneric1);
}
-static void runTwoPlayerTimeTrial(Button* b)
+static void runTwoPlayerTimeTrial(Button* b)
{
runGame(10,0);
}
-static void runTwoPlayerVs(Button* b)
+static void runTwoPlayerVs(Button* b)
{
runGame(11,0);
}
-static void runHostGame(Button* b)
+static void runHostGame(Button* b)
{
runGame(12,0);
}
-static void runJoinGame(Button* b)
+static void runJoinGame(Button* b)
{
runGame(13,0);
}
@@ -188,7 +188,7 @@ static void buttonActionPortChange(Button *b)
{
char port[30];
snprintf(port,sizeof(port),"%i",Config::getInstance()->getInt("portv4") );
- if (OpenDialogbox(200,100,port) && atoi(port))
+ if (OpenDialogbox(200,100,port) && atoi(port))
{
Config::getInstance()->setInt("portv4",atoi(port));
format f(_("Port: %1%") );
@@ -201,7 +201,7 @@ static void buttonActionIpChange(Button *b)
{
char ip[30];
snprintf(ip,sizeof(ip),"%s",Config::getInstance()->getString("address0").c_str() );
- if (OpenDialogbox(200,100,ip))
+ if (OpenDialogbox(200,100,ip))
{
Config::getInstance()->setString("address0",ip);
format f(_("Address: %1%") );
@@ -272,7 +272,7 @@ static void ConfigureMenu(Button *b)
cm.run();
}
-static void SinglePlayerVsMenu(Button *b)
+static void SinglePlayerVsMenu(Button *b)
{
Menu spvs(&screen,_("Single player VS"),true);
Button d1,d2,d3,d4,d5,d6,d7;
@@ -314,7 +314,7 @@ static void SinglePlayerVsMenu(Button *b)
spvs.run();
}
-static void NetworkMenu(Button *b)
+static void NetworkMenu(Button *b)
{
Menu nm(&screen,_("Network"),true);
Button bPort, bIp, bHost, bJoin;
@@ -335,10 +335,10 @@ static void NetworkMenu(Button *b)
nm.addButton(&bIp);
nm.addButton(&bPort);
nm.run();
-
+
}
-static void MultiplayerMenu(Button *b)
+static void MultiplayerMenu(Button *b)
{
Menu mm(&screen,_("Multiplayer"),true);
Button bTT, bVs, bNet;
diff --git a/source/code/replay.cpp b/source/code/replay.cpp
index 33ee750..7fe4ad2 100644
--- a/source/code/replay.cpp
+++ b/source/code/replay.cpp
@@ -61,7 +61,8 @@ bool Replay::saveReplay(string filename)
{
saveFile << "0 16 PLAYER 1\n";
saveFile << "0 16 NAME " << name << "\n";
- for(int i = 0;i < actions.size(); ++i) {
+ for(int i = 0; i < actions.size(); ++i)
+ {
saveFile << actions.at(i).time << " " << actions.at(i).action << " " << actions.at(i).param << "\n";
}
saveFile.close();
@@ -84,12 +85,14 @@ bool Replay::saveReplay(string filename,Replay p2)
{
saveFile << "0 16 PLAYER 1\n";
saveFile << "0 16 NAME " << name << "\n";
- for(int i = 0;i < actions.size(); ++i) {
+ for(int i = 0; i < actions.size(); ++i)
+ {
saveFile << actions.at(i).time << " " << actions.at(i).action << " " << actions.at(i).param << "\n";
}
saveFile << "0 16 PLAYER 2\n";
saveFile << "0 16 NAME " << name << "\n";
- for(int i = 0;i < p2.getActions().size(); ++i) {
+ for(int i = 0; i < p2.getActions().size(); ++i)
+ {
saveFile << p2.getActions().at(i).time << " " << p2.getActions().at(i).action << " " << p2.getActions().at(i).param << "\n";
}
saveFile.close();
@@ -109,7 +112,8 @@ bool Replay::loadReplay(string filename)
loadFile.open(filename.c_str());
if (loadFile)
{
- while(!loadFile.eof()) {
+ while(!loadFile.eof())
+ {
Sint32 time;
Uint32 action;
string restOfLine;
@@ -120,12 +124,14 @@ bool Replay::loadReplay(string filename)
loadFile >> command;
if(command == "NAME")
getline(loadFile,name,'\n');
- if(command == "PLAYER") {
+ if(command == "PLAYER")
+ {
getline(loadFile,restOfLine,'\n');
if(restOfLine != " 1")
break;
}
- } else
+ }
+ else
{
getline(loadFile,restOfLine,'\n');
Action a;
@@ -137,7 +143,7 @@ bool Replay::loadReplay(string filename)
a.param = "";
actions.push_back(a);
}
-
+
}
loadFile.close();
if(verboseLevel)
@@ -160,7 +166,8 @@ bool Replay::loadReplay2(string filename)
loadFile.open(filename.c_str());
if (loadFile)
{
- while(!loadFile.eof()) {
+ while(!loadFile.eof())
+ {
Sint32 time;
Uint32 action;
string restOfLine;
@@ -171,12 +178,14 @@ bool Replay::loadReplay2(string filename)
loadFile >> command;
if(command == "NAME")
getline(loadFile,name,'\n');
- if(command == "PLAYER") {
+ if(command == "PLAYER")
+ {
getline(loadFile,restOfLine,'\n');
if(restOfLine == " 2")
player2started = true;
}
- } else
+ }
+ else
{
getline(loadFile,restOfLine,'\n');
if(!player2started)
@@ -190,7 +199,7 @@ bool Replay::loadReplay2(string filename)
a.param = "";
actions.push_back(a);
}
-
+
}
loadFile.close();
if(verboseLevel)
@@ -214,11 +223,12 @@ string Replay::getName() const
return name;
}
-vector<Action> Replay::getActions() const {
+vector<Action> Replay::getActions() const
+{
return actions;
}
-void Replay::addAction(int tick, int action, string param)
+void Replay::addAction(int tick, int action, string param)
{
#if DEBUG
cout << tick << " " << action << " " << param << endl;
diff --git a/source/code/replay.h b/source/code/replay.h
index 8237a4a..5c2402c 100644
--- a/source/code/replay.h
+++ b/source/code/replay.h
@@ -41,7 +41,7 @@ using namespace std;
struct Action
{
- Sint32 time;
+ Uint32 time;
Sint32 action;
string param;
};