03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

{<br />

public:<br />

public:<br />

// Square state, similar to TShip::TShipType<br />

enum TSquareState<br />

{<br />

EUnknown, ESea,<br />

EBattleship, ECruiser, EDestroyer, EFrigate,<br />

EHit=0x80<br />

};<br />

// Setup<br />

TFleet();<br />

void SetupBlank();<br />

void SetupRandom();<br />

void SetMyFleet();<br />

void SetOppFleet();<br />

// Interrogators<br />

TBool IsMyFleet() const;<br />

TBool IsOppFleet() const;<br />

TBool IsShip(TInt aX, TInt aY) const;<br />

TShip::TShipType ShipType(TInt aX, TInt aY) const;<br />

TBool IsSea(TInt aX, TInt aY) const;<br />

TBool IsKnown(TInt aX, TInt aY) const;<br />

TBool IsHit(TInt aX, TInt aY) const;<br />

// Complicated interrogators<br />

TShip& ShipAt(TInt aX, TInt aY) const; // Use for my fleet only<br />

TShip* PossibleShipAt(TInt aX, TInt aY) const; // Use even if<br />

fleet<br />

unknown<br />

TInt RemainingSquares() const; // Fleet squares that haven't<br />

been<br />

destroyed<br />

TInt RemainingShips() const; // Ships that haven't been totally<br />

destroyed<br />

TInt SquaresHit() const; // Squares hit (sea or otherwise)<br />

// Change<br />

void SetSea(TInt aX, TInt aY); // Say a square is sea<br />

void SetShipType(TInt aX, TInt aY, TShip::TShipType aShipType);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!