Fixed. Had to clear the DeckManager whenever the player deck selection screen is displayed.
TODO: Need to implement a caching mechanism that caches the deck information based on deck selection and not a global one.
Currently DeckManager is effectively treating the DeckMetaData as global data.
*some minor tweaks to how deck information is managed/created
* changed how the avatar images are assigned since how they were before was incorrect. They are now assigned upon instantiation of the meta file. Not when the stats are calculated.
* Added new image for "Evil Twin". This is a horizontally flipped image of the original player avatar with a red background. Please feel free to edit the image.
* removed display of avatar image on menu items in deck selection that are not deck related. (ie "Cancel", "Back to Main Menu", etc) "New Deck" also does not have an image since no deck really exists yet so no avatar.
Issue: 622
* getCardByName seemed to have a initialization error if you tried to use it before the entire game loaded. The cache would
throw an exception if you tried to use find and it was empty. I put a guard around it to avoid this issue.
* refactored Zeth's "toggledifficuly" feature to be stored in meta data. http://code.google.com/p/wagic/source/detail?r=3106
-- This is slightly modified as it forces a 1 for 1 swap of cards that are specified.
from the example given this is how it seemed to be used anyways.
-- since all the information is stored in the meta data, there's no need to alter the deck's
definition.
stats generation. No data needs to be written to the deck master files themselves.
Now the mana colors will only show if you have battled with a particular deck at least once.
This is not retroactive, so you will need to battle the ai again. This can not be edited manually
either to prevent tampering with the statistical data. Player deck mana color display is also
covered this way.
Decks will still be saved in the new layout if a disk write is necessary. So any changes via
the deck editor will result in a deck file rewrite is was always the case.:)
* added additional meta data for decks when saving them back to file.
- decks saved this way now are split into three regions: creatures, spells and lands. It's more for a visual sorting if a
player wanted to look at the deck outside of the game. It does not impact the deck loading negatively at all. It may
increase performance in cases where the deck was previously defined using the canonical names of the cards as the numeric ids
reduce the work done when looking up the cards by name.
* modified ManaCost toString method.
* added toString method for ManaCostHybrid ( possibly make ManaCostHybrid a subclass of ManaCost)
* added additional operator overloading for ManaCost for printing to cover ManaCost when it's a pointer as well as a copy
( TODO: might want to check if making usage of ManaCost as a copy as opposed to a ptr is really necessary in most cases. )
* added alternate version of "trim" to handle trimming temporary strings as returned by things like ostringstream.str().
- This was necessary since the PSP compiler doesn't do the necessary adjustments for those types of calls.
deck files in long format. This is not configurable from the game. It must be set manually
inside options.txt.
ie. saveDetailedDeckInfo=1
* added extra debug information (line number inside text file) when card parser fails to recognize a line.
- modified return value from "processConfLine()" to return 0 only when a true error occurs and print out
"MTGDeck: Bad Line:
[<line no>]: <line with error>"
- processConfLine will now return 1 for lines starting with "#". Previously it returned 0 which is incorrect
as comments should not be considered as errors.
* removed DeckMetaDataList class from code. This was duplicating the DeckMetaData storage in DeckManager
* new feature for deck selection screens.
- player decks will now have an indication of what mana color it consists of.
- Ai decks will show symbols once the player has played against the AI deck at least once.
-- This is made possible with a new meta data inside each deck file.
MANA:<string representing color switches - 0/1 >
This still could be improved - DeckMetaData's constructor loads an MTGDeck object to parse out the name of a deck from its file. This means that we crack open 106 files on the first attempt to show the list of opponent decks. I started optimizing this, but reverted, as the list itself is sorted alphabetically. Currently, with these mods, it's still taking 4 1/2 seconds on my psp to load the opponent list on the first go around.
While at it, did some cleanup - removed the need for passing around a player pointer in some of the DeckStat functions, etc.
fixed some layout issues with detailed info popup
changed requirements for detailed info popup button to be determined by the number of wins aginst AI deck instead of just the number of games.
new ability lord...teach(whatever[whatever]) ability.
teach is a targeted lord, it takes the cards current target and lords it the ability. im aware of a tiny memleak it contains, but the leak is happening on parser lvl, so i need more eyes to look at it. teach is ideally used for equipment, and was designed to fix issue 244 taught abilities are not given to the source cards.
forced Ai to pay for sunburst correctly. it was choosing to pay with all of one type of mana. now it pays either max or 1 from max sunburst.
added a tiny double check for Ai to try and find something to use if it suddenly has mana in its pool. it is only a single check in a turn, but i notice it actually does slightly improve the usages of dark ritual and foreach mana producers. ideally i wanted it to check EVERYTIME. but i could not achieve it without putting the game in danger of looping. so once is better then none :/
fixed a bug with affinity where it was not counting duel lands, this is becuase of not setting it up correctly for lands with multiple types SORRY!
installed a horizontal text scroller for the deck selection screens in normal play
TODO:-> Need to make it smoother transition. It currently just replaces the text with the new text.
TODO:
change literals to use constants,
refactor the rendering code for the menu to have be leaner.
add text scroller to list all the tasks.
* 1st implementation will list all the tasks.dat
* 2nd round will try to get the scroller to only display relevant tasks to ai
Special thanks to wololo and MootPoint for helping me hammer this out. To abrasax, for the initial design of the layout.
Also fixed the project includes so that we don't need to always use the indirect include path, ie:
#include "../include/foo.h" -> #include "foo.h"
I'm don't know much about make files - if I busted the linux build, mea culpa, but I think we're okay on that front too. For future reference, here's the most straightforward link on the topic of adding pch support to make files:
http://www.mercs-eng.com/~hulud/index.php?2008/06/13/6-writing-a-good-makefile-for-a-c-project