Просмотр исходного кода

switch to uint16_t and uint8_t

jblanked 9 месяцев назад
Родитель
Сommit
79f1b07a47
2 измененных файлов с 4 добавлено и 4 удалено
  1. 3 3
      game/player.h
  2. 1 1
      game/storage.c

+ 3 - 3
game/player.h

@@ -47,7 +47,7 @@ typedef struct
     uint32_t strength;          // player strength
     uint32_t health;            // player health
     uint32_t max_health;        // player maximum health
-    uint32_t health_regen;      // player health regeneration rate per second/frame
+    uint8_t health_regen;       // player health regeneration rate per second/frame
     float elapsed_health_regen; // time elapsed since last health regeneration
     float attack_timer;         // Cooldown duration between attacks
     float elapsed_attack_timer; // Time elapsed since the last attack
@@ -91,8 +91,8 @@ typedef struct
     bool is_switching_level;
     bool is_menu_open;
     //
-    uint32_t elapsed_button_timer;
-    uint32_t last_button;
+    uint16_t elapsed_button_timer;
+    uint8_t last_button;
     //
     GameMenuScreen menu_screen;
     uint8_t menu_selection;

+ 1 - 1
game/storage.c

@@ -310,7 +310,7 @@ static FuriString *player_context_json(PlayerContext *player_context, bool webso
 
         // 7. Health Regen
         furi_string_cat_str(json, "\"health_regen\":");
-        snprintf(buffer, sizeof(buffer), "%lu", player_context->health_regen);
+        snprintf(buffer, sizeof(buffer), "%u", player_context->health_regen);
         furi_string_cat_str(json, buffer);
         furi_string_cat_str(json, ",");