summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-10-19 21:40:18 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-10-19 21:40:18 +0000
commita055fb3bf5b5b015cbc6dd4f1f5d78b49fc726d5 (patch)
tree3922d8a93de0e0fccd44c4b4d4787e32ce1571c7
parent6e200ea6732929f8af2d5c1c839ed4de7f427cdc (diff)
add etrophy_trophy_counter_set for when you know the value you want to set and don't want to deal with calculating the amount to increment because you're lazy and calculating is for people with too much time on their hands
SVN revision: 78270
-rw-r--r--src/lib/Etrophy.h1
-rw-r--r--src/lib/etrophy.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/Etrophy.h b/src/lib/Etrophy.h
index fa89557..918ae7f 100644
--- a/src/lib/Etrophy.h
+++ b/src/lib/Etrophy.h
@@ -63,6 +63,7 @@ EAPI const char *etrophy_trophy_name_get(const Etrophy_Trophy *tro
63EAPI const char *etrophy_trophy_description_get(const Etrophy_Trophy *trophy); 63EAPI const char *etrophy_trophy_description_get(const Etrophy_Trophy *trophy);
64EAPI Etrophy_Trophy_Visibility etrophy_trophy_visibility_get(const Etrophy_Trophy *trophy); 64EAPI Etrophy_Trophy_Visibility etrophy_trophy_visibility_get(const Etrophy_Trophy *trophy);
65EAPI void etrophy_trophy_goal_get(const Etrophy_Trophy *trophy, unsigned int *goal, unsigned int *counter); 65EAPI void etrophy_trophy_goal_get(const Etrophy_Trophy *trophy, unsigned int *goal, unsigned int *counter);
66EAPI void etrophy_trophy_counter_set(Etrophy_Trophy *trophy, unsigned int value);
66EAPI void etrophy_trophy_counter_increment(Etrophy_Trophy *trophy, unsigned int value); 67EAPI void etrophy_trophy_counter_increment(Etrophy_Trophy *trophy, unsigned int value);
67EAPI Eina_Bool etrophy_trophy_earned_get(const Etrophy_Trophy *trophy); 68EAPI Eina_Bool etrophy_trophy_earned_get(const Etrophy_Trophy *trophy);
68EAPI unsigned int etrophy_trophy_date_get(const Etrophy_Trophy *trophy); 69EAPI unsigned int etrophy_trophy_date_get(const Etrophy_Trophy *trophy);
diff --git a/src/lib/etrophy.c b/src/lib/etrophy.c
index dbca991..333a3df 100644
--- a/src/lib/etrophy.c
+++ b/src/lib/etrophy.c
@@ -188,6 +188,21 @@ etrophy_trophy_goal_get(const Etrophy_Trophy *trophy, unsigned int *goal,
188} 188}
189 189
190EAPI inline void 190EAPI inline void
191etrophy_trophy_counter_set(Etrophy_Trophy *trophy, unsigned int value)
192{
193 EINA_SAFETY_ON_NULL_RETURN(trophy);
194
195 if (trophy->counter == trophy->goal) return;
196 if (trophy->counter >= value) return;
197
198 trophy->counter = value;
199 if (trophy->counter > trophy->goal)
200 trophy->counter = trophy->goal;
201
202 trophy->date = (unsigned int)ecore_time_get();
203}
204
205EAPI inline void
191etrophy_trophy_counter_increment(Etrophy_Trophy *trophy, unsigned int value) 206etrophy_trophy_counter_increment(Etrophy_Trophy *trophy, unsigned int value)
192{ 207{
193 EINA_SAFETY_ON_NULL_RETURN(trophy); 208 EINA_SAFETY_ON_NULL_RETURN(trophy);