More warning cleanup - converted certain class functions to return bool instead of int where appropriate. Also fixed the sdl update() tickCount assignment that I just broke in my last checkin.
This commit is contained in:
+2
-1
@@ -333,7 +333,8 @@ void DestroyGame(void)
|
|||||||
|
|
||||||
void SdlApp::OnUpdate()
|
void SdlApp::OnUpdate()
|
||||||
{
|
{
|
||||||
static int tickCount = JGEGetTime();
|
static int tickCount = 0;
|
||||||
|
tickCount = JGEGetTime();
|
||||||
int64_t dt = (tickCount - lastTickCount);
|
int64_t dt = (tickCount - lastTickCount);
|
||||||
lastTickCount = tickCount;
|
lastTickCount = tickCount;
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,14 @@ public:
|
|||||||
TargetChooser * getCurrentTargetChooser();
|
TargetChooser * getCurrentTargetChooser();
|
||||||
void setCurrentWaitingAction(ActionElement * ae);
|
void setCurrentWaitingAction(ActionElement * ae);
|
||||||
MTGAbility * getAbility(int type);
|
MTGAbility * getAbility(int type);
|
||||||
|
|
||||||
//Removes from game but does not move the element to garbage. The caller must take care of deleting the element.
|
//Removes from game but does not move the element to garbage. The caller must take care of deleting the element.
|
||||||
int removeFromGame(ActionElement * e);
|
int removeFromGame(ActionElement * e);
|
||||||
int moveToGarbage(ActionElement * e);
|
|
||||||
int cleanGarbage();
|
bool moveToGarbage(ActionElement * e);
|
||||||
|
|
||||||
|
void cleanGarbage();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ActionElement * currentWaitingAction;
|
ActionElement * currentWaitingAction;
|
||||||
int cantCancel;
|
int cantCancel;
|
||||||
|
|||||||
@@ -89,14 +89,18 @@ class MTGGameZone {
|
|||||||
int countByType(const char * value);
|
int countByType(const char * value);
|
||||||
int countByCanTarget(TargetChooser * tc);
|
int countByCanTarget(TargetChooser * tc);
|
||||||
MTGCardInstance * findByName(string name);
|
MTGCardInstance * findByName(string name);
|
||||||
int hasAbility(int ability); //returns 1 if one of the cards in the zone has the ability, 0 otherwise
|
|
||||||
int hasType(const char * value); //returns 1 if one of the cards in the zone has the type, 0 otherwise
|
//returns true if one of the cards in the zone has the ability
|
||||||
int hasSpecificType(const char * value,const char * secondvalue); //returns 1 if one of the cards in the zone has the type, 0 otherwise
|
bool hasAbility(int ability);
|
||||||
int hasPrimaryType(const char * value,const char * secondvalue); //returns 1 if one of the cards in the zone has the type, 0 otherwise
|
|
||||||
int hasTypeButNotType(const char * value,const char * secondvalue); //returns 1 if one of the cards in the zone has the type, 0 otherwise
|
//returns true if one of the cards in the zone has the type
|
||||||
int hasName(string value);
|
bool hasType(const char * value);
|
||||||
int hasColor(int value); //returns 1 if one of the cards in the zone has the color, 0 otherwise
|
bool hasSpecificType(const char* value, const char* secondvalue);
|
||||||
int hasX();
|
bool hasPrimaryType(const char* value, const char* secondvalue);
|
||||||
|
bool hasTypeButNotType(const char* value, const char* secondvalue);
|
||||||
|
bool hasName(string value);
|
||||||
|
bool hasColor(int value);
|
||||||
|
bool hasX();
|
||||||
|
|
||||||
//How many cards matching a TargetChooser have been put in this zone during the turn
|
//How many cards matching a TargetChooser have been put in this zone during the turn
|
||||||
int seenThisTurn(TargetChooser * tc, int castFilter = Constants::CAST_DONT_CARE);
|
int seenThisTurn(TargetChooser * tc, int castFilter = Constants::CAST_DONT_CARE);
|
||||||
|
|||||||
@@ -38,25 +38,24 @@ int ActionLayer::removeFromGame(ActionElement * e)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionLayer::moveToGarbage(ActionElement * e)
|
bool ActionLayer::moveToGarbage(ActionElement * e)
|
||||||
{
|
{
|
||||||
if (removeFromGame(e))
|
if (removeFromGame(e))
|
||||||
{
|
{
|
||||||
garbage.push_back(e);
|
garbage.push_back(e);
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionLayer::cleanGarbage()
|
void ActionLayer::cleanGarbage()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < garbage.size(); ++i)
|
for (size_t i = 0; i < garbage.size(); ++i)
|
||||||
{
|
{
|
||||||
delete (garbage[i]);
|
delete (garbage[i]);
|
||||||
}
|
}
|
||||||
garbage.clear();
|
garbage.clear();
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionLayer::reactToClick(ActionElement * ability, MTGCardInstance * card)
|
int ActionLayer::reactToClick(ActionElement * ability, MTGCardInstance * card)
|
||||||
|
|||||||
@@ -532,79 +532,79 @@ MTGCardInstance * MTGGameZone::findByName(string name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGGameZone::hasType(const char * value)
|
bool MTGGameZone::hasType(const char * value)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (nb_cards); i++)
|
for (int i = 0; i < (nb_cards); i++)
|
||||||
{
|
{
|
||||||
if (cards[i]->hasType(value))
|
if (cards[i]->hasType(value))
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGGameZone::hasPrimaryType(const char * value,const char * secondvalue)
|
bool MTGGameZone::hasPrimaryType(const char * value,const char * secondvalue)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (nb_cards); i++)
|
for (int i = 0; i < (nb_cards); i++)
|
||||||
{
|
{
|
||||||
if (cards[i]->hasType(value) && cards[i]->hasType(secondvalue))
|
if (cards[i]->hasType(value) && cards[i]->hasType(secondvalue))
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGGameZone::hasSpecificType(const char * value,const char * secondvalue)
|
bool MTGGameZone::hasSpecificType(const char * value,const char * secondvalue)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (nb_cards); i++)
|
for (int i = 0; i < (nb_cards); i++)
|
||||||
{
|
{
|
||||||
if (cards[i]->hasType(value) && cards[i]->hasSubtype(secondvalue))
|
if (cards[i]->hasType(value) && cards[i]->hasSubtype(secondvalue))
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGGameZone::hasTypeButNotType(const char * value,const char * secondvalue)
|
bool MTGGameZone::hasTypeButNotType(const char * value,const char * secondvalue)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (nb_cards); i++)
|
for (int i = 0; i < (nb_cards); i++)
|
||||||
{
|
{
|
||||||
if (cards[i]->hasType(value) && cards[i]->hasSubtype(value) && !cards[i]->hasType(secondvalue) && !cards[i]->hasSubtype(secondvalue))
|
if (cards[i]->hasType(value) && cards[i]->hasSubtype(value) && !cards[i]->hasType(secondvalue) && !cards[i]->hasSubtype(secondvalue))
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGGameZone::hasName(string value)
|
bool MTGGameZone::hasName(string value)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (nb_cards); i++)
|
for (int i = 0; i < (nb_cards); i++)
|
||||||
{
|
{
|
||||||
if (cards[i]->name == value)
|
if (cards[i]->name == value)
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGGameZone::hasColor(int value)
|
bool MTGGameZone::hasColor(int value)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (nb_cards); i++)
|
for (int i = 0; i < (nb_cards); i++)
|
||||||
{
|
{
|
||||||
if (cards[i]->getManaCost()->hasColor(value) && cards[i]->getManaCost()->getConvertedCost() > 0)
|
if (cards[i]->getManaCost()->hasColor(value) && cards[i]->getManaCost()->getConvertedCost() > 0)
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGGameZone::hasX()
|
bool MTGGameZone::hasX()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (nb_cards); i++)
|
for (int i = 0; i < (nb_cards); i++)
|
||||||
{
|
{
|
||||||
@@ -616,16 +616,16 @@ int MTGGameZone::hasX()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGGameZone::hasAbility(int ability)
|
bool MTGGameZone::hasAbility(int ability)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (nb_cards); i++)
|
for (int i = 0; i < (nb_cards); i++)
|
||||||
{
|
{
|
||||||
if (cards[i]->basicAbilities[ability])
|
if (cards[i]->basicAbilities[ability])
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGGameZone::seenThisTurn(TargetChooser * tc, int castMethod)
|
int MTGGameZone::seenThisTurn(TargetChooser * tc, int castMethod)
|
||||||
|
|||||||
Reference in New Issue
Block a user