project_files/HedgewarsMobile/Classes/CommodityFunctions.m
changeset 3971 5c82ee165ed5
parent 3941 017b2b31e1c6
child 3982 86c3a6e8e265
equal deleted inserted replaced
3970:0f6e3219c108 3971:5c82ee165ed5
    72 
    72 
    73     NSDictionary *theWeapon = nil;
    73     NSDictionary *theWeapon = nil;
    74     switch (type) {
    74     switch (type) {
    75         case 0: //default
    75         case 0: //default
    76             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
    76             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
    77                          @"939192942219912103223511100120100000021111010101",@"ammostore_initialqt",
    77                          @"9391929422199121032235111001201000000211110101011",@"ammostore_initialqt",
    78                          @"040504054160065554655446477657666666615551010111",@"ammostore_probability",
    78                          @"0405040541600655546554464776576666666155510101117",@"ammostore_probability",
    79                          @"000000000000020550000004000700400000000020000000",@"ammostore_delay",
    79                          @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
    80                          @"131111031211111112311411111111111111121111110111",@"ammostore_crate", nil];
    80                          @"1311110312111111123114111111111111111211111101111",@"ammostore_crate", nil];
    81             break;
    81             break;
    82         case 1: //crazy
    82         case 1: //crazy
    83             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
    83             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
    84                          @"999999999999999999299999999999999929999999990999",@"ammostore_initialqt",
    84                          @"9999999999999999992999999999999999299999999909999",@"ammostore_initialqt",
    85                          @"111111011111111111111111111111111111111111110111",@"ammostore_probability",
    85                          @"1111110111111111111111111111111111111111111101111",@"ammostore_probability",
    86                          @"000000000000000000000000000000000000000000000000",@"ammostore_delay",
    86                          @"0000000000000000000000000000000000000000000000000",@"ammostore_delay",
    87                          @"131111031211111112311411111111111111121111010111",@"ammostore_crate", nil];
    87                          @"1311110312111111123114111111111111111211110101111",@"ammostore_crate", nil];
    88             break;
    88             break;
    89         case 2: //pro mode
    89         case 2: //pro mode
    90             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
    90             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
    91                          @"909000900000000000000900000000000000000000000000",@"ammostore_initialqt",
    91                          @"9090009000000000000009000000000000000000000000000",@"ammostore_initialqt",
    92                          @"000000000000000000000000000000000000000000000000",@"ammostore_probability",
    92                          @"0000000000000000000000000000000000000000000000000",@"ammostore_probability",
    93                          @"000000000000020550000004000700400000000020000000",@"ammostore_delay",
    93                          @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
    94                          @"111111111111111111111111111111111111111110010111",@"ammostore_crate", nil];
    94                          @"1111111111111111111111111111111111111111100101111",@"ammostore_crate", nil];
    95             break;
    95             break;
    96         case 3: //shoppa
    96         case 3: //shoppa
    97             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
    97             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
    98                          @"000000990000000000000000000000000000000000000000",@"ammostore_initialqt",
    98                          @"0000009900000000000000000000000000000000000000000",@"ammostore_initialqt",
    99                          @"444441004424440221011212122242200000000200040001",@"ammostore_probability",
    99                          @"4444410044244402210112121222422000000002000400010",@"ammostore_probability",
   100                          @"000000000000000000000000000000000000000000000000",@"ammostore_delay",
   100                          @"0000000000000000000000000000000000000000000000000",@"ammostore_delay",
   101                          @"111111111111111111111111111111111111111110110111",@"ammostore_crate", nil];
   101                          @"1111111111111111111111111111111111111111101101111",@"ammostore_crate", nil];
   102             break;
   102             break;
   103         case 4: //basketball
   103         case 4: //basketball
   104             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
   104             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
   105                          @"939192942219912103223511100120100000021111010100",@"ammostore_initialqt",
   105                          @"9391929422199121032235111001201000000211110101000",@"ammostore_initialqt",
   106                          @"000000000000000000000000000000000000000000000000",@"ammostore_probability",
   106                          @"0000000000000000000000000000000000000000000000000",@"ammostore_probability",
   107                          @"000000000000000550000004000700400000000020000000",@"ammostore_delay",
   107                          @"0000000000000005500000040007004000000000200000000",@"ammostore_delay",
   108                          @"111111111111111111111111111111111111111111110111",@"ammostore_crate", nil];
   108                          @"1111111111111111111111111111111111111111111101111",@"ammostore_crate", nil];
   109             break;
   109             break;
   110         case 5: //minefield
   110         case 5: //minefield
   111             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
   111             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
   112                          @"000000990009000000030000000000000000000000000000",@"ammostore_initialqt",
   112                          @"0000009900090000000300000000000000000000000000000",@"ammostore_initialqt",
   113                          @"000000000000000000000000000000000000000000000000",@"ammostore_probability",
   113                          @"0000000000000000000000000000000000000000000000000",@"ammostore_probability",
   114                          @"000000000000020550000004000700400000000020000000",@"ammostore_delay",
   114                          @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
   115                          @"111111111111111111111111111111111111111111110111",@"ammostore_crate", nil];
   115                          @"1111111111111111111111111111111111111111111101111",@"ammostore_crate", nil];
   116             break;
   116             break;
   117         default:
   117         default:
   118             NSLog(@"Nope");
   118             NSLog(@"Nope");
   119             break;
   119             break;
   120     }
   120     }
   188            (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
   188            (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
   189 }
   189 }
   190 
   190 
   191 NSInteger inline randomPort () {
   191 NSInteger inline randomPort () {
   192     srandom(time(NULL));
   192     srandom(time(NULL));
   193     return (random() % 64511) + 1024;
   193     NSInteger res = (random() % 64511) + 1024;
       
   194     return (res == DEFAULT_NETGAME_PORT) ? randomPort() : res;
   194 }
   195 }
   195 
   196 
   196 void popError (const char *title, const char *message) {
   197 void popError (const char *title, const char *message) {
   197     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithUTF8String:title]
   198     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithUTF8String:title]
   198                                                     message:[NSString stringWithUTF8String:message]
   199                                                     message:[NSString stringWithUTF8String:message]