git repos / blockattack-game

blame: source/code/BlockGame.hpp

normal view · raw

89c4a3a6 sago007 2008-08-29 14:32 1
/*
c53e6443 sago007 2012-04-17 11:04 2
===========================================================================
c53e6443 sago007 2012-04-17 11:04 3
blockattack - Block Attack - Rise of the Blocks
c53e6443 sago007 2012-04-17 11:04 4
Copyright (C) 2005-2012 Poul Sander
c53e6443 sago007 2012-04-17 11:04 5
c53e6443 sago007 2012-04-17 11:04 6
This program is free software: you can redistribute it and/or modify
c53e6443 sago007 2012-04-17 11:04 7
it under the terms of the GNU General Public License as published by
c53e6443 sago007 2012-04-17 11:04 8
the Free Software Foundation, either version 2 of the License, or
c53e6443 sago007 2012-04-17 11:04 9
(at your option) any later version.
c53e6443 sago007 2012-04-17 11:04 10
c53e6443 sago007 2012-04-17 11:04 11
This program is distributed in the hope that it will be useful,
c53e6443 sago007 2012-04-17 11:04 12
but WITHOUT ANY WARRANTY; without even the implied warranty of
c53e6443 sago007 2012-04-17 11:04 13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c53e6443 sago007 2012-04-17 11:04 14
GNU General Public License for more details.
c53e6443 sago007 2012-04-17 11:04 15
c53e6443 sago007 2012-04-17 11:04 16
You should have received a copy of the GNU General Public License
c53e6443 sago007 2012-04-17 11:04 17
along with this program.  If not, see http://www.gnu.org/licenses/
c53e6443 sago007 2012-04-17 11:04 18
c53e6443 sago007 2012-04-17 11:04 19
Source information and contacts persons can be found at
c53e6443 sago007 2012-04-17 11:04 20
http://blockattack.sf.net
c53e6443 sago007 2012-04-17 11:04 21
===========================================================================
c53e6443 sago007 2012-04-17 11:04 22
*/
89c4a3a6 sago007 2008-08-29 14:32 23
17916a2e sago007 2010-11-07 11:26 24
#ifndef BLOCKGAME_HPP
17916a2e sago007 2010-11-07 11:26 25
#define BLOCKGAME_HPP 1
17916a2e sago007 2010-11-07 11:26 26
32c9b349 sago007 2008-11-20 18:14 27
#include "stats.h"
32c9b349 sago007 2008-11-20 18:14 28
#include "common.h"
17916a2e sago007 2010-11-07 11:26 29
#include "SDL.h"
17916a2e sago007 2010-11-07 11:26 30
#include "replay.h"
17916a2e sago007 2010-11-07 11:26 31
17916a2e sago007 2010-11-07 11:26 32
17916a2e sago007 2010-11-07 11:26 33
//Some definitions
17916a2e sago007 2010-11-07 11:26 34
//The game is divided in frames. FALLTIME means the blocks will fall one block every FRAMELENGTH*FALLTIME millisecond
17916a2e sago007 2010-11-07 11:26 35
#define FRAMELENGTH 50
17916a2e sago007 2010-11-07 11:26 36
#define HANGTIME 40
17916a2e sago007 2010-11-07 11:26 37
#define FALLTIME 20
17916a2e sago007 2010-11-07 11:26 38
//Don't change the following, they are fundamental and later some functions are hardcoded
17916a2e sago007 2010-11-07 11:26 39
#define BLOCKFALL 10000
17916a2e sago007 2010-11-07 11:26 40
#define BLOCKWAIT 100000
17916a2e sago007 2010-11-07 11:26 41
#define BLOCKHANG 1000
17916a2e sago007 2010-11-07 11:26 42
#define GARBAGE 1000000
17916a2e sago007 2010-11-07 11:26 43
#define CHAINPLACE 10000000
17916a2e sago007 2010-11-07 11:26 44
#define NUMBEROFCHAINS 100
32c9b349 sago007 2008-11-20 18:14 45
89c4a3a6 sago007 2008-08-29 14:32 46
////////////////////////////////////////////////////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 47
//The BloackGame class represents a board, score, time etc. for a single player/
89c4a3a6 sago007 2008-08-29 14:32 48
////////////////////////////////////////////////////////////////////////////////
c53e6443 sago007 2012-04-17 11:04 49
class BlockGame
c53e6443 sago007 2012-04-17 11:04 50
{
89c4a3a6 sago007 2008-08-29 14:32 51
private:
c53e6443 sago007 2012-04-17 11:04 52
	int prevTowerHeight;
c53e6443 sago007 2012-04-17 11:04 53
	bool bGarbageFallLeft;
89c4a3a6 sago007 2008-08-29 14:32 54
c53e6443 sago007 2012-04-17 11:04 55
	Uint32 nextGarbageNumber;
c53e6443 sago007 2012-04-17 11:04 56
	Uint32 pushedPixelAt;
c53e6443 sago007 2012-04-17 11:04 57
	Uint32 nrPushedPixel, nrFellDown, nrStops;
c53e6443 sago007 2012-04-17 11:04 58
	bool garbageToBeCleared[7][30];
c53e6443 sago007 2012-04-17 11:04 59
	Uint32 lastAImove;
89c4a3a6 sago007 2008-08-29 14:32 60
c53e6443 sago007 2012-04-17 11:04 61
	Sint16 AI_LineOffset; //how many lines have changed since command
c53e6443 sago007 2012-04-17 11:04 62
	Uint32 hangTicks;    //How many times have hang been decreased?
c53e6443 sago007 2012-04-17 11:04 63
	//int the two following index 0 may NOT be used (what the fuck did I meen?)
c53e6443 sago007 2012-04-17 11:04 64
	Uint8 chainSize[NUMBEROFCHAINS]; //Contains the chains
c53e6443 sago007 2012-04-17 11:04 65
	bool chainUsed[NUMBEROFCHAINS];   //True if the chain is used
89c4a3a6 sago007 2008-08-29 14:32 66
c53e6443 sago007 2012-04-17 11:04 67
	Uint32 nextRandomNumber;
89c4a3a6 sago007 2008-08-29 14:32 68
c53e6443 sago007 2012-04-17 11:04 69
	Uint16 rand2();
c53e6443 sago007 2012-04-17 11:04 70
	int firstUnusedChain();
89c4a3a6 sago007 2008-08-29 14:32 71
e1290bdf sago007 2010-10-25 19:56 72
//public:
6b1dc7a6 sago007 2010-11-08 21:03 73
protected:
c53e6443 sago007 2012-04-17 11:04 74
	int lastCounter;
c53e6443 sago007 2012-04-17 11:04 75
	string strHolder;
c53e6443 sago007 2012-04-17 11:04 76
	bool bDraw;
c53e6443 sago007 2012-04-17 11:04 77
	bool bReplaying; //true if we are watching a replay
c53e6443 sago007 2012-04-17 11:04 78
#if NETWORK
c53e6443 sago007 2012-04-17 11:04 79
	bool bNetworkPlayer; //must recieve packages from the net
c53e6443 sago007 2012-04-17 11:04 80
	bool bDisconnected; //The player has disconnected
c53e6443 sago007 2012-04-17 11:04 81
#endif
c53e6443 sago007 2012-04-17 11:04 82
	unsigned int ticks;
c53e6443 sago007 2012-04-17 11:04 83
	Uint32 gameStartedAt;
c53e6443 sago007 2012-04-17 11:04 84
	Uint32 gameEndedAfter;		//How long did the game last?
c53e6443 sago007 2012-04-17 11:04 85
	int linesCleared;
c53e6443 sago007 2012-04-17 11:04 86
	int TowerHeight;
c53e6443 sago007 2012-04-17 11:04 87
	BlockGame *garbageTarget;
c53e6443 sago007 2012-04-17 11:04 88
	Sint32 board[7][30];
c53e6443 sago007 2012-04-17 11:04 89
	int stop;
c53e6443 sago007 2012-04-17 11:04 90
	int speedLevel;
c53e6443 sago007 2012-04-17 11:04 91
	int pixels;
c53e6443 sago007 2012-04-17 11:04 92
	int MovesLeft;
c53e6443 sago007 2012-04-17 11:04 93
	bool timetrial, stageClear, vsMode, puzzleMode;
c53e6443 sago007 2012-04-17 11:04 94
	int Level; //Only used in stageClear and puzzle (not implemented)
c53e6443 sago007 2012-04-17 11:04 95
	int stageClearLimit; //stores number of lines user must clear to win
c53e6443 sago007 2012-04-17 11:04 96
	int topx, topy;
c53e6443 sago007 2012-04-17 11:04 97
	int combo;
c53e6443 sago007 2012-04-17 11:04 98
	int chain;
c53e6443 sago007 2012-04-17 11:04 99
	int cursorx; //stores cursor position
c53e6443 sago007 2012-04-17 11:04 100
	int cursory; // -||-
c53e6443 sago007 2012-04-17 11:04 101
	double speed, baseSpeed; //factor for speed. Lower value = faster gameplay
c53e6443 sago007 2012-04-17 11:04 102
	Uint32 score;
c53e6443 sago007 2012-04-17 11:04 103
	bool bGameOver;
c53e6443 sago007 2012-04-17 11:04 104
	bool hasWonTheGame;
c53e6443 sago007 2012-04-17 11:04 105
	int AI_MoveSpeed;   //How often will the computer move? milliseconds
c53e6443 sago007 2012-04-17 11:04 106
	bool AI_Enabled;
c53e6443 sago007 2012-04-17 11:04 107
c53e6443 sago007 2012-04-17 11:04 108
	Uint32 handicap;
c53e6443 sago007 2012-04-17 11:04 109
c53e6443 sago007 2012-04-17 11:04 110
c53e6443 sago007 2012-04-17 11:04 111
	int AIlineToClear;
c53e6443 sago007 2012-04-17 11:04 112
c53e6443 sago007 2012-04-17 11:04 113
	short AIstatus;   //Status flags:
c53e6443 sago007 2012-04-17 11:04 114
	//0: nothing, 2: clear tower, 3: clear horisontal, 4: clear vertical
c53e6443 sago007 2012-04-17 11:04 115
	//1: make more lines, 5: make 2 lines, 6: make 1 line
6b1dc7a6 sago007 2010-11-08 21:03 116
e1290bdf sago007 2010-10-25 19:56 117
public:
c53e6443 sago007 2012-04-17 11:04 118
c53e6443 sago007 2012-04-17 11:04 119
	char name[30];
c53e6443 sago007 2012-04-17 11:04 120
	Replay theReplay;   //Stores the replay
c53e6443 sago007 2012-04-17 11:04 121
c53e6443 sago007 2012-04-17 11:04 122
	//Constructor
c53e6443 sago007 2012-04-17 11:04 123
	BlockGame();
c53e6443 sago007 2012-04-17 11:04 124
c53e6443 sago007 2012-04-17 11:04 125
	//Deconstructor, never really used... game used to crash when called, cause of the way sBoard was created
c53e6443 sago007 2012-04-17 11:04 126
	//It should work now and can be used if we want to assign more players in network games that we need to free later
c53e6443 sago007 2012-04-17 11:04 127
	~BlockGame();
c53e6443 sago007 2012-04-17 11:04 128
c53e6443 sago007 2012-04-17 11:04 129
	void setGameSpeed(Uint8 globalSpeedLevel);
c53e6443 sago007 2012-04-17 11:04 130
	void setHandicap(Uint8 globalHandicap);
c53e6443 sago007 2012-04-17 11:04 131
	//Set the move speed of the AI based on the aiLevel parameter
c53e6443 sago007 2012-04-17 11:04 132
	//Also enables AI
c53e6443 sago007 2012-04-17 11:04 133
	void setAIlevel(Uint8 aiLevel);
c53e6443 sago007 2012-04-17 11:04 134
	Uint8 getAIlevel();
c53e6443 sago007 2012-04-17 11:04 135
c53e6443 sago007 2012-04-17 11:04 136
	int GetScore();
c53e6443 sago007 2012-04-17 11:04 137
	int GetHandicap();
c53e6443 sago007 2012-04-17 11:04 138
	bool isGameOver();
c53e6443 sago007 2012-04-17 11:04 139
	int GetTopX();
c53e6443 sago007 2012-04-17 11:04 140
	int GetTopY();
c53e6443 sago007 2012-04-17 11:04 141
	unsigned int GetGameStartedAt();
c53e6443 sago007 2012-04-17 11:04 142
	unsigned int GetGameEndedAt();
c53e6443 sago007 2012-04-17 11:04 143
	bool isTimeTrial();
c53e6443 sago007 2012-04-17 11:04 144
	bool isStageClear();
c53e6443 sago007 2012-04-17 11:04 145
	bool isVsMode();
c53e6443 sago007 2012-04-17 11:04 146
	bool isPuzzleMode();
c53e6443 sago007 2012-04-17 11:04 147
	int GetLinesCleared();
c53e6443 sago007 2012-04-17 11:04 148
	int GetStageClearLimit();
c53e6443 sago007 2012-04-17 11:04 149
	int GetChains();
c53e6443 sago007 2012-04-17 11:04 150
	int GetPixels();
c53e6443 sago007 2012-04-17 11:04 151
	int GetSpeedLevel();
c53e6443 sago007 2012-04-17 11:04 152
	int GetTowerHeight();
c53e6443 sago007 2012-04-17 11:04 153
	int GetCursorX();
c53e6443 sago007 2012-04-17 11:04 154
	int GetCursorY();
c53e6443 sago007 2012-04-17 11:04 155
	void MoveCursorTo(int x, int y);
c53e6443 sago007 2012-04-17 11:04 156
	bool GetIsWinner();
e1290bdf sago007 2010-10-25 19:56 157
private:
91886cae sago007 2008-09-12 16:28 158
#if NETWORK
89c4a3a6 sago007 2008-08-29 14:32 159
#define garbageStackSize 10
c53e6443 sago007 2012-04-17 11:04 160
	Uint8 garbageStack[garbageStackSize][3]; //A garbage stack with space for 10 garbage blocks. 0=x,1=y,2=type
c53e6443 sago007 2012-04-17 11:04 161
	int garbageStackUsed;
89c4a3a6 sago007 2008-08-29 14:32 162
c53e6443 sago007 2012-04-17 11:04 163
	void emptyGarbageStack();
c53e6443 sago007 2012-04-17 11:04 164
	bool pushGarbage(Uint8 width, Uint8 height, Uint8 type);
e1290bdf sago007 2010-10-25 19:56 165
public:
c53e6443 sago007 2012-04-17 11:04 166
	bool popGarbage(Uint8 *width, Uint8 *height, Uint8 *type);
e1290bdf sago007 2010-10-25 19:56 167
private:
89c4a3a6 sago007 2008-08-29 14:32 168
89c4a3a6 sago007 2008-08-29 14:32 169
#endif
89c4a3a6 sago007 2008-08-29 14:32 170
89c4a3a6 sago007 2008-08-29 14:32 171
e1290bdf sago007 2010-10-25 19:56 172
public:
c53e6443 sago007 2012-04-17 11:04 173
	//Instead of creating new object new game is called, to prevent memory leaks
c53e6443 sago007 2012-04-17 11:04 174
	void NewGame(int tx, int ty, unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 175
	void NewTimeTrialGame(int x,int y, unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 176
	//Starts a new stage game, takes level as input!
c53e6443 sago007 2012-04-17 11:04 177
	void NewStageGame(int level, int tx, int ty,unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 178
	void NewPuzzleGame(int level, int tx, int ty, unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 179
	//Replay the current level
c53e6443 sago007 2012-04-17 11:04 180
	void retryLevel(unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 181
	//Play the next level
c53e6443 sago007 2012-04-17 11:04 182
	void nextLevel(unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 183
	//Starts new Vs Game (two Player)
c53e6443 sago007 2012-04-17 11:04 184
	void NewVsGame(int tx, int ty, BlockGame *target,unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 185
	//Starts new Vs Game (two Player)
c53e6443 sago007 2012-04-17 11:04 186
	void NewVsGame(int tx, int ty, BlockGame *target, bool AI,unsigned int ticks);
e1290bdf sago007 2010-10-25 19:56 187
private:
c53e6443 sago007 2012-04-17 11:04 188
	//Go in Demonstration mode, no movement
c53e6443 sago007 2012-04-17 11:04 189
	void Demonstration(bool toggle);
e1290bdf sago007 2010-10-25 19:56 190
public:
c53e6443 sago007 2012-04-17 11:04 191
	//We want to play the replay (must have been loaded beforehand)
c53e6443 sago007 2012-04-17 11:04 192
	void playReplay(int tx, int ty, unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 193
#if NETWORK
c53e6443 sago007 2012-04-17 11:04 194
	//network play
c53e6443 sago007 2012-04-17 11:04 195
	void playNetwork(int tx, int ty,unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 196
#endif
c53e6443 sago007 2012-04-17 11:04 197
	//Prints "winner" and ends game
c53e6443 sago007 2012-04-17 11:04 198
	void setPlayerWon();
c53e6443 sago007 2012-04-17 11:04 199
	//void SetGameOver();
c53e6443 sago007 2012-04-17 11:04 200
91886cae sago007 2008-09-12 16:28 201
#if NETWORK
c53e6443 sago007 2012-04-17 11:04 202
	//Sets disconnected:
c53e6443 sago007 2012-04-17 11:04 203
	void setDisconnect();
89c4a3a6 sago007 2008-08-29 14:32 204
#endif
c53e6443 sago007 2012-04-17 11:04 205
	//Prints "draw" and ends the game
c53e6443 sago007 2012-04-17 11:04 206
	void setDraw();
c53e6443 sago007 2012-04-17 11:04 207
	//Function to get a boardpackage
c53e6443 sago007 2012-04-17 11:04 208
	boardPackage getPackage();
c53e6443 sago007 2012-04-17 11:04 209
	//Takes a package and sets the board like it
c53e6443 sago007 2012-04-17 11:04 210
	void setBoard(boardPackage bp);
e1290bdf sago007 2010-10-25 19:56 211
private:
c53e6443 sago007 2012-04-17 11:04 212
	//Test if LineNr is an empty line, returns false otherwise.
c53e6443 sago007 2012-04-17 11:04 213
	bool LineEmpty(int lineNr);
c53e6443 sago007 2012-04-17 11:04 214
	//Test if the entire board is empty (used for Puzzles)
c53e6443 sago007 2012-04-17 11:04 215
	bool BoardEmpty();
c53e6443 sago007 2012-04-17 11:04 216
	//Anything that the user can't move? In that case Game Over cannot occur
c53e6443 sago007 2012-04-17 11:04 217
	bool hasStaticContent();
c53e6443 sago007 2012-04-17 11:04 218
	void putStartBlocks();
e1290bdf sago007 2010-10-25 19:56 219
public:
c53e6443 sago007 2012-04-17 11:04 220
	void putStartBlocks(Uint32 n);
e1290bdf sago007 2010-10-25 19:56 221
private:
c53e6443 sago007 2012-04-17 11:04 222
	//decreases hang for all hanging blocks and wait for waiting blocks
c53e6443 sago007 2012-04-17 11:04 223
	void ReduceStuff();
e1290bdf sago007 2010-10-25 19:56 224
public:
c53e6443 sago007 2012-04-17 11:04 225
	//Creates garbage using a given wide and height
c53e6443 sago007 2012-04-17 11:04 226
	bool CreateGarbage(int wide, int height);
c53e6443 sago007 2012-04-17 11:04 227
	//Creates garbage using a given wide and height
c53e6443 sago007 2012-04-17 11:04 228
	bool CreateGreyGarbage();
e1290bdf sago007 2010-10-25 19:56 229
private:
c53e6443 sago007 2012-04-17 11:04 230
	//Clears garbage, must take one the lower left corner!
c53e6443 sago007 2012-04-17 11:04 231
	int GarbageClearer(int x, int y, int number, bool aLineToClear, int chain);
c53e6443 sago007 2012-04-17 11:04 232
	//Marks garbage that must be cleared
c53e6443 sago007 2012-04-17 11:04 233
	int GarbageMarker(int x, int y);
c53e6443 sago007 2012-04-17 11:04 234
	int FirstGarbageMarker(int x, int y);
c53e6443 sago007 2012-04-17 11:04 235
	//Clear Blocks if 3 or more is alligned (naive implemented)
c53e6443 sago007 2012-04-17 11:04 236
	void ClearBlocks();
e1290bdf sago007 2010-10-25 19:56 237
public:
c53e6443 sago007 2012-04-17 11:04 238
	//prints "Game Over" and ends game
c53e6443 sago007 2012-04-17 11:04 239
	void SetGameOver();
c53e6443 sago007 2012-04-17 11:04 240
	bool GetAIenabled();
e1290bdf sago007 2010-10-25 19:56 241
private:
c53e6443 sago007 2012-04-17 11:04 242
	//Moves all peaces a spot down if possible
c53e6443 sago007 2012-04-17 11:04 243
	int FallBlock(int x, int y, int number);
c53e6443 sago007 2012-04-17 11:04 244
	//Makes all Garbage fall one spot
c53e6443 sago007 2012-04-17 11:04 245
	void GarbageFall();
c53e6443 sago007 2012-04-17 11:04 246
	//Makes the blocks fall (it doesn't test time, this must be done before hand)
c53e6443 sago007 2012-04-17 11:04 247
	void FallDown();
e1290bdf sago007 2010-10-25 19:56 248
public:
c53e6443 sago007 2012-04-17 11:04 249
	//Moves the cursor, receaves N,S,E or W as a char an moves as desired
c53e6443 sago007 2012-04-17 11:04 250
	void MoveCursor(char way);
c53e6443 sago007 2012-04-17 11:04 251
	//switches the two blocks at the cursor position, unless game over
c53e6443 sago007 2012-04-17 11:04 252
	void SwitchAtCursor();
c53e6443 sago007 2012-04-17 11:04 253
	//Generates a new line and moves the field one block up (restart puzzle mode)
c53e6443 sago007 2012-04-17 11:04 254
	void PushLine();
e1290bdf sago007 2010-10-25 19:56 255
private:
c53e6443 sago007 2012-04-17 11:04 256
	//Pushes a single pixel, so it appears to scrool
c53e6443 sago007 2012-04-17 11:04 257
	void PushPixels();
c53e6443 sago007 2012-04-17 11:04 258
	//See how high the tower is, saved in integer TowerHeight
c53e6443 sago007 2012-04-17 11:04 259
	void FindTowerHeight();
89c4a3a6 sago007 2008-08-29 14:32 260
///////////////////////////////////////////////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 261
/////////////////////////// AI starts here! ///////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 262
///////////////////////////////////////////////////////////////////////////
c53e6443 sago007 2012-04-17 11:04 263
	//First the helpet functions:
c53e6443 sago007 2012-04-17 11:04 264
	int nrOfType(int line, int type);
c53e6443 sago007 2012-04-17 11:04 265
	int AIcolorToClear;
c53e6443 sago007 2012-04-17 11:04 266
	//See if a combo can be made in this line
c53e6443 sago007 2012-04-17 11:04 267
	int horiInLine(int line);
c53e6443 sago007 2012-04-17 11:04 268
	bool horiClearPossible();
c53e6443 sago007 2012-04-17 11:04 269
	//the Line Has Unmoveable Objects witch might stall the AI
c53e6443 sago007 2012-04-17 11:04 270
	bool lineHasGarbage(int line);
c53e6443 sago007 2012-04-17 11:04 271
	//Types 0..6 in line
c53e6443 sago007 2012-04-17 11:04 272
	int nrOfRealTypes(int line);
c53e6443 sago007 2012-04-17 11:04 273
	//See if there is a tower
c53e6443 sago007 2012-04-17 11:04 274
	bool ThereIsATower();
c53e6443 sago007 2012-04-17 11:04 275
	double firstInLine1(int line);
c53e6443 sago007 2012-04-17 11:04 276
	//returns the first coordinate of the block of type
c53e6443 sago007 2012-04-17 11:04 277
	double firstInLine(int line, int type);
c53e6443 sago007 2012-04-17 11:04 278
	//There in the line shall we move
c53e6443 sago007 2012-04-17 11:04 279
	int closestTo(int line, int place);
c53e6443 sago007 2012-04-17 11:04 280
	//The AI will remove a tower
c53e6443 sago007 2012-04-17 11:04 281
	void AI_ClearTower();
c53e6443 sago007 2012-04-17 11:04 282
	//The AI will try to clear block horisontally
c53e6443 sago007 2012-04-17 11:04 283
	void AI_ClearHori();
c53e6443 sago007 2012-04-17 11:04 284
	//Test if vertical clear is possible
c53e6443 sago007 2012-04-17 11:04 285
	bool veriClearPossible();
c53e6443 sago007 2012-04-17 11:04 286
	//There in the line shall we move
c53e6443 sago007 2012-04-17 11:04 287
	int closestTo(int line, int type, int place);
c53e6443 sago007 2012-04-17 11:04 288
	//The AI will try to clear blocks vertically
c53e6443 sago007 2012-04-17 11:04 289
	void AI_ClearVertical();
c53e6443 sago007 2012-04-17 11:04 290
	bool firstLineCreated;
c53e6443 sago007 2012-04-17 11:04 291
	void AI_Move();
89c4a3a6 sago007 2008-08-29 14:32 292
//////////////////////////////////////////////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 293
///////////////////////////// AI ends here! //////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 294
//////////////////////////////////////////////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 295
e1290bdf sago007 2010-10-25 19:56 296
private:
e1290bdf sago007 2010-10-25 19:56 297
c53e6443 sago007 2012-04-17 11:04 298
	//Updates evrything, if not called nothing happends
c53e6443 sago007 2012-04-17 11:04 299
	void Update();
e1290bdf sago007 2010-10-25 19:56 300
public:
c53e6443 sago007 2012-04-17 11:04 301
	void Update(int newtick);
17916a2e sago007 2010-11-07 11:26 302
};
89c4a3a6 sago007 2008-08-29 14:32 303
////////////////////////////////////////////////////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 304
///////////////////////// BlockAttack class end ////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 305
////////////////////////////////////////////////////////////////////////////////
17916a2e sago007 2010-11-07 11:26 306
17916a2e sago007 2010-11-07 11:26 307
#endif
1970-01-01 00:00 308