Rearranged the project, pruned unnecessary modules

I've also put some notes into the code, for later reference. These are
usually marked with "TODO".
This commit is contained in:
Kayne Ruse
2013-01-17 02:53:50 +11:00
parent d39d63ed2d
commit 6d12cd265c
13 changed files with 140 additions and 769 deletions

View File

@@ -167,127 +167,145 @@
</References> </References>
<Files> <Files>
<Filter <Filter
Name="Source Files" Name="Hearts"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath=".\animation.cpp"
>
</File>
<File
RelativePath=".\audio_manager.cpp"
>
</File>
<File
RelativePath=".\base_engine.cpp"
>
</File>
<File
RelativePath=".\card.cpp"
>
</File>
<File
RelativePath=".\card_list.cpp"
>
</File>
<File
RelativePath=".\deck.cpp"
>
</File>
<File <File
RelativePath=".\hearts_engine.cpp" RelativePath=".\hearts_engine.cpp"
> >
</File> </File>
<File
RelativePath=".\image.cpp"
>
</File>
<File
RelativePath=".\image_manager.cpp"
>
</File>
<File
RelativePath=".\music.cpp"
>
</File>
<File
RelativePath=".\network_manager.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\object.cpp"
>
</File>
<File
RelativePath=".\player.cpp"
>
</File>
<File
RelativePath=".\player_ai.cpp"
>
</File>
<File
RelativePath=".\player_user.cpp"
>
</File>
<File
RelativePath=".\sound.cpp"
>
</File>
<File
RelativePath=".\table.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\animation.h"
>
</File>
<File
RelativePath=".\audio_manager.h"
>
</File>
<File
RelativePath=".\base_engine.h"
>
</File>
<File
RelativePath=".\card.h"
>
</File>
<File
RelativePath=".\card_list.h"
>
</File>
<File
RelativePath=".\deck.h"
>
</File>
<File <File
RelativePath=".\hearts_engine.h" RelativePath=".\hearts_engine.h"
> >
</File> </File>
<File
RelativePath=".\table.cpp"
>
</File>
<File
RelativePath=".\table.h"
>
</File>
<Filter
Name="Card Systems"
>
<File
RelativePath=".\card.cpp"
>
</File>
<File
RelativePath=".\card.h"
>
</File>
<File
RelativePath=".\card_list.cpp"
>
</File>
<File
RelativePath=".\card_list.h"
>
</File>
<File
RelativePath=".\deck.cpp"
>
</File>
<File
RelativePath=".\deck.h"
>
</File>
</Filter>
<Filter
Name="Player Systems"
>
<File
RelativePath=".\player.cpp"
>
</File>
<File
RelativePath=".\player.h"
>
</File>
<File
RelativePath=".\player_ai.cpp"
>
</File>
<File
RelativePath=".\player_ai.h"
>
</File>
<File
RelativePath=".\player_user.cpp"
>
</File>
<File
RelativePath=".\player_user.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="-Notes"
>
<File
RelativePath="..\Notes\Outline.txt"
>
</File>
<File
RelativePath="..\Notes\TODO.txt"
>
</File>
</Filter>
<Filter
Name="KAGE"
>
<File
RelativePath=".\audio_manager.cpp"
>
</File>
<File
RelativePath=".\audio_manager.h"
>
</File>
<File
RelativePath=".\base_engine.cpp"
>
</File>
<File
RelativePath=".\base_engine.h"
>
</File>
<File
RelativePath=".\image.cpp"
>
</File>
<File <File
RelativePath=".\image.h" RelativePath=".\image.h"
> >
</File> </File>
<File
RelativePath=".\image_manager.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File <File
RelativePath=".\image_manager.h" RelativePath=".\image_manager.h"
> >
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\music.cpp"
>
</File> </File>
<File <File
RelativePath=".\music.h" RelativePath=".\music.h"
@@ -298,47 +316,13 @@
> >
</File> </File>
<File <File
RelativePath=".\network_manager.h" RelativePath=".\sound.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\object.h"
>
</File>
<File
RelativePath=".\player.h"
>
</File>
<File
RelativePath=".\player_ai.h"
>
</File>
<File
RelativePath=".\player_user.h"
> >
</File> </File>
<File <File
RelativePath=".\sound.h" RelativePath=".\sound.h"
> >
</File> </File>
<File
RelativePath=".\table.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter> </Filter>
</Files> </Files>
<Globals> <Globals>

