- Fix issue 291 (cantbeblockedby segfault)
- Fix some issues with pricing
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-03-13 09:34:20 +00:00
parent fa0d98988d
commit e7bb2caf29
4 changed files with 13 additions and 6 deletions

View File

@@ -1212,6 +1212,7 @@ class AProtectionFrom: public MTGAbility{
AProtectionFrom * clone() const{ AProtectionFrom * clone() const{
AProtectionFrom * a = NEW AProtectionFrom(*this); AProtectionFrom * a = NEW AProtectionFrom(*this);
a->fromTc = fromTc->clone();
a->isClone = 1; a->isClone = 1;
return a; return a;
} }
@@ -1244,6 +1245,7 @@ class ACantBeBlockedBy: public MTGAbility{
ACantBeBlockedBy * clone() const{ ACantBeBlockedBy * clone() const{
ACantBeBlockedBy * a = NEW ACantBeBlockedBy(*this); ACantBeBlockedBy * a = NEW ACantBeBlockedBy(*this);
a->fromTc = fromTc->clone();
a->isClone = 1; a->isClone = 1;
return a; return a;
} }

View File

@@ -126,6 +126,7 @@ private:
string newDeckname; string newDeckname;
StatsWrapper stw; StatsWrapper stw;
bool mSwitching; bool mSwitching;
void saveDeck(); //Saves the deck and additional necessary information
public: public:
GameStateDeckViewer(GameApp* parent); GameStateDeckViewer(GameApp* parent);

View File

@@ -227,6 +227,12 @@ void GameStateDeckViewer::addRemove(MTGCard * card){
loadIndexes(); loadIndexes();
} }
void GameStateDeckViewer::saveDeck(){
myDeck->save();
playerdata->save();
pricelist->save();
}
void GameStateDeckViewer::Update(float dt) void GameStateDeckViewer::Update(float dt)
{ {
@@ -241,7 +247,7 @@ void GameStateDeckViewer::Update(float dt)
if(newDeckname != ""){ if(newDeckname != ""){
if(myDeck && myDeck->parent){ if(myDeck && myDeck->parent){
myDeck->parent->meta_name = newDeckname; myDeck->parent->meta_name = newDeckname;
myDeck->save(); saveDeck();
} }
mStage = STAGE_WAITING; mStage = STAGE_WAITING;
} }
@@ -1469,9 +1475,7 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId)
{ {
case 0: case 0:
myDeck->save(); saveDeck();
playerdata->save();
pricelist->save();
mParent->DoTransition(TRANSITION_FADE,GAME_STATE_MENU); mParent->DoTransition(TRANSITION_FADE,GAME_STATE_MENU);
break; break;
case 1: case 1:
@@ -1507,7 +1511,7 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId)
int rnd = (rand() % 25); int rnd = (rand() % 25);
playerdata->credits += price; playerdata->credits += price;
price = price - (rnd * price)/100; price = price - (rnd * price)/100;
pricelist->setPrice(card->getMTGId(),price*2); pricelist->setPrice(card->getMTGId(),price);
playerdata->collection->remove(card->getMTGId()); playerdata->collection->remove(card->getMTGId());
displayed_deck->Remove(card,1); displayed_deck->Remove(card,1);
displayed_deck->validate(); displayed_deck->validate();

View File

@@ -74,7 +74,7 @@ int PriceList::setPrice(int cardId, int price){
return price; return price;
} }
int PriceList::getSellPrice(int cardid){ int PriceList::getSellPrice(int cardid){
return getPurchasePrice(cardid) / 2; return getPrice(cardid);
} }
float PriceList::difficultyScalar(float price, int cardid){ float PriceList::difficultyScalar(float price, int cardid){
float badluck = (float)(abs(cardid + randomKey) % 201) / 100; //Float between 0 and 2. float badluck = (float)(abs(cardid + randomKey) % 201) / 100; //Float between 0 and 2.