I just played 3 long games and I was able to undo two fully and got an assert on the third one after more than 1000 actions... so I commit what I have:

- Modified undo to stop at "next phase" action
- Added "muligan" and "force library shuffling" to the list of logged action
- Fixed random logging
- Fixed double logging of actions
- Merged all the "next game" functions into a single one
- Created a PlayerType type instead of using int
- Moved the player loading code into the GameObserver and out of GameStateDuel to avoid having player references in both and simplify the initialization and termination. Tweeked a bit the humanplayer class to be able to do that.
- Added a "load" menu available in testsuite mode, I use that to load problematique game. To use it, just copy-paste a game from the traces into Res/test/game/timetwister.txt. Game in traces starts by "rvalues:..." and ends by "[end]"
- Added some untested and commented out code in GuiCombat to use the mouse/touch to setup the damage on the blockers
- Broke the network game ... hoh well, I'll repair it when everything else works !!
- various code cleanup and compilation fixes on Linux
This commit is contained in:
Xawotihs
2011-10-26 22:14:12 +00:00
parent 45f09972ad
commit c3dc51aed1
34 changed files with 410 additions and 297 deletions

View File

@@ -1517,7 +1517,7 @@ int MTGMomirRule::genRandomCreatureId(int convertedCost)
}
if (!total_cards)
return 0;
int start = (WRand() % total_cards);
int start = (WRand(true) % total_cards);
return pool[convertedCost][start];
}
@@ -1635,7 +1635,7 @@ int MTGStoneHewerRule::genRandomEquipId(int convertedCost)
if (convertedCost >= 20)
convertedCost = 19;
int total_cards = 0;
int i = (WRand() % int(convertedCost+1));//+1 becuase we want to generate a random "<=" the coverted.
int i = (WRand(true) % int(convertedCost+1));//+1 becuase we want to generate a random "<=" the coverted.
while (!total_cards && i >= 0)
{
total_cards = pool[i].size();
@@ -1644,7 +1644,7 @@ int MTGStoneHewerRule::genRandomEquipId(int convertedCost)
}
if (!total_cards)
return 0;
int start = (WRand() % total_cards);
int start = (WRand(true) % total_cards);
return pool[convertedCost][start];
}
@@ -1681,7 +1681,7 @@ int MTGHermitRule::receiveEvent(WEvent * event)
lands.push_back(temp);
}
if(lands.size())
lcard = lands[WRand() % lands.size()];
lcard = lands[WRand(true) % lands.size()];
if(lcard)
{
MTGCardInstance * copy = game->currentPlayer->game->putInZone(lcard,game->currentPlayer->game->library, game->currentPlayer->game->temp);