project_files/HedgewarsMobile/Classes/HogButtonView.m
changeset 3926 668b71f31e51
parent 3829 81db3c85784b
child 3948 24daa33a3114
equal deleted inserted replaced
3924:2a9ace189288 3926:668b71f31e51
    20 
    20 
    21 
    21 
    22 #import "HogButtonView.h"
    22 #import "HogButtonView.h"
    23 #import "CommodityFunctions.h"
    23 #import "CommodityFunctions.h"
    24 #import "UIImageExtra.h"
    24 #import "UIImageExtra.h"
       
    25 #import "PascalImports.h"
    25 
    26 
    26 @implementation HogButtonView
    27 @implementation HogButtonView
    27 @synthesize singleHog, numberOfHogs, ownerDictionary;
    28 @synthesize singleHog, numberOfHogs, ownerDictionary;
    28 
    29 
    29 -(id) initWithFrame:(CGRect)frame {
    30 -(id) initWithFrame:(CGRect)frame {
    49     [self drawManyHogs:number];
    50     [self drawManyHogs:number];
    50 }
    51 }
    51 
    52 
    52 -(void) drawManyHogs:(NSInteger) hogs {
    53 -(void) drawManyHogs:(NSInteger) hogs {
    53     if (numberOfHogs != hogs) {
    54     if (numberOfHogs != hogs) {
    54         if (hogs <= MAX_HOGS && hogs >= 1)
    55         if (hogs <= HW_getMaxNumberOfHogs() && hogs >= 1)
    55             numberOfHogs = hogs;
    56             numberOfHogs = hogs;
    56         else {
    57         else {
    57             if (hogs > MAX_HOGS)
    58             if (hogs > HW_getMaxNumberOfHogs())
    58                 numberOfHogs = 1;
    59                 numberOfHogs = 1;
    59             else
    60             else
    60                 numberOfHogs = MAX_HOGS;
    61                 numberOfHogs = HW_getMaxNumberOfHogs();
    61         }
    62         }
    62         [ownerDictionary setObject:[NSNumber numberWithInt:numberOfHogs] forKey:@"number"];
    63         [ownerDictionary setObject:[NSNumber numberWithInt:numberOfHogs] forKey:@"number"];
    63 
    64 
    64         UIImage *teamHogs = [[[UIImage alloc] init] autorelease];
    65         UIImage *teamHogs = [[[UIImage alloc] init] autorelease];
    65         for (int i = 0; i < numberOfHogs; i++) {
    66         for (int i = 0; i < numberOfHogs; i++) {