View File

@@ -1,85 +0,0 @@
/* File Name: animation.cpp
* Copyright: (c) Kayne Ruse, all rights reserved.
* Author: Kayne Ruse
* Date: 9/7/2011
* Version: 1, Stable
* Description: The Animation class, animates spritesheets.
* Part of the KAGE Game Engine.
*/
#include "animation.h"
using namespace KAGE;
//-------------------------
//Public access members
//-------------------------
Animation::Animation(int _stateCount, int _frameCount, float _speed) {
stateCount = _stateCount;
frameCount = _frameCount;
state = 0;
frame = 0;
speed = _speed;
}
void Animation::Process(int delta) {
frame += delta * speed + speed;
if (frame >= frameCount)
frame = 0;
SetCell();
}
//-------------------------
//Accessors and mutators
//-------------------------
int Animation::SetStateCount(int _stateCount) {
frame = 0;
return stateCount = _stateCount;
}
int Animation::SetFrameCount(int _frameCount) {
frame = 0;
return frameCount = _frameCount;
}
int Animation::SetState(int _state) {
if (_state >= stateCount)
return -1;
frame = 0;
return state = _state;
}
float Animation::SetFrame(float _frame) {
if (_frame >= frameCount)
return -1;
return frame = _frame;
}
float Animation::SetSpeed(float _speed) {
frame = 0;
return speed = _speed;
}
int Animation::GetStateCount() {
return stateCount;
}
int Animation::GetFrameCount() {
return frameCount;
}
int Animation::GetState() {
return state;
}
float Animation::GetFrame() {
return frame;
}
float Animation::GetSpeed() {
return speed;
}

View File

@@ -1,55 +0,0 @@
/* File Name: animation.h
* Copyright: (c) Kayne Ruse, all rights reserved.
* Author: Kayne Ruse
* Date: 9/7/2011
* Version: 1, Stable
* Description: The Animation class, animates spritesheets.
* Part of the KAGE Game Engine.
*/
#ifndef KR_KAGE_ANIMATION_H_
#define KR_KAGE_ANIMATION_H_
/* Version information */
#define ANIMATION_VERSION_MAJOR 1
#define ANIMATION_VERSION_MINOR 0
#define ANIMATION_VERSION_PATCH 0
#define ANIMATION_VERSION "1.0.0"
#define ANIMATION_VERSION_STRING "KAGE::Animation Version 1.0.0, Stable"
namespace KAGE {
class Animation {
public:
/* Public access members */
Animation(int stateCount, int frameCount, float speed = 0);
virtual void Process(int delta);
/* Accessors and mutators */
virtual int SetStateCount (int stateCount);
virtual int SetFrameCount (int frameCount);
virtual int SetState (int state);
virtual float SetFrame (float frame);
virtual float SetSpeed (float speed);
virtual int GetStateCount ();
virtual int GetFrameCount ();
virtual int GetState ();
virtual float GetFrame ();
virtual float GetSpeed ();
protected:
/* Protected access members */
virtual void SetCell()=0;
private:
/* Private access members */
int stateCount;
int frameCount;
int state;
float frame;
float speed;
};
}
#endif

View File

@@ -62,8 +62,8 @@ protected:
const int suit; const int suit;
const int rank; const int rank;
int face; int face; //TODO: "facestate"
SDL_Surface* faceSurface; SDL_Surface* faceSurface; //TODO: Image
SDL_Surface* backSurface; SDL_Surface* backSurface;
Card* next; Card* next;

View File

