J :
* Fix warnings
This commit is contained in:
@@ -15,7 +15,7 @@ class ManaCost{
|
|||||||
protected:
|
protected:
|
||||||
int cost[Constants::MTG_NB_COLORS+1];
|
int cost[Constants::MTG_NB_COLORS+1];
|
||||||
ManaCostHybrid * hybrids[10];
|
ManaCostHybrid * hybrids[10];
|
||||||
int nbhybrids;
|
unsigned int nbhybrids;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExtraCosts * extraCosts;
|
ExtraCosts * extraCosts;
|
||||||
|
|||||||
+113
-113
@@ -1,119 +1,119 @@
|
|||||||
#include "../include/ExtraCost.h"
|
#include "../include/ExtraCost.h"
|
||||||
#include "../include/TargetChooser.h"
|
#include "../include/TargetChooser.h"
|
||||||
#include "../include/MTGCardInstance.h"
|
#include "../include/MTGCardInstance.h"
|
||||||
#include <JGE.h>
|
#include <JGE.h>
|
||||||
|
|
||||||
ExtraCost::ExtraCost( TargetChooser *_tc):tc(_tc){
|
ExtraCost::ExtraCost( TargetChooser *_tc):tc(_tc){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ExtraCost::setSource(MTGCardInstance * _source){
|
int ExtraCost::setSource(MTGCardInstance * _source){
|
||||||
source=_source;
|
source=_source;
|
||||||
if (tc){ tc->source = _source;}
|
if (tc){ tc->source = _source;}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SacrificeCost::SacrificeCost(TargetChooser *_tc):ExtraCost(_tc){
|
SacrificeCost::SacrificeCost(TargetChooser *_tc):ExtraCost(_tc){
|
||||||
target = NULL;
|
target = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SacrificeCost::setSource(MTGCardInstance * card){
|
int SacrificeCost::setSource(MTGCardInstance * card){
|
||||||
ExtraCost::setSource(card);
|
ExtraCost::setSource(card);
|
||||||
if (!tc) target = card;
|
if (!tc) target = card;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SacrificeCost::setPayment(MTGCardInstance * card){
|
int SacrificeCost::setPayment(MTGCardInstance * card){
|
||||||
if (tc) {
|
if (tc) {
|
||||||
int result = tc->addTarget(card);
|
int result = tc->addTarget(card);
|
||||||
if (result) {
|
if (result) {
|
||||||
target = card;
|
target = card;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SacrificeCost::isPaymentSet(){
|
int SacrificeCost::isPaymentSet(){
|
||||||
if (target) return 1;
|
if (target) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SacrificeCost::doPay(){
|
int SacrificeCost::doPay(){
|
||||||
if(target){
|
if(target){
|
||||||
target->controller()->game->putInGraveyard(target);
|
target->controller()->game->putInGraveyard(target);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SacrificeCost::Render(){
|
void SacrificeCost::Render(){
|
||||||
//TODO : real stuff
|
//TODO : real stuff
|
||||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
sprintf(buffer, "sacrifice");
|
sprintf(buffer, "sacrifice");
|
||||||
mFont->DrawString(buffer, 20 ,20, JGETEXT_LEFT);
|
mFont->DrawString(buffer, 20 ,20, JGETEXT_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//Container
|
//Container
|
||||||
//
|
//
|
||||||
ExtraCosts::ExtraCosts(){
|
ExtraCosts::ExtraCosts(){
|
||||||
action = NULL;
|
action = NULL;
|
||||||
source = NULL;
|
source = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtraCosts::Render(){
|
void ExtraCosts::Render(){
|
||||||
//TODO cool window and stuff...
|
//TODO cool window and stuff...
|
||||||
for (int i=0; i < costs.size(); i++){
|
for (size_t i = 0; i < costs.size(); i++){
|
||||||
costs[i]->Render();
|
costs[i]->Render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExtraCosts::setAction(MTGAbility * _action, MTGCardInstance * _card){
|
int ExtraCosts::setAction(MTGAbility * _action, MTGCardInstance * _card){
|
||||||
action = _action;
|
action = _action;
|
||||||
source = _card;
|
source = _card;
|
||||||
for (int i=0; i < costs.size(); i++){
|
for (size_t i = 0; i < costs.size(); i++){
|
||||||
costs[i]->setSource(_card);
|
costs[i]->setSource(_card);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExtraCosts::reset(){
|
int ExtraCosts::reset(){
|
||||||
action = NULL;
|
action = NULL;
|
||||||
source = NULL;
|
source = NULL;
|
||||||
//TODO set all payments to "unset"
|
//TODO set all payments to "unset"
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExtraCosts::tryToSetPayment(MTGCardInstance * card){
|
int ExtraCosts::tryToSetPayment(MTGCardInstance * card){
|
||||||
for (int i=0; i < costs.size(); i++){
|
for (size_t i = 0; i < costs.size(); i++){
|
||||||
if (int result = costs[i]->setPayment(card)) return result;
|
if (int result = costs[i]->setPayment(card)) return result;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExtraCosts::isPaymentSet(){
|
int ExtraCosts::isPaymentSet(){
|
||||||
for (int i=0; i < costs.size(); i++){
|
for (size_t i = 0; i < costs.size(); i++){
|
||||||
if (!costs[i]->isPaymentSet()) return 0;
|
if (!costs[i]->isPaymentSet()) return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExtraCosts::doPay(){
|
int ExtraCosts::doPay(){
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (int i=0; i < costs.size(); i++){
|
for (size_t i = 0; i < costs.size(); i++){
|
||||||
result+=costs[i]->doPay();
|
result+=costs[i]->doPay();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
void ExtraCosts::Dump(){
|
void ExtraCosts::Dump(){
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
OutputDebugString("=====\nDumping ExtraCosts=====\n");
|
OutputDebugString("=====\nDumping ExtraCosts=====\n");
|
||||||
sprintf(buf, "NbElements : %i\n", costs.size());
|
sprintf(buf, "NbElements : %i\n", costs.size());
|
||||||
OutputDebugString(buf);
|
OutputDebugString(buf);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){
|
|||||||
OutputDebugString("Sacrifice\n");
|
OutputDebugString("Sacrifice\n");
|
||||||
TargetChooserFactory tcf;
|
TargetChooserFactory tcf;
|
||||||
TargetChooser * tc = NULL;
|
TargetChooser * tc = NULL;
|
||||||
int target_start = value.find("(");
|
size_t target_start = value.find("(");
|
||||||
int target_end = value.find(")");
|
size_t target_end = value.find(")");
|
||||||
if (target_start!=string::npos && target_end!=string::npos){
|
if (target_start!=string::npos && target_end!=string::npos){
|
||||||
string target = value.substr(target_start+1, target_end-1 - target_start);
|
string target = value.substr(target_start+1, target_end-1 - target_start);
|
||||||
tc = tcf.createTargetChooser(target,NULL);
|
tc = tcf.createTargetChooser(target,NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user