From 2c7050d437239e1aac81135b2a52ae8bcffe8c19 Mon Sep 17 00:00:00 2001 From: jsalmon3 <> Date: Thu, 2 Oct 2003 14:39:32 +0000 Subject: [PATCH] Cleanup --- src/game/game.cpp | 6 +++--- src/game/intro.cpp | 42 +++++++++++++++++++++--------------------- src/game/loadgame.cpp | 8 ++++---- src/game/trigger.cpp | 18 +++++++----------- 4 files changed, 35 insertions(+), 39 deletions(-) diff --git a/src/game/game.cpp b/src/game/game.cpp index 0bd00dec1..43ab292f1 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -88,7 +88,7 @@ local int LcmPreventRecurse; /// prevent recursion through LoadGameMap ** @param map map loaded */ local void LoadStratagusMap(const char* filename, - WorldMap* map __attribute__((unused))) + WorldMap* map __attribute__((unused))) { DebugLevel3Fn("%p \n" _C_ map); @@ -104,7 +104,7 @@ local void LoadStratagusMap(const char* filename, #if 0 // Not true if multiplayer levels! if (!ThisPlayer) { /// ARI: bomb if nothing was loaded! - fprintf(stderr,"%s: invalid Stratagus map\n", filename); + fprintf(stderr, "%s: invalid Stratagus map\n", filename); ExitFatal(-1); } // FIXME: Retrieve map->Info from somewhere... If LoadPud is used in CCL it magically is set there :) @@ -507,7 +507,7 @@ global void CreateGame(char* filename, WorldMap* map) } #endif ViewportCenterViewpoint(TheUI.SelectedViewport, - ThisPlayer->StartX, ThisPlayer->StartY); + ThisPlayer->StartX, ThisPlayer->StartY); // // Various hacks wich must be done after the map is loaded. diff --git a/src/game/intro.cpp b/src/game/intro.cpp index 845a674f3..09c5b649a 100644 --- a/src/game/intro.cpp +++ b/src/game/intro.cpp @@ -105,10 +105,10 @@ local int ContinueButtonFlags; /// Flags for continue button local void IntroCallbackButton1(unsigned button) { if (UseContinueButton) { - if ((1 << button) == LeftButton && ContinueButtonX <= CursorX - && CursorX <= ContinueButtonX + 106 - && ContinueButtonY <= CursorY - && CursorY <= ContinueButtonY + 27) { + if ((1 << button) == LeftButton && ContinueButtonX <= CursorX && + CursorX <= ContinueButtonX + 106 && + ContinueButtonY <= CursorY && + CursorY <= ContinueButtonY + 27) { ContinueButtonFlags |= MenuButtonClicked; } } else { @@ -123,11 +123,11 @@ local void IntroCallbackButton1(unsigned button) local void IntroCallbackButton2(unsigned button) { if (UseContinueButton) { - if ((1 << button) == LeftButton && ContinueButtonX <= CursorX - && CursorX <= ContinueButtonX + 106 - && ContinueButtonY <= CursorY - && CursorY <= ContinueButtonY + 27 - && (ContinueButtonFlags & MenuButtonClicked)) { + if ((1 << button) == LeftButton && ContinueButtonX <= CursorX && + CursorX <= ContinueButtonX + 106 && + ContinueButtonY <= CursorY && + CursorY <= ContinueButtonY + 27 && + (ContinueButtonFlags & MenuButtonClicked)) { IntroNoEvent = 0; } ContinueButtonFlags &= ~MenuButtonClicked; @@ -171,7 +171,7 @@ local void IntroCallbackKey2(unsigned key, unsigned keychar) ** Callback for input. */ local void IntroCallbackKey3(unsigned key __attribute__((unused)), - unsigned keychar __attribute__((unused))) + unsigned keychar __attribute__((unused))) { } @@ -184,8 +184,8 @@ local void IntroCallbackMouse(int x, int y) CursorY = y; if (UseContinueButton) { - if( ContinueButtonX <= CursorX && CursorX <= ContinueButtonX + 106 && - ContinueButtonY <= CursorY && CursorY <= ContinueButtonY + 27 ) { + if (ContinueButtonX <= CursorX && CursorX <= ContinueButtonX + 106 && + ContinueButtonY <= CursorY && CursorY <= ContinueButtonY + 27) { ContinueButtonFlags |= MenuButtonActive; } else { @@ -493,20 +493,20 @@ global void ShowIntro(const Intro* intro) // Draw background // VideoDrawSubClip(background, 0, 0, - background->Width, background->Height, - (VideoWidth - background->Width) / 2, - (VideoHeight - background->Height) / 2); + background->Width, background->Height, + (VideoWidth - background->Width) / 2, + (VideoHeight - background->Height) / 2); // // Draw title // SetDefaultTextColors(FontWhite, FontYellow); - VideoDrawTextCentered((70 + 340) / 2 * VideoWidth / 640, 28 * VideoHeight / 480, - LargeFont,intro->Title); + VideoDrawTextCentered((70 + 340) / 2 * VideoWidth / 640, + 28 * VideoHeight / 480, LargeFont, intro->Title); // // Draw scrolling text // - ScrollText(70 * VideoWidth / 640, 80 * VideoHeight / 480, 70 * VideoWidth / 640 + 320, - 170 * VideoHeight / 480, line, scrolling_text); + ScrollText(70 * VideoWidth / 640, 80 * VideoHeight / 480, + 70 * VideoWidth / 640 + 320, 170 * VideoHeight / 480, line, scrolling_text); // // Draw objectives @@ -1389,7 +1389,7 @@ local SCM CclCredits(SCM list) GameCredits.Names = (char*)malloc(1); GameCredits.Names[0] = '\0'; } - len=0; + len = 0; while (!gh_null_p(list)) { value = gh_car(list); @@ -1401,7 +1401,7 @@ local SCM CclCredits(SCM list) } if (gh_eq_p(value, gh_symbol2scm("name")) || gh_eq_p(value, gh_symbol2scm("title")) || - gh_eq_p(value, gh_symbol2scm("comment")) ) { + gh_eq_p(value, gh_symbol2scm("comment"))) { n = get_c_string(gh_car(list)); nlen = strlen(n); GameCredits.Names = (char*)realloc(GameCredits.Names, len + nlen + 2); diff --git a/src/game/loadgame.cpp b/src/game/loadgame.cpp index be16f6c36..1438a9cec 100644 --- a/src/game/loadgame.cpp +++ b/src/game/loadgame.cpp @@ -180,11 +180,11 @@ global void LoadModules(void) MapUnitSounds(); InitAStar(); #ifdef WITH_SOUND - if (SoundFildes!=-1) { + if (SoundFildes != -1) { //FIXME: must be done after map is loaded - if ( InitSoundServer() ) { - SoundOff=1; - SoundFildes=-1; + if (InitSoundServer()) { + SoundOff = 1; + SoundFildes = -1; } else { // must be done after sounds are loaded InitSoundClient(); diff --git a/src/game/trigger.cpp b/src/game/trigger.cpp index e29ea3d04..bfb8ee522 100644 --- a/src/game/trigger.cpp +++ b/src/game/trigger.cpp @@ -165,7 +165,7 @@ local CompareFunction GetCompareFunction(const char* op) return &CompareEq; } } else if (op[0] == '>') { - if (op[1] == '=' && op[2] == '\0' ) { + if (op[1] == '=' && op[2] == '\0') { return &CompareGrEq; } else if (op[1] == '\0') { return &CompareGr; @@ -176,7 +176,7 @@ local CompareFunction GetCompareFunction(const char* op) } else if (op[1] == '\0') { return &CompareLe; } - } else if (op[0] == '!' && op[1] == '=' && op[2] == '\0' ) { + } else if (op[0] == '!' && op[1] == '=' && op[2] == '\0') { return &CompareNEq; } return NULL; @@ -376,13 +376,11 @@ local SCM CclIfNearUnit(SCM player, SCM operation, SCM quantity, SCM unit, // FIXME: Yes, but caller should check. // NOTE: +1 right,bottom isn't inclusive :( if (unit->Type->UnitType == UnitTypeLand) { - an = SelectUnits( - unit->X - 1, unit->Y - 1, + an = SelectUnits(unit->X - 1, unit->Y - 1, unit->X + unit->Type->TileWidth + 1, unit->Y + unit->Type->TileHeight + 1, around); } else { - an = SelectUnits( - unit->X - 2, unit->Y - 2, + an = SelectUnits(unit->X - 2, unit->Y - 2, unit->X + unit->Type->TileWidth + 2, unit->Y + unit->Type->TileHeight + 2, around); } @@ -470,13 +468,11 @@ local SCM CclIfRescuedNearUnit(SCM player, SCM operation, SCM quantity, SCM unit // FIXME: Yes, but caller should check. // NOTE: +1 right,bottom isn't inclusive :( if (unit->Type->UnitType == UnitTypeLand) { - an=SelectUnits( - unit->X - 1, unit->Y - 1, + an = SelectUnits(unit->X - 1, unit->Y - 1, unit->X + unit->Type->TileWidth + 1, unit->Y + unit->Type->TileHeight + 1, around); } else { - an=SelectUnits( - unit->X - 2, unit->Y - 2, + an = SelectUnits(unit->X - 2, unit->Y - 2, unit->X + unit->Type->TileWidth + 2, unit->Y + unit->Type->TileHeight + 2, around); } @@ -596,7 +592,7 @@ local SCM CclIfResource(SCM player, SCM operation, SCM quantity, SCM resource) plynr = 0; pn = PlayerMax; } else { - pn = plynr+1; + pn = plynr + 1; } for (i = 0; i < MaxCosts; ++i) {