From 3f58da224a3ddc8b99abbc67e6ce03eed8f239d7 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 4 Jan 2016 17:53:30 +0100 Subject: [PATCH] Spostati i define a costanti char, evitando casting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Non so se possa essere una buona idea... Ho provato però ed è più veloce di prima... --- main.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/main.cpp b/main.cpp index 09add48..a364b77 100644 --- a/main.cpp +++ b/main.cpp @@ -11,18 +11,18 @@ #define HP_MAX 50 #define MAX_POTIONS_PER_FLOOR 5 -#define WALL 0xB2 -#define EMPTY 0xFF -#define PLAYER 0x02 -#define ENEMY 'X' -#define EXIT '>' -#define DOUBLELINE 0xCD -#define ITEM_SMALL_POTION 'p' -#define ITEM_MEDIUM_POTION 'n' -#define ITEM_BIG_POTION 'm' - using namespace std; +const unsigned char WALL = 0xB2; +const unsigned char EMPTY = ' '; +const unsigned char PLAYER = 0x02; +const unsigned char ENEMY = 'X'; +const unsigned char EXIT = '>'; +const unsigned char DOUBLELINE = 0xCD; +const unsigned char ITEM_SMALL_POTION = 'p'; +const unsigned char ITEM_MEDIUM_POTION = 'n'; +const unsigned char ITEM_BIG_POTION = 'm'; + //Mappa del gioco unsigned char map[X_MAX][Y_MAX];