git.ucc.asn.au
/
progcomp2012.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Script to playback and save videos of games
[progcomp2012.git]
/
judge
/
manager
/
stratego.cpp
diff --git
a/judge/manager/stratego.cpp
b/judge/manager/stratego.cpp
index
e142a4b
..
0e299cb
100644
(file)
--- a/
judge/manager/stratego.cpp
+++ b/
judge/manager/stratego.cpp
@@
-157,7
+157,7
@@
void Board::Print(FILE * stream, const Piece::Colour & reveal)
* @param stream - the stream to print information to
* @param reveal - Pieces matching this colour will have their identify revealed, other pieces will be shown as '#'
*/
* @param stream - the stream to print information to
* @param reveal - Pieces matching this colour will have their identify revealed, other pieces will be shown as '#'
*/
-void Board::PrintPretty(FILE * stream, const Piece::Colour & reveal)
+void Board::PrintPretty(FILE * stream, const Piece::Colour & reveal
, bool showRevealed
)
{
for (int y=0; y < height; ++y)
{
{
for (int y=0; y < height; ++y)
{
@@
-168,7
+168,8
@@
void Board::PrintPretty(FILE * stream, const Piece::Colour & reveal)
{
fprintf(stream, ".");
}
{
fprintf(stream, ".");
}
- else if (piece->colour != Piece::NONE && (piece->colour == reveal || reveal == Piece::BOTH))
+ else if ((piece->colour != Piece::NONE && (piece->colour == reveal || reveal == Piece::BOTH))
+ || (piece->beenRevealed && showRevealed))
{
switch (piece->colour)
{
{
switch (piece->colour)
{
@@
-233,7
+234,7
@@
void Board::Draw(const Piece::Colour & reveal, bool showRevealed)
}
Graphics::ClearScreen();
}
Graphics::ClearScreen();
-
+ float scale = (float)(Piece::textures[(int)(Piece::NOTHING)].width()) / (float)(GRID_SIZE);
for (int y=0; y < height; ++y)
{
for (int x=0; x < width; ++x)
for (int y=0; y < height; ++y)
{
for (int x=0; x < width; ++x)
@@
-248,7
+249,8
@@
void Board::Draw(const Piece::Colour & reveal, bool showRevealed)
|| (piece->beenRevealed && showRevealed))
{
//Display the piece
|| (piece->beenRevealed && showRevealed))
{
//Display the piece
- Piece::textures[(int)(piece->type)].DrawColour(x*32,y*32,0,1, Piece::GetGraphicsColour(piece->colour));
+
+ Piece::textures[(int)(piece->type)].DrawColour(x*GRID_SIZE*scale,y*GRID_SIZE*scale,0,scale, Piece::GetGraphicsColour(piece->colour));
}
else
}
else
@@
-256,16
+258,16
@@
void Board::Draw(const Piece::Colour & reveal, bool showRevealed)
switch (piece->colour)
{
case Piece::RED:
switch (piece->colour)
{
case Piece::RED:
- Piece::textures[(int)(Piece::NOTHING)].DrawColour(x*
32,y*32,0,1
, Piece::GetGraphicsColour(piece->colour));
+ Piece::textures[(int)(Piece::NOTHING)].DrawColour(x*
GRID_SIZE*scale,y*GRID_SIZE*scale,0,scale
, Piece::GetGraphicsColour(piece->colour));
break;
case Piece::BLUE:
break;
case Piece::BLUE:
- Piece::textures[(int)(Piece::NOTHING)].DrawColour(x*
32,y*32,0,1
, Piece::GetGraphicsColour(piece->colour));
+ Piece::textures[(int)(Piece::NOTHING)].DrawColour(x*
GRID_SIZE*scale,y*GRID_SIZE*scale,0,scale
, Piece::GetGraphicsColour(piece->colour));
break;
case Piece::NONE:
break;
case Piece::NONE:
- Piece::textures[(int)(Piece::BOULDER)].DrawColour(x*
32,y*32,0,1
, Piece::GetGraphicsColour(piece->colour));
+ Piece::textures[(int)(Piece::BOULDER)].DrawColour(x*
GRID_SIZE*scale,y*GRID_SIZE*scale,0,scale
, Piece::GetGraphicsColour(piece->colour));
break;
case Piece::BOTH:
break;
case Piece::BOTH:
- Piece::textures[(int)(Piece::BOULDER)].DrawColour(x*
32,y*32,0,1
, Piece::GetGraphicsColour(piece->colour));
+ Piece::textures[(int)(Piece::BOULDER)].DrawColour(x*
GRID_SIZE*scale,y*GRID_SIZE*scale,0,scale
, Piece::GetGraphicsColour(piece->colour));
break;
}
}
break;
}
}
@@
-343,6
+345,8
@@
MovementResult Board::MovePiece(int x, int y, const Direction & direction, int m
{
return MovementResult(MovementResult::IMMOBILE_UNIT);
}
{
return MovementResult(MovementResult::IMMOBILE_UNIT);
}
+ if (multiplier < 1)
+ return MovementResult(MovementResult::INVALID_DIRECTION); //Don't allow moves that don't actually move forward
if (multiplier > 1 && target->type != Piece::SCOUT)
{
return MovementResult(MovementResult::INVALID_DIRECTION); //Can only move a scout multiple times.
if (multiplier > 1 && target->type != Piece::SCOUT)
{
return MovementResult(MovementResult::INVALID_DIRECTION); //Can only move a scout multiple times.
UCC
git Repository :: git.ucc.asn.au