Erwan
- fix with deck names overwritten when saving - Added "premade" decks directory for people who don't want to create their own decks
This commit is contained in:
22
projects/mtg/bin/Res/player/premade/deck1.txt
Normal file
22
projects/mtg/bin/Res/player/premade/deck1.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
#NAME:Premade G/R
|
||||
#DESC:A Red/Green deck with simple mechanics
|
||||
#DESC:to get you started.
|
||||
#DESC:We recommend to create your own decks
|
||||
#DESC:to get the full Wagic Fun!
|
||||
|
||||
Forest (10E) *11
|
||||
Mountain (10E) *12
|
||||
|
||||
Aggressive Urge (10E) *4
|
||||
Wall of Wood (10E) *4
|
||||
Llanowar Elves (10E) *4
|
||||
Mirri, Cat Warrior (10E)
|
||||
Scion of the Wild (10E) *4
|
||||
Primal Rage (10E) *2
|
||||
|
||||
Lightning Elemental (10E) *4
|
||||
Shock (10E) *4
|
||||
Firebreathing (10E) *2
|
||||
Raging Goblin (10E) *4
|
||||
Anaba Bodyguard (10E) *4
|
||||
|
||||
@@ -29,6 +29,7 @@ class GameStateDuel: public GameState, public JGuiListener
|
||||
SimpleMenu * opponentMenu;
|
||||
SimpleMenu * menu;
|
||||
JLBFont* mFont, *opponentMenuFont;
|
||||
string playerDecksDir;
|
||||
|
||||
|
||||
void loadPlayer(int playerId, int decknb = 0, int isAI = 0);
|
||||
|
||||
@@ -74,6 +74,7 @@ void GameStateDuel::Start()
|
||||
|
||||
mGamePhase = DUEL_STATE_CHOOSE_DECK1;
|
||||
credits = NEW Credits();
|
||||
playerDecksDir = RESPATH"/player";
|
||||
|
||||
mFont = GameApp::CommonRes->GetJLBFont(Constants::MENU_FONT);
|
||||
mFont->SetBase(0);
|
||||
@@ -92,14 +93,18 @@ void GameStateDuel::Start()
|
||||
if (mParent->players[i] == PLAYER_TYPE_HUMAN){
|
||||
decksneeded = 1;
|
||||
deckmenu = NEW SimpleMenu(DUEL_MENU_CHOOSE_DECK, this, mFont, 35, 25, "Choose a Deck");
|
||||
int nbDecks = fillDeckMenu(deckmenu,RESPATH"/player");
|
||||
int nbDecks = fillDeckMenu(deckmenu,playerDecksDir);
|
||||
if (nbDecks) decksneeded = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (decksneeded)
|
||||
mGamePhase = DUEL_STATE_ERROR_NO_DECK;
|
||||
if (decksneeded){
|
||||
playerDecksDir = RESPATH"/player/premade";
|
||||
deckmenu->Add(-1,"Create your Deck!","Highly recommended to get\nthe full Wagic experience!");
|
||||
fillDeckMenu(deckmenu,playerDecksDir);
|
||||
}
|
||||
//mGamePhase = DUEL_STATE_ERROR_NO_DECK;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +126,7 @@ void GameStateDuel::loadPlayer(int playerId, int decknb, int isAI){
|
||||
if (decknb){
|
||||
if (!isAI){ //Human Player
|
||||
char deckFile[255];
|
||||
sprintf(deckFile, RESPATH"/player/deck%i.txt",decknb);
|
||||
sprintf(deckFile, "%s/deck%i.txt",playerDecksDir.c_str(), decknb);
|
||||
char deckFileSmall[255];
|
||||
sprintf(deckFileSmall, "player_deck%i",decknb);
|
||||
MTGDeck * tempDeck = NEW MTGDeck(deckFile, NULL, mParent->collection);
|
||||
@@ -408,6 +413,10 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
||||
}
|
||||
case DUEL_MENU_CHOOSE_DECK:
|
||||
{
|
||||
if (controlId < 0){
|
||||
mParent->SetNextState(GAME_STATE_DECK_VIEWER);
|
||||
return;
|
||||
}
|
||||
if (mGamePhase == DUEL_STATE_CHOOSE_DECK1){
|
||||
loadPlayer(0,controlId);
|
||||
deckmenu->Close();
|
||||
|
||||
@@ -507,6 +507,21 @@ int MTGDeck::save(){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("saving");
|
||||
#endif
|
||||
if (meta_name.size()){
|
||||
file << "#NAME:" << meta_name << '\n';
|
||||
}
|
||||
|
||||
if (meta_desc.size()){
|
||||
size_t found = 0;
|
||||
string desc= meta_desc;
|
||||
found = desc.find_first_of("\n");
|
||||
while(found != string::npos){
|
||||
file << "#DESC:" << desc.substr(0,found+1);
|
||||
desc=desc.substr(found+1);
|
||||
found = desc.find_first_of("\n");
|
||||
}
|
||||
file << "#DESC:" << desc << "\n";
|
||||
}
|
||||
map<int,int>::iterator it;
|
||||
for (it = cards.begin(); it!=cards.end(); it++){
|
||||
sprintf(writer,"%i\n", it->first);
|
||||
|
||||
Reference in New Issue
Block a user