From 800e825916446f2261c6e50ddd5f191c651c9d15 Mon Sep 17 00:00:00 2001 From: exterlulz Date: Sat, 21 Aug 2010 16:56:39 +0200 Subject: [PATCH] change Game._bonusMultiplier property --- src/Game.h | 4 ++-- src/Game.m | 19 +++++++------------ src/GameController.m | 6 +++--- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/Game.h b/src/Game.h index 11eecc4..f84952f 100644 --- a/src/Game.h +++ b/src/Game.h @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Gem *board[8][8]; int sx1,sy1,sx2,sy2, hintx, hinty; - int _score, bonusMultiplier, gemsFaded; + int _score, _bonusMultiplier, gemsFaded; // CASCADE BONUS int cascade; @@ -39,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. } @property (readonly) int _score; +@property (readonly) int _bonusMultiplier; - (id)init; - (id)initWithImagesFrom:(NSArray *)imageArray; @@ -74,7 +75,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - (NSPoint)hintPoint; - (float)collectGemsFaded; -- (int)bonusMultiplier; - (void)increaseBonusMultiplier; @end diff --git a/src/Game.m b/src/Game.m index 746de57..d5901d9 100644 --- a/src/Game.m +++ b/src/Game.m @@ -68,7 +68,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. _score = 0; gemsFaded = 0; - bonusMultiplier = 1; + _bonusMultiplier = 1; } return self; @@ -95,7 +95,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. _score = 0; gemsFaded = 0; - bonusMultiplier = 1; + _bonusMultiplier = 1; } return self; @@ -265,11 +265,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // MW's scorebubble if (bonus>0) - [scoreBubbles addObject:[ScoreBubble scoreWithValue:bonus*bonusMultiplier + [scoreBubbles addObject:[ScoreBubble scoreWithValue:(bonus * _bonusMultiplier) at:NSMakePoint(scorebubble_x*48+24, scorebubble_y*48+24) duration:40]]; - _score += bonus * bonusMultiplier; + _score += bonus * _bonusMultiplier; return result; } @@ -570,7 +570,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. } _score = 0; gemsFaded = 0; - bonusMultiplier = 1; + _bonusMultiplier = 1; } - (void) wholeNewGameWithSpritesFrom:(NSArray *) spriteArray @@ -590,7 +590,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. } _score = 0; gemsFaded = 0; - bonusMultiplier = 1; + _bonusMultiplier = 1; } // TODO: set as dynamic readonly property @@ -605,14 +605,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. return result; } -// TODO: property -- (int) bonusMultiplier { - return bonusMultiplier; -} - - (void) increaseBonusMultiplier { - bonusMultiplier++; + _bonusMultiplier++; } @end diff --git a/src/GameController.m b/src/GameController.m index 3396ea7..6e9f791 100644 --- a/src/GameController.m +++ b/src/GameController.m @@ -282,7 +282,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // [scoreTextField setStringValue:[NSString stringWithFormat:@"%d", game._score]]; [scoreTextField setNeedsDisplay:YES]; - [bonusTextField setStringValue:[NSString stringWithFormat:@"x%d",[game bonusMultiplier]]]; + [bonusTextField setStringValue:[NSString stringWithFormat:@"x%d", game._bonusMultiplier]]; [bonusTextField setNeedsDisplay:YES]; // @@ -769,7 +769,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. anyThrees = ([game testForThreeAt:chx1:chy1])|([game testForThreeAt:chx2:chy2]); [scoreTextField setStringValue:[NSString stringWithFormat:@"%d", game._score]]; [scoreTextField setNeedsDisplay:YES]; - [bonusTextField setStringValue:[NSString stringWithFormat:@"x%d",[game bonusMultiplier]]]; + [bonusTextField setStringValue:[NSString stringWithFormat:@"x%d", game._bonusMultiplier]]; [bonusTextField setNeedsDisplay:YES]; if (game._score > oldScore) [timerView incrementMeter:[game collectGemsFaded]/GEMS_FOR_BONUS]; if (anyThrees) @@ -797,7 +797,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. anyThrees = [game checkBoardForThrees]; [scoreTextField setStringValue:[NSString stringWithFormat:@"%d", game._score]]; [scoreTextField setNeedsDisplay:YES]; - [bonusTextField setStringValue:[NSString stringWithFormat:@"x%d",[game bonusMultiplier]]]; + [bonusTextField setStringValue:[NSString stringWithFormat:@"x%d", game._bonusMultiplier]]; [bonusTextField setNeedsDisplay:YES]; if (game._score > oldScore) [timerView incrementMeter:[game collectGemsFaded]/GEMS_FOR_BONUS]; if (anyThrees) -- 2.11.4.GIT