@@ -140,7 +140,7 @@ Card* CardList::PassSlab(int first, int count) {
void CardList::Shuffle() { void CardList::Shuffle() {
//New version //New version
srand((unsigned int)time(NULL)); srand((unsigned int)time(NULL)); //TODO: Remove this, initiate randomization in the Scene (and shuffle 3 times ;) )
iterator shuffleHead = NULL; iterator shuffleHead = NULL;
iterator prev = NULL; iterator prev = NULL;

View File

@@ -45,14 +45,14 @@ private:
KAGE::ImageManager mImage; KAGE::ImageManager mImage;
KAGE::AudioManager mAudio; KAGE::AudioManager mAudio;
/* Game phase members */ /* Game phase members */ //TODO: "phases"
void SetupPhase(); void SetupPhase();
void SwapPhase(); void SwapPhase();
void TrickPhase(); void TrickPhase();
void ScorePhase(); void ScorePhase();
void CleanupPhase(); void CleanupPhase();
/* Play phase members */ /* Play phase members */ //TODO: "steps"
void PlayBeforePhase(); void PlayBeforePhase();
void PlayPlayerPhase(); void PlayPlayerPhase();
void PlayAfterPhase(); void PlayAfterPhase();

View File

@@ -1,155 +0,0 @@
/* File Name: network_manager.cpp
* Copyright: (c) Kayne Ruse, all rights reserved.
* Author: Kayne Ruse
* Date: 21/6/2011
* Version: 3, Stable
* Description: The Network Manager deals with the networking for your game.
* Part of the KAGE Game Engine.
*/
#include <iostream>
#include "network_manager.h"
using namespace std;
using namespace KAGE;
//-------------------------
//Public access members
//-------------------------
NetworkManager::~NetworkManager() {
SDLNet_FreePacket(packet);
SDLNet_Quit();
}
int NetworkManager::Init(int port, int packetSize) {
if (SDLNet_Init() != 0) {
cout << "Error in NetworkManager::Init()" << endl;
cout << "Failed to initialise SDL_net" << endl;
return -1;
}
packet = SDLNet_AllocPacket(packetSize);
if (packet == NULL) {
cout << "Error in NetworkManager::Init()" << endl;
cout << "SDLNet_AllocPacket() returned NULL" << endl;
cout << "packetSize: " << packetSize << endl;
return -1;
}
socket = SDLNet_UDP_Open(port);
if (socket == NULL) {
cout << "Error in NetworkManager::Init()" << endl;
cout << "SDLNet_UDP_Open() returned NULL" << endl;
cout << "port: " << port << endl;
return -1;
}
return 0;
}
IPaddress* NetworkManager::Add(const char* name, char* ip, int port) {
if (Exists(name)) {
cout << "Error in NetworkManager::Add()" << endl;
cout << "An IPaddress of that name already exists" << endl;
cout << "name: " << name << endl;
cout << "ip: " << ip << endl;
cout << "port: " << port << endl;
return NULL;
}
IPaddress* add = new IPaddress;
if (SDLNet_ResolveHost(add,ip,port) != 0) {
cout << "Error in NetworkManager::Add(name,ip,port)" << endl;
cout << "Failed to resolve an IPaddress" << endl;
cout << "name: " << name << endl;
cout << "ip: " << ip << endl;
cout << "port: " << port << endl;
delete add;
return NULL;
}
return NamedManager::Add(name,add);
}
IPaddress* NetworkManager::Add(const char* name, IPaddress* address) {
if (Exists(name)) {
cout << "Error in NetworkManager::Add()" << endl;
cout << "An IPaddress of that name already exists" << endl;
cout << "name: " << name << endl;
return NULL;
}
return NamedManager::Add(name,address);
}
//-------------------------
//Network members
//-------------------------
int NetworkManager::Send(const char* name, const char* data) {
IPaddress* add = Get(name);
if (add == NULL) {
cout << "Error in NetworkManager::Send(name,data)" << endl;
cout << "No such IPaddress with that name" << endl;
cout << "name: " << name << endl;
return -2;
}
return Send(add,data);
}
int NetworkManager::Send(IPaddress* address, const char* data) {
//send this data to the address
strcpy_s((char*)packet->data,512,data);
packet->address = *address;
packet->len = strlen((char*)packet->data) + 1;
SDLNet_UDP_Send(socket,-1,packet);
return 0;
}
int NetworkManager::Send(char* ip, int port, const char* data) {
IPaddress* add = new IPaddress;
if (SDLNet_ResolveHost(add,ip,port) != 0) {
cout << "Error in NetworkManager::Send(ip,port,data)" << endl;
cout << "Failed to resolve an IPaddress" << endl;
cout << "ip: " << ip << endl;
cout << "port: " << port << endl;
cout << "data: " << data << endl;
delete add;
return -1;
}
int ret = Send(add,data);
delete add;
return ret;
}
void NetworkManager::SendAll(const char* data) {
for (MapType::iterator it = mapList.begin(); it != mapList.end(); it++)
Send(it->second,data);
}
int NetworkManager::Receive() {
return SDLNet_UDP_Recv(socket, packet);
}
//-------------------------
//Accessors and mutators
//-------------------------
const char* NetworkManager::Data() {
return (char*)packet->data;
}
bool NetworkManager::CheckData(const char* str) {
return !strcmp((char*)packet->data,str);
}
bool NetworkManager::CheckData(const char* str, int num) {
return !strncmp((char*)packet->data,str,num);
}
UDPpacket* NetworkManager::Packet() {
return packet;
}

View File

@@ -1,52 +0,0 @@
/* File Name: network_manager.h
* Copyright: (c) Kayne Ruse, all rights reserved.
* Author: Kayne Ruse
* Date: 21/6/2011
* Version: 3, Stable
* Description: The Network Manager deals with the networking for your game.
* Part of the KAGE Game Engine.
*/
#ifndef KR_KAGE_NETWORKMANAGER_H_
#define KR_KAGE_NETWORKMANAGER_H_
/* Version information */
#define NETWORKMANAGER_VERSION_MAJOR 3
#define NETWORKMANAGER_VERSION_MINOR 0
#define NETWORKMANAGER_VERSION_PATCH 0
#define NETWORKMANAGER_VERSION "3.0.0"
#define NETWORKMANAGER_VERSION_STRING "KAGE::NetworkManager Version 3, Stable"
#include "SDL_net.h"
#include "named_manager.h"
namespace KAGE {
class NetworkManager : public NamedManager<IPaddress> {
public:
/* Public access members */
~NetworkManager();
int Init(int port, int packetSize = 512);
IPaddress* Add(const char* name, char* ip, int port);
IPaddress* Add(const char* name, IPaddress* address);
/* Network members */
int Send(const char* name, const char* data);
int Send(IPaddress* address, const char* data);
int Send(char* ip, int port, const char* data);
void SendAll(const char* data);
int Receive();
/* Accessors and mutators */
const char* Data();
bool CheckData(const char* str);
bool CheckData(const char* str, int num);
UDPpacket* Packet();
/* Private access members */
UDPsocket socket;
UDPpacket* packet;
};
}
#endif

View File

@@ -1,197 +0,0 @@
/* File Name: object.cpp
* Copyright: (c) Kayne Ruse, all rights reserved.
* Author: Kayne Ruse
* Date: 9/7/2011
* Version: 4, Stable
* Description: The Object class, with movement and collision functionality.
* Part of the KAGE Game Engine.
*/
#include <iostream>
#include "object.h"
using namespace std;
using namespace KAGE;
//-------------------------
//Public access members
//-------------------------
Object::Object(float _realX, float _realY, int boxX, int boxY, int boxWidth, int boxHeight, float _radius) {
realX = _realX;
realY = _realY;
motionX = 0;
motionY = 0;
boundingBox.x = boxX;
boundingBox.y = boxY;
boundingBox.w = boxWidth;
boundingBox.h = boxHeight;
radius = _radius;
}
void Object::Process(int delta) {
realX += delta * motionX + motionX;
realY += delta * motionY + motionY;
UpdateClip();
}
//-------------------------
//Accessors and mutators
//-------------------------
void Object::SetPosition(float _realX, float _realY) {
realX = _realX;
realY = _realY;
UpdateClip();
}
void Object::ShiftPosition(float _realX, float _realY) {
realX += _realX;
realY += _realY;
UpdateClip();
}
float Object::SetRealX(float _realX) {
realX = _realX;
UpdateClip();
return realX;
}
float Object::SetRealY(float _realY) {
realY = _realY;
UpdateClip();
return realY;
}
float Object::GetRealX() {
return realX;
}
float Object::GetRealY() {
return realY;
}
void Object::SetMotion(float _motionX, float _motionY) {
motionX = _motionX;
motionY = _motionY;
}
float Object::SetMotionX(float _motionX) {
return motionX = _motionX;
}
float Object::SetMotionY(float _motionY) {
return motionY = _motionY;
}
void Object::ShiftMotion(float _motionX, float _motionY) {
motionX += _motionX;
motionY += _motionY;
}
float Object::ShiftMotionX(float _motionX) {
return motionX += _motionX;
}
float Object::ShiftMotionY(float _motionY) {
return motionY += _motionY;
}
void Object::StopMotion() {
motionX = 0;
motionY = 0;
}
float Object::GetMotionX() {
return motionX;
}
float Object::GetMotionY() {
return motionY;
}
//-------------------------
//Collision code
//-------------------------
SDL_Rect Object::SetBoundingBox(int x, int y, int w, int h) {
boundingBox.x = x;
boundingBox.y = y;
boundingBox.w = w;
boundingBox.h = h;
return boundingBox;
}
SDL_Rect Object::SetBoundingBox(SDL_Rect _boundingBox) {
return boundingBox = _boundingBox;
}
float Object::SetRadius(float _radius) {
return radius = _radius;
}
SDL_Rect* Object::GetBoundingBox() {
return &boundingBox;
}
SDL_Rect Object::GetWorldBoundingBox() {
SDL_Rect ret = boundingBox;
ret.x += (Sint16)realX;
ret.y += (Sint16)realY;
ret.w += (Uint16)realX;
ret.h += (Uint16)realY;
return ret;
}
float Object::GetRadius() {
return radius;
}
bool Object::CheckWorldBoundingBox(SDL_Rect arg) {
if (radius > 0) {
cout << "Error in Object::CheckWorldBoundingBox()" << endl;
cout << "Wrong collision type" << endl;
cout << "radius: " << radius << endl;
return false;
}
SDL_Rect box = GetWorldBoundingBox();
if ((int)arg.x < (int)box.w &&
(int)arg.w > (int)box.x &&
(int)arg.y < (int)box.h &&
(int)arg.h > (int)box.y)
return true;
return false;
}
inline float sqr(float f) {
return f*f;
}
bool Object::CheckRadius(float _realX, float _realY, float _radius) {
if (radius <= 0) {
cout << "Error in Object::CheckRadius()" << endl;
cout << "Wrong collision type" << endl;
cout << "radius: " << radius << endl;
return false;
}
if (sqr(radius + _radius) > sqr(realX - _realX) + sqr(realY - _realY))
return true;
return false;
}
bool Object::CheckPoint(float _realX, float _realY) {
if (radius > 0) {
cout << "Error in Object::CheckPoint()" << endl;
cout << "Wrong collision type" << endl;
cout << "radius: " << radius << endl;
return false;
}
SDL_Rect box = GetWorldBoundingBox();
if ((int)box.x < (int)_realX &&
(int)box.y < (int)_realY &&
(int)box.w > (int)_realX &&
(int)box.h > (int)_realY)
return true;
return false;
}

View File

@@ -1,78 +0,0 @@
/* File Name: object.h
* Copyright: (c) Kayne Ruse, all rights reserved.
* Author: Kayne Ruse
* Date: 9/7/2011
* Version: 4, Stable
* Description: The Object class, with movement and collision functionality.
* Part of the KAGE Game Engine.
*/
#ifndef KR_KAGE_OBJECT_H_
#define KR_KAGE_OBJECT_H_
/* Version information */
#define OBJECT_VERSION_MAJOR 4
#define OBJECT_VERSION_MINOR 0
#define OBJECT_VERSION_PATCH 0
#define OBJECT_VERSION "4.0.0"
#define OBJECT_VERSION_STRING "KAGE::Object Version 4, Stable"
#include "SDL.h"
namespace KAGE {
class Object {
public:
/* Public access members */
Object(float realX = 0, float realY = 0, int boxX = 0, int boxY = 0, int boxWidth = 0, int boxHeight = 0, float radius = 0);
virtual void Process(int delta);
/* Accessors and mutators */
virtual void SetPosition (float realX, float realY);
virtual void ShiftPosition (float realX, float realY);
virtual float SetRealX (float realX);
virtual float SetRealY (float realY);
virtual float GetRealX ();
virtual float GetRealY ();
virtual void SetMotion (float motionX, float motionY);
virtual float SetMotionX (float motionX);
virtual float SetMotionY (float motionY);
virtual void ShiftMotion (float motionX, float motionY);
virtual float ShiftMotionX (float motionX);
virtual float ShiftMotionY (float motionY);
virtual void StopMotion ();
virtual float GetMotionX ();
virtual float GetMotionY ();
/* Collision code */
virtual SDL_Rect SetBoundingBox (int x, int y, int w, int h);
virtual SDL_Rect SetBoundingBox (SDL_Rect boundingBox);
virtual float SetRadius (float radius);
virtual SDL_Rect* GetBoundingBox ();
virtual SDL_Rect GetWorldBoundingBox ();
virtual float GetRadius ();
virtual bool CheckWorldBoundingBox (SDL_Rect boundingBox);
virtual bool CheckRadius (float realX, float realY, float radius = 0);
virtual bool CheckPoint (float realX, float realY);
protected:
/* Protected access members */
virtual void UpdateClip()=0;
private:
/* Private access members */
float realX;
float realY;
float motionX;
float motionY;
SDL_Rect boundingBox;
float radius;
};
}
#endif

View File

@@ -120,6 +120,7 @@ void Player::SetHandPositions() {
} }
void Player::SetTrickPositions() { void Player::SetTrickPositions() {
//Sorts out the cards won from tricks for display at the end of the round
int x = posX, y = posY; int x = posX, y = posY;
tricks.Sort(); tricks.Sort();
@@ -139,6 +140,7 @@ void Player::DrawHand(SDL_Surface* dest) {
} }
void Player::DrawTricks(SDL_Surface* dest) { void Player::DrawTricks(SDL_Surface* dest) {
//draws the cards won from tricks at the end of the round
tricks.Sort(); tricks.Sort();
for (int i = 0; i < tricks.Size(); i++) { for (int i = 0; i < tricks.Size(); i++) {
@@ -153,6 +155,7 @@ void Player::DrawTricks(SDL_Surface* dest) {
//------------------------- //-------------------------
void Player::AddSwapCards(int card) { void Player::AddSwapCards(int card) {
//highlight a card
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (swapCards[i] == -1) { if (swapCards[i] == -1) {
swapCards[i] = card; swapCards[i] = card;
@@ -162,6 +165,7 @@ void Player::AddSwapCards(int card) {
} }
bool Player::CheckSwapCards(int card) { bool Player::CheckSwapCards(int card) {
//if a card has been highlighted
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
if (card == swapCards[i]) if (card == swapCards[i])
return true; return true;
@@ -169,6 +173,7 @@ bool Player::CheckSwapCards(int card) {
} }
bool Player::CheckSwapCards() { bool Player::CheckSwapCards() {
//check if three cards have been highlighted
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
if (swapCards[i] == -1) if (swapCards[i] == -1)
return false; return false;

View File

@@ -34,7 +34,7 @@ public:
CardList* Hand(); CardList* Hand();
CardList* Tricks(); CardList* Tricks();
/* Score members */ /* Score members */ //TODO: not good.
int Score(int score = 0); int Score(int score = 0);
int Wins(int wins = 0); int Wins(int wins = 0);
@@ -52,7 +52,7 @@ public:
bool CheckSwapCards(); bool CheckSwapCards();
protected: protected:
/* Swapping members */ /* Swapping members */ //TODO: raname to the "highlight" system
void AddSwapCards(int); void AddSwapCards(int);
bool CheckSwapCards(int); bool CheckSwapCards(int);
void RemoveSwapCards(int); void RemoveSwapCards(int);

View File

@@ -73,6 +73,10 @@ Card* PlayerAI::PassPlayFirstTrick(int leadingSuit) {
if (Hand()->Read(i)->Suit() == leadingSuit) if (Hand()->Read(i)->Suit() == leadingSuit)
return Hand()->Pass(i); return Hand()->Pass(i);
/* bug: it's possible that if every penalty card is initially dealt the the AI, it'll break
* Solution: Always shuffle first.
*/
//can't follow suit, no penalty cards //can't follow suit, no penalty cards
Hand()->SortRank(); Hand()->SortRank();
Card* c = NULL; Card* c = NULL;