Jeck - Fix signed/unsigned in AllAbilities (please review), bug fixes for trophy room (new status now saves).

This commit is contained in:
wagic.jeck
2009-12-13 14:36:58 +00:00
parent 0d39c0177d
commit 608255e251
5 changed files with 23 additions and 5 deletions
+2 -2
View File
@@ -1706,7 +1706,7 @@ class AAsLongAs:public ListMaintainerAbility{
int resolve(){ int resolve(){
//TODO check if ability is oneShot ? //TODO check if ability is oneShot ?
updateTargets(); updateTargets();
size_t size = cards.size(); int size = (int) cards.size();
if (maxi && size < maxi && (!mini || size > mini)) addAbilityToGame(); //special case for 0 if (maxi && size < maxi && (!mini || size > mini)) addAbilityToGame(); //special case for 0
cards.clear(); cards.clear();
players.clear(); players.clear();
@@ -1733,7 +1733,7 @@ class AAsLongAs:public ListMaintainerAbility{
} }
int _added(Damageable * d){ int _added(Damageable * d){
size_t size = cards.size(); int size = (int) cards.size();
if (maxi && size >= maxi) return removeAbilityFromGame(); if (maxi && size >= maxi) return removeAbilityFromGame();
if (maxi) return 0; if (maxi) return 0;
if (size <= mini) return 0; if (size <= mini) return 0;
+2 -1
View File
@@ -113,11 +113,12 @@ public:
class GameOptionAward: public GameOption { class GameOptionAward: public GameOption {
public: public:
GameOptionAward();
virtual string menuStr(); virtual string menuStr();
virtual bool write(std::ofstream * file, string name); virtual bool write(std::ofstream * file, string name);
virtual bool read(string input); virtual bool read(string input);
virtual bool giveAward(); //Returns false if already awarded virtual bool giveAward(); //Returns false if already awarded
virtual bool isViewed() {return viewed;}; virtual bool isViewed();
virtual void setViewed(bool v = true) {viewed = v;}; virtual void setViewed(bool v = true) {viewed = v;};
private: private:
time_t achieved; //When was it awarded? time_t achieved; //When was it awarded?
+1
View File
@@ -20,6 +20,7 @@ class GameStateAwards: public GameState, public JGuiListener
SimpleMenu * menu; SimpleMenu * menu;
bool showMenu; bool showMenu;
bool showAlt; bool showAlt;
bool saveMe;
int mState; int mState;
int mDetailItem; int mDetailItem;
+15 -1
View File
@@ -717,6 +717,11 @@ OptionDifficulty::OptionDifficulty(){
}; };
//GameOptionAward //GameOptionAward
GameOptionAward::GameOptionAward(){
achieved = time(NULL);
number = 0;
viewed = false;
}
bool GameOptionAward::read(string input){ bool GameOptionAward::read(string input){
//This is quick and dirty. //This is quick and dirty.
bool bNumeric = true; bool bNumeric = true;
@@ -806,6 +811,12 @@ bool GameOptionAward::giveAward(){
number = 1; number = 1;
return true; return true;
} }
bool GameOptionAward::isViewed(){
if(!number)
return true;
return viewed;
};
string GameOptionAward::menuStr(){ string GameOptionAward::menuStr(){
if(!number) if(!number)
return _("Not unlocked."); return _("Not unlocked.");
@@ -815,6 +826,9 @@ string GameOptionAward::menuStr(){
char buf[256]; char buf[256];
Translator * t = Translator::GetInstance(); Translator * t = Translator::GetInstance();
strftime(buf,255,_("%B %d, %I:%M%p %Y").c_str(),localtime(&achieved)); tm * lt = localtime(&achieved);
if(!lt)
return "Error";
strftime(buf,255,_("%B %d, %I:%M%p %Y").c_str(),lt);
return buf; return buf;
} }
+3 -1
View File
@@ -30,7 +30,8 @@ void GameStateAwards::End()
SAFE_DELETE(listview); SAFE_DELETE(listview);
SAFE_DELETE(setSrc); SAFE_DELETE(setSrc);
//TODO Memoize viewed status here. if(saveMe)
options.save();
} }
void GameStateAwards::Start() void GameStateAwards::Start()
{ {
@@ -38,6 +39,7 @@ void GameStateAwards::Start()
mState = STATE_LISTVIEW; mState = STATE_LISTVIEW;
menu = NULL; menu = NULL;
saveMe = options.newAward();
listview = NEW WGuiList("Listview"); listview = NEW WGuiList("Listview");
listview->setX(210); listview->setX(210);