Fixing syntax warnings and coding conventions.
authorchsieh <chester.developer@hotmail.com>
Tue, 10 May 2011 03:04:50 +0000 (20:04 -0700)
committerchsieh <chester.developer@hotmail.com>
Tue, 10 May 2011 03:04:50 +0000 (20:04 -0700)
libs/sparrow/src/Classes/SPDisplayObject.m
libs/sparrow/src/Classes/SPImage.m
libs/sparrow/src/Classes/SPQuad.m
src/tanks/unit/Unit.h
src/tanks/unit/Unit.m

index 6eab8f6..6ef3c6c 100644 (file)
@@ -43,7 +43,7 @@
     }    
     #endif
     
-    if (self = [super init])
+    if ((self = [super init]))
     {
         mAlpha = 1.0f;
         mScaleX = 1.0f;
index 732a432..2db63c1 100644 (file)
@@ -22,7 +22,7 @@
 {
     if (!texture) [NSException raise:SP_EXC_INVALID_OPERATION format:@"texture cannot be nil!"];
     
-    if (self = [super initWithWidth:texture.width height:texture.height])
+    if ((self = [super initWithWidth:texture.width height:texture.height]))
     {
         self.texture = texture;
         mTexCoords[0] = 0.0f; mTexCoords[1] = 0.0f;
index 134bf01..59400dd 100644 (file)
@@ -18,7 +18,7 @@
 
 - (id)initWithWidth:(float)width height:(float)height color:(uint)color
 {
-    if (self = [super init])
+    if ((self = [super init]))
     {
         mVertexCoords[2] = width; 
         mVertexCoords[5] = height; 
index f9a776f..4a9b4fa 100644 (file)
@@ -16,6 +16,7 @@
 @property(nonatomic, retain) SPQuad* quad;
 
 -(void)dealloc;
+
 -(Unit*)initWithWidth:(float)width height:(float)height X:(float)x Y:(float)y color:(int)color;
 -(Unit*)initWithFile:(NSString*)fileName atX:(float)x andY:(float)y;
 
index aab7f6c..7fed915 100644 (file)
@@ -27,8 +27,7 @@
   return self;
 }
 
--(Unit*)initWithFile:(NSString*)fileName atX:(float)x andY:(float)y
-{
+-(Unit*)initWithFile:(NSString*)fileName atX:(float)x andY:(float)y {
   quad = [[SPImage alloc] initWithContentsOfFile:fileName];
   quad.x = x;
   quad.y = y;
@@ -40,8 +39,8 @@
   SPTouch* touch = [[event touchesWithTarget:quad.parent] anyObject];
   if (touch) {
     SPPoint* touchPosition = [touch locationInSpace:quad.parent];
-    quad.x = touchPosition.x - quad.width / 2.0f;
-    quad.y = touchPosition.y - quad.height / 2.0f;
+    quad.x = touchPosition.x - quad.width * 0.5f;
+    quad.y = touchPosition.y - quad.height * 0.5f;
   }
 }