From 05c370feb49d9aefbcf89e869178a9973889c30b Mon Sep 17 00:00:00 2001 From: onpon4 Date: Tue, 17 Mar 2015 16:54:00 -0400 Subject: [PATCH] Capitalized "max" and "min" macros. --- src/bullet.cpp | 2 +- src/collectable.cpp | 2 +- src/defs.h | 4 ++-- src/intermission.cpp | 7 ++++--- src/misc.cpp | 2 +- src/player.cpp | 8 ++++---- src/shop.cpp | 8 +++++--- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/bullet.cpp b/src/bullet.cpp index 0126226..e6c3383 100644 --- a/src/bullet.cpp +++ b/src/bullet.cpp @@ -108,7 +108,7 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy) { tempX = (int)fabsf(attacker->target->x - attacker->x); tempY = (int)fabsf(attacker->target->y - attacker->y); - steps = max(tempX, tempY); + steps = MAX(tempX, tempY); if (steps < 12) steps = 12; diff --git a/src/collectable.cpp b/src/collectable.cpp index 04645be..8479d11 100644 --- a/src/collectable.cpp +++ b/src/collectable.cpp @@ -72,7 +72,7 @@ void addCollectable(float x, float y, int type, int value, int life) } if (type == P_SUPER) - value = max(value, 1); + value = MAX(value, 1); if (value == 0) return; // don't bother! diff --git a/src/defs.h b/src/defs.h index 81922ce..3dcb3d3 100644 --- a/src/defs.h +++ b/src/defs.h @@ -20,8 +20,8 @@ along with this program. If not, see . #ifndef DEFS_H #define DEFS_H -#define min(a, b) ((a) < (b) ? (a) : (b)) -#define max(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) // ALL #define NONE 0 diff --git a/src/intermission.cpp b/src/intermission.cpp index 469f730..86d8adf 100644 --- a/src/intermission.cpp +++ b/src/intermission.cpp @@ -529,11 +529,12 @@ int galaxyMap() // Remove the Supercharge, if it is there if (currentGame.difficulty > DIFFICULTY_EASY) { - weapon[W_PLAYER_WEAPON].reload[0] = max(weapon[W_PLAYER_WEAPON].reload[0], + weapon[W_PLAYER_WEAPON].reload[0] = MAX( + weapon[W_PLAYER_WEAPON].reload[0], rate2reload[currentGame.maxPlasmaRate]); - weapon[W_PLAYER_WEAPON].ammo[0] = min(weapon[W_PLAYER_WEAPON].ammo[0], + weapon[W_PLAYER_WEAPON].ammo[0] = MIN(weapon[W_PLAYER_WEAPON].ammo[0], currentGame.maxPlasmaOutput); - weapon[W_PLAYER_WEAPON].damage = min(weapon[W_PLAYER_WEAPON].damage, + weapon[W_PLAYER_WEAPON].damage = MIN(weapon[W_PLAYER_WEAPON].damage, currentGame.maxPlasmaDamage); } diff --git a/src/misc.cpp b/src/misc.cpp index 7d92aff..8489807 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -97,7 +97,7 @@ static void doArrow(int i) float sx = fabsf((x - (screen->w / 2)) / (screen->w / 2.0)); float sy = fabsf((y - (screen->h / 2)) / (screen->h / 2.0)); - float sxy = max(sx, sy); + float sxy = MAX(sx, sy); if (sxy < 1) return; diff --git a/src/player.cpp b/src/player.cpp index c737073..94df121 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -249,13 +249,13 @@ void doPlayer() cd = player.x - screen->w / 2; if (cd < 0) { - cc = max(cd / 10, max(0, engine.ssx) - cameraMaxSpeed); + cc = MAX(cd / 10, MAX(0, engine.ssx) - cameraMaxSpeed); player.x -= cc; engine.smx -= cc; } else if (cd > 0) { - cc = min(cd / 10, cameraMaxSpeed + min(0, engine.ssx)); + cc = MIN(cd / 10, cameraMaxSpeed + MIN(0, engine.ssx)); player.x -= cc; engine.smx -= cc; } @@ -278,13 +278,13 @@ void doPlayer() cd = player.y - screen->h / 2; if (cd < 0) { - cc = max(cd / 10, max(0, engine.ssy) - cameraMaxSpeed); + cc = MAX(cd / 10, MAX(0, engine.ssy) - cameraMaxSpeed); player.y -= cc; engine.smy -= cc; } else if (cd > 0) { - cc = min(cd / 10, cameraMaxSpeed + min(0, engine.ssy)); + cc = MIN(cd / 10, cameraMaxSpeed + MIN(0, engine.ssy)); player.y -= cc; engine.smy -= cc; } diff --git a/src/shop.cpp b/src/shop.cpp index 46095c6..5c4cb3e 100644 --- a/src/shop.cpp +++ b/src/shop.cpp @@ -787,7 +787,8 @@ static void sell(int i) sell(SHOP_PLASMA_MIN_OUTPUT); currentGame.maxPlasmaOutput--; - weapon[W_PLAYER_WEAPON].ammo[0] = min(weapon[W_PLAYER_WEAPON].ammo[0], + weapon[W_PLAYER_WEAPON].ammo[0] = MIN( + weapon[W_PLAYER_WEAPON].ammo[0], currentGame.maxPlasmaOutput); break; @@ -802,7 +803,8 @@ static void sell(int i) sell(SHOP_PLASMA_MIN_DAMAGE); currentGame.maxPlasmaDamage--; - weapon[W_PLAYER_WEAPON].damage = min(weapon[W_PLAYER_WEAPON].damage, + weapon[W_PLAYER_WEAPON].damage = MIN( + weapon[W_PLAYER_WEAPON].damage, currentGame.maxPlasmaDamage); break; @@ -817,7 +819,7 @@ static void sell(int i) sell(SHOP_PLASMA_MIN_OUTPUT); currentGame.maxPlasmaRate--; - weapon[W_PLAYER_WEAPON].reload[0] = max( + weapon[W_PLAYER_WEAPON].reload[0] = MAX( weapon[W_PLAYER_WEAPON].reload[0], rate2reload[currentGame.maxPlasmaRate]); break;