project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
changeset 3623 f14db208f2fa
parent 3621 a8ddf681ba7d
child 3624 304c6d32383a
equal deleted inserted replaced
3622:24c4726b1019 3623:f14db208f2fa
    72                       NSLocalizedString(@"Flamethrower",@""),
    72                       NSLocalizedString(@"Flamethrower",@""),
    73                       nil];
    73                       nil];
    74     self.ammoNames = array;
    74     self.ammoNames = array;
    75     [array release];
    75     [array release];
    76 
    76 
    77     ammoSize = [self.ammoNames count];
    77     quantity = (char *)malloc(sizeof(char)*CURRENT_AMMOSIZE);
    78     quantity = (char *)malloc(sizeof(char)*ammoSize);
    78     probability = (char *)malloc(sizeof(char)*CURRENT_AMMOSIZE);
    79     probability = (char *)malloc(sizeof(char)*ammoSize);
    79     delay = (char *)malloc(sizeof(char)*CURRENT_AMMOSIZE);
    80     delay = (char *)malloc(sizeof(char)*ammoSize);
    80     crateness = (char *)malloc(sizeof(char)*CURRENT_AMMOSIZE);
    81     crateness = (char *)malloc(sizeof(char)*ammoSize);
       
    82     
    81     
    83     NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()];
    82     NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()];
    84     UIImage *img = [[UIImage alloc] initWithContentsOfFile:str];
    83     UIImage *img = [[UIImage alloc] initWithContentsOfFile:str];
    85     self.ammoStoreImage = img;
    84     self.ammoStoreImage = img;
    86     [img release];
    85     [img release];
   108         quantity[i] = tmp1[i];
   107         quantity[i] = tmp1[i];
   109         probability[i] = tmp2[i];
   108         probability[i] = tmp2[i];
   110         delay[i] = tmp3[i];
   109         delay[i] = tmp3[i];
   111         crateness[i] = tmp4[i];
   110         crateness[i] = tmp4[i];
   112     }
   111     }
   113     for (int i = oldlen; i < ammoSize; i++) {
   112     for (int i = oldlen; i < CURRENT_AMMOSIZE; i++) {
   114         quantity[i] = '0';
   113         quantity[i] = '0';
   115         probability[i] = '0';
   114         probability[i] = '0';
   116         delay[i] = '0';
   115         delay[i] = '0';
   117         crateness[i] = '0';
   116         crateness[i] = '0';
   118     }
   117     }
   147     return 1;
   146     return 1;
   148 }
   147 }
   149 
   148 
   150 
   149 
   151 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   150 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   152     return ammoSize;
   151     return CURRENT_AMMOSIZE;
   153 }
   152 }
   154 
   153 
   155 
   154 
   156 // Customize the appearance of table view cells.
   155 // Customize the appearance of table view cells.
   157 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   156 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {