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

Merge pull request #2 from DefinetlyNotAI/master

Modified the code to allow balancing of the bet to the user
Daniel-dev-s 1 год назад
Родитель
Сommit
123425e528
1 измененных файлов с 10 добавлено и 2 удалено
  1. 10 2
      slotmachine.c

+ 10 - 2
slotmachine.c

@@ -73,8 +73,9 @@ static void highscores_save() {
     furi_record_close(RECORD_STORAGE);
     furi_record_close(RECORD_STORAGE);
 }
 }
 
 
+
 void game_results(SlotMachineApp* app) {
 void game_results(SlotMachineApp* app) {
-    int matches[] = {0, 0, 0, 0, 0};
+    int matches[] = { 0, 0, 0, 0, 0 };
     double total = 0;
     double total = 0;
 
 
     for (int i = 0; i < COLUMNS_COUNT; i++) {
     for (int i = 0; i < COLUMNS_COUNT; i++) {
@@ -88,10 +89,16 @@ void game_results(SlotMachineApp* app) {
     }
     }
 
 
     if (total > 0) {
     if (total > 0) {
-        app->money += total;
+        app->money += total; // Add winnings to the player's money
         app->winamount = total;
         app->winamount = total;
         app->winview = true;
         app->winview = true;
 
 
+        // Add the bet amount back to the player's money
+        app->money += app->bet;
+
+        // Reset the bet amount, uncomment me if you want to do this
+        //app->bet = 0;
+
         if (total > highscore.highscore) {
         if (total > highscore.highscore) {
             highscore.highscore = total;
             highscore.highscore = total;
             highscores_save();
             highscores_save();
@@ -103,6 +110,7 @@ void game_results(SlotMachineApp* app) {
     }
     }
 }
 }
 
 
+
 void draw_container(Canvas* canvas) {
 void draw_container(Canvas* canvas) {
     canvas_draw_rframe(canvas, 2, 12, 120, 34, 3);
     canvas_draw_rframe(canvas, 2, 12, 120, 34, 3);
     canvas_draw_rframe(canvas, 2, 13, 120, 34, 3);
     canvas_draw_rframe(canvas, 2, 13, 120, 34, 3);