ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18gs

Dependencies:   mbed

Revision:
8:4220d116f17c
Parent:
7:220d3ebf74cf
Child:
12:8666cd2c6201
diff -r 220d3ebf74cf -r 4220d116f17c Inventory/Ghost/Ghost.h
--- a/Inventory/Ghost/Ghost.h	Mon May 11 18:28:37 2020 +0000
+++ b/Inventory/Ghost/Ghost.h	Mon May 11 18:58:07 2020 +0000
@@ -67,38 +67,44 @@
     /** Create a Ghost object by importing a .ghost file
     * @param path The name of the .ghost file to import
     * @param root The directory to look for the file in
+    * @param sd Pointer to an SDFileSystem object
     */
-    Ghost(const std::string path, const std::string root);
+    Ghost(const std::string path, const std::string root, SDFileSystem &sd);
     
     /** Create a Ghost object using two numbers to define its type and name
     * @param type an interger number between 0 and 100 to define the type of ghost
     * @param nameNumber an integer number between 0 and 20 to define the name of the ghost
     * @param root the directory to save the Ghost object in
+    * @param sd Pointer to an SDFileSystem object
     * @note this constructor will save the object as a .ghost file using the @ref save(void)
     * @note the UID (Unique ID) of this object will be generated by @ref gen_uid(void)
     */
-    Ghost(int type, int nameNumber, const std::string root);
+    Ghost(int type, int nameNumber, const std::string root, SDFileSystem &sd);
     
     /** List all files in the directory path passed
     * @param Path directory to list
+    * @param sd Pointer to an SDFileSystem object
     */
-    void listdir(std::string path);
+    void listdir(std::string path, SDFileSystem &sd);
     
     /** Save the current ghost
+    * @param sd Pointer to an SDFileSystem object
     * @note save the current ghost as a .ghost file, the name of the file is the UID
     */
-    void save(void);
+    void save(SDFileSystem &sd);
     
     /** 'Sell' the ghost, in reality this means deleting its file and returning the value of the ghost
+    * @param sd Pointer to an SDFileSystem object
     * @return an integer
     */
-    int sell(void);
+    int sell(SDFileSystem &sd);
     
     /** 'feed' the ghost, this means give it XP equal to the ammount passed
     * @param ammount of food to feed, this is equal to the xp increase
+    * @param sd Pointer to an SDFileSystem object
     * @note after this function the ghost will be saved using @ref save()
     */
-    void feed(int ammount);
+    void feed(int ammount, SDFileSystem &sd);
     
     /** Print all the member variables over serial
     * @note primarily used in debugging & development, can be removed if more space needed in final version
@@ -173,12 +179,12 @@
 
 private:
     // Methods
-    int gen_uid(void);
+    int gen_uid(SDFileSystem &sd);
     bool hasEnding (std::string const &fullString, std::string const &ending);
 
     std::string type_to_string(Type type);
     Type string_to_type(std::string type);
-    void delete_file(const char filename[]);
+    void delete_file(const char filename[], SDFileSystem &sd);
 
     Type _type;
     std::string _name;