summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-10 21:50:20 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-10 21:50:20 +0000
commitf0aa0f725c1345cf9e109d5103befe997dad75b3 (patch)
treefb7fdc1b86c6bf5f711d80fd34a3d04a92f16f7a
parent9176b81a3d3bb37ef08c7af1d89a871c06cc88c8 (diff)
etrophy: just set trophies visibility instead of state
Trophies state shouldn't be binary anyway, since some works like counters. SVN revision: 77826
-rw-r--r--src/lib/Etrophy.h8
-rw-r--r--src/lib/etrophy.c23
2 files changed, 10 insertions, 21 deletions
diff --git a/src/lib/Etrophy.h b/src/lib/Etrophy.h
index 43d7c23..2b689ba 100644
--- a/src/lib/Etrophy.h
+++ b/src/lib/Etrophy.h
@@ -39,9 +39,8 @@ typedef struct _Etrophy_Trophy Etrophy_Trophy;
39typedef enum { 39typedef enum {
40 ETROPHY_TROPHY_STATE_HIDDEN = 0, 40 ETROPHY_TROPHY_STATE_HIDDEN = 0,
41 ETROPHY_TROPHY_STATE_VISIBLE, 41 ETROPHY_TROPHY_STATE_VISIBLE,
42 ETROPHY_TROPHY_STATE_EARNED,
43 ETROPHY_TROPHY_STATE_LAST_VALUE 42 ETROPHY_TROPHY_STATE_LAST_VALUE
44} Etrophy_Trophy_State; 43} Etrophy_Trophy_Visibility;
45 44
46typedef struct _Etrophy_Lock Etrophy_Lock; 45typedef struct _Etrophy_Lock Etrophy_Lock;
47typedef enum { 46typedef enum {
@@ -55,13 +54,12 @@ typedef struct _Etrophy_Level Etrophy_Level;
55typedef struct _Etrophy_Gamescore Etrophy_Gamescore; 54typedef struct _Etrophy_Gamescore Etrophy_Gamescore;
56 55
57/* Etrophy_Trophy */ 56/* Etrophy_Trophy */
58EAPI Etrophy_Trophy *etrophy_trophy_new(const char *name, const char *description, Etrophy_Trophy_State state); 57EAPI Etrophy_Trophy *etrophy_trophy_new(const char *name, const char *description, Etrophy_Trophy_Visibility visibility);
59EAPI void etrophy_trophy_free(Etrophy_Trophy *trophy); 58EAPI void etrophy_trophy_free(Etrophy_Trophy *trophy);
60 59
61EAPI const char *etrophy_trophy_name_get(const Etrophy_Trophy *trophy); 60EAPI const char *etrophy_trophy_name_get(const Etrophy_Trophy *trophy);
62EAPI const char *etrophy_trophy_description_get(const Etrophy_Trophy *trophy); 61EAPI const char *etrophy_trophy_description_get(const Etrophy_Trophy *trophy);
63EAPI void etrophy_trophy_state_set(Etrophy_Trophy *trophy, Etrophy_Trophy_State state); 62EAPI Etrophy_Trophy_Visibility etrophy_trophy_visibility_get(const Etrophy_Trophy *trophy);
64EAPI Etrophy_Trophy_State etrophy_trophy_state_get(const Etrophy_Trophy *trophy);
65EAPI unsigned int etrophy_trophy_date_get(const Etrophy_Trophy *trophy); 63EAPI unsigned int etrophy_trophy_date_get(const Etrophy_Trophy *trophy);
66 64
67/* Etrophy_Lock */ 65/* Etrophy_Lock */
diff --git a/src/lib/etrophy.c b/src/lib/etrophy.c
index 586aa86..eda69fb 100644
--- a/src/lib/etrophy.c
+++ b/src/lib/etrophy.c
@@ -51,7 +51,7 @@ struct _Etrophy_Trophy
51{ 51{
52 const char *name; 52 const char *name;
53 const char *description; 53 const char *description;
54 Etrophy_Trophy_State state; 54 Etrophy_Trophy_Visibility visibility;
55 unsigned int date; 55 unsigned int date;
56}; 56};
57 57
@@ -106,7 +106,7 @@ _trophy_init(void)
106 EET_DATA_DESCRIPTOR_ADD_BASIC(_trophy_descriptor, Etrophy_Trophy, 106 EET_DATA_DESCRIPTOR_ADD_BASIC(_trophy_descriptor, Etrophy_Trophy,
107 "description", description, EET_T_STRING); 107 "description", description, EET_T_STRING);
108 EET_DATA_DESCRIPTOR_ADD_BASIC(_trophy_descriptor, Etrophy_Trophy, 108 EET_DATA_DESCRIPTOR_ADD_BASIC(_trophy_descriptor, Etrophy_Trophy,
109 "state", state, EET_T_UINT); 109 "visibility", visibility, EET_T_UINT);
110 EET_DATA_DESCRIPTOR_ADD_BASIC(_trophy_descriptor, Etrophy_Trophy, 110 EET_DATA_DESCRIPTOR_ADD_BASIC(_trophy_descriptor, Etrophy_Trophy,
111 "date", date, EET_T_UINT); 111 "date", date, EET_T_UINT);
112} 112}
@@ -120,7 +120,7 @@ _trophy_shutdown(void)
120} 120}
121 121
122EAPI Etrophy_Trophy * 122EAPI Etrophy_Trophy *
123etrophy_trophy_new(const char *name, const char *description, Etrophy_Trophy_State state) 123etrophy_trophy_new(const char *name, const char *description, Etrophy_Trophy_Visibility visibility)
124{ 124{
125 Etrophy_Trophy *trophy = calloc(1, sizeof(Etrophy_Trophy)); 125 Etrophy_Trophy *trophy = calloc(1, sizeof(Etrophy_Trophy));
126 126
@@ -132,7 +132,7 @@ etrophy_trophy_new(const char *name, const char *description, Etrophy_Trophy_Sta
132 132
133 trophy->name = eina_stringshare_add(name); 133 trophy->name = eina_stringshare_add(name);
134 trophy->description = eina_stringshare_add(description); 134 trophy->description = eina_stringshare_add(description);
135 trophy->state = state; 135 trophy->visibility = visibility;
136 trophy->date = (unsigned int) ecore_time_get(); 136 trophy->date = (unsigned int) ecore_time_get();
137 137
138 return trophy; 138 return trophy;
@@ -158,19 +158,10 @@ etrophy_trophy_description_get(const Etrophy_Trophy *trophy)
158 return trophy->description; 158 return trophy->description;
159} 159}
160 160
161EAPI inline Etrophy_Trophy_State 161EAPI inline Etrophy_Trophy_Visibility
162etrophy_trophy_state_get(const Etrophy_Trophy *trophy) 162etrophy_trophy_visibility_get(const Etrophy_Trophy *trophy)
163{ 163{
164 return trophy->state; 164 return trophy->visibility;
165}
166
167EAPI inline void
168etrophy_trophy_state_set(Etrophy_Trophy *trophy, Etrophy_Trophy_State state)
169{
170 EINA_SAFETY_ON_NULL_RETURN(trophy);
171 if (state >= ETROPHY_TROPHY_STATE_LAST_VALUE) return;
172 trophy->state = state;
173 trophy->date = (unsigned int) ecore_time_get();
174} 165}
175 166
176EAPI inline unsigned int 167EAPI inline unsigned int