]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mood.c
aft.c: Kill somce dead code.
[paraslash.git] / mood.c
diff --git a/mood.c b/mood.c
index fd82ba4abb2b6419c3519fe3ec1ed29075912910..a89ae85f4c102b6078ae1d76a0919e52b47af20c 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -912,6 +912,20 @@ static void log_statistics(void)
                (long long unsigned)int_sqrt(statistics.num_played_qd / n));
 }
 
+/**
+ * Close the current mood.
+ *
+ * Free all resources of the current mood which were allocated during
+ * mood_open().
+ */
+void close_current_mood(void)
+{
+       destroy_mood(current_mood);
+       current_mood = NULL;
+       memset(&statistics, 0, sizeof(statistics));
+}
+
+
 /**
  * Change the current mood.
  *
@@ -951,10 +965,10 @@ int change_current_mood(char *mood_name)
                ret = load_mood(row, &m);
                if (ret < 0)
                        return ret;
-               destroy_mood(current_mood);
+               close_current_mood();
                current_mood = m;
        } else {
-               destroy_mood(current_mood);
+               close_current_mood();
                current_mood = alloc_new_mood("dummy");
        }
        aa.m = current_mood;
@@ -972,25 +986,11 @@ int change_current_mood(char *mood_name)
                        goto out;
        }
        PARA_NOTICE_LOG("score add complete\n");
-       ret = 1;
+       ret = statistics.num;
 out:
        free(aa.array);
        return ret;
 }
-
-/**
- * Close the current mood.
- *
- * Free all resources of the current mood which were allocated during
- * mood_open().
- */
-static void close_current_mood(void)
-{
-       destroy_mood(current_mood);
-       current_mood = NULL;
-       memset(&statistics, 0, sizeof(statistics));
-}
-
 /**
  * Close and re-open the current mood.
  *
@@ -1015,9 +1015,6 @@ int reload_current_mood(void)
        if (current_mood->name)
                mood_name = para_strdup(current_mood->name);
        close_current_mood();
-       ret = clear_score_table();
-       if (ret < 0)
-               return ret;
        ret = change_current_mood(mood_name);
        free(mood_name);
        return ret;