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

View File

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

View File

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

View File

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