Ignore:
Timestamp:
2010-05-28 07:39:52 (2 years ago)
Author:
kpoole
Message:

Episode 5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Classes/achievements.mm

    r23 r26  
    1414#include "achievements.h" 
    1515 
    16 #include "OpenFeint.h" 
     16#ifndef DISABLE_OPENFEINT 
    1717 
    18 #include "OFAchievementService.h" 
    19 #include "OFAchievement.h" 
     18    #include "OpenFeint.h" 
     19 
     20    #include "OFAchievementService.h" 
     21    #include "OFAchievement.h" 
     22 
     23    #import "SampleOFDelegate.h" 
     24 
     25    SampleOFDelegate *ofDelegate; 
     26 
     27#endif 
    2028 
    2129#include "game_preferences.hpp" 
     
    2432#include "game_display.hpp" 
    2533#include "stdio.h" 
     34 
     35#import "Appirater.h" 
     36 
     37 
     38 
     39 
    2640 
    2741std::string names[] = { "Bloodied", "Slayer", "Battle Master", "Bone Crusher", "Predator", "Penny Pincher", "Money Hoarder", "Veteran Unit", 
     
    4054bool gInitialized = false; 
    4155 
     56extern "C" unsigned char gFlippedGL; 
     57 
     58 
     59 
    4260void of_init(void) 
    4361{ 
     
    4563        return; 
    4664     
     65#ifndef DISABLE_OPENFEINT    
     66     
     67    UIInterfaceOrientation orient; 
     68    if (!gFlippedGL) 
     69        orient = UIInterfaceOrientationLandscapeRight; 
     70    else 
     71        orient = UIInterfaceOrientationLandscapeLeft;    
     72         
     73 
     74     
    4775    NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys: 
    48                               [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight], OpenFeintSettingDashboardOrientation, 
     76                              [NSNumber numberWithInt:orient], OpenFeintSettingDashboardOrientation, 
    4977                              @"Wesnoth", OpenFeintSettingShortDisplayName,  
    5078                              [NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications, 
    5179                              [NSNumber numberWithBool:NO], OpenFeintSettingDisableUserGeneratedContent, 
    5280                              [NSNumber numberWithBool:YES], OpenFeintSettingPromptToPostAchievementUnlock, 
     81//                            [UIApplication sharedApplication].keyWindow, OpenFeintSettingPresentationWindow, 
    5382                              nil 
    5483                              ]; 
    5584     
    56     [OpenFeint initializeWithProductKey:@"WDYPKxGL2aP5ujZFrnKmQ" andSecret:@"WoRs8Pt7ch9r0Re1UI7Zx5d62gezqfHDLPy4t5suQE" andDisplayName:@"Wesnoth" andSettings:settings andDelegates:nil]; 
    57     gInitialized = true; 
     85    ofDelegate = [SampleOFDelegate new]; 
     86     
     87    OFDelegatesContainer* delegates = [OFDelegatesContainer containerWithOpenFeintDelegate:ofDelegate 
     88                                                                      andChallengeDelegate:nil 
     89                                                                   andNotificationDelegate:nil]; 
     90     
     91    [OpenFeint initializeWithProductKey:@"WDYPKxGL2aP5ujZFrnKmQ"  
     92                              andSecret:@"WoRs8Pt7ch9r0Re1UI7Zx5d62gezqfHDLPy4t5suQE"  
     93                         andDisplayName:@"Wesnoth"  
     94                            andSettings:settings  
     95                           andDelegates:delegates]; 
     96     
     97#endif 
     98     
     99gInitialized = true; 
     100     
     101     
     102// now also set up AppiRater 
     103[Appirater appLaunched]; 
     104     
    58105} 
    59106 
    60107void of_dashboard(void) 
    61108{ 
    62     [OpenFeint launchDashboard]; 
     109#ifndef DISABLE_OPENFEINT    
     110    { 
     111        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
     112        [OpenFeint launchDashboard]; 
     113        [pool release]; 
     114    } 
     115#endif 
    63116} 
    64117 
     
    70123void earn_achievement(int achievement, bool show_dlg) 
    71124{ 
     125#ifndef DISABLE_OPENFEINT 
     126     
    72127    if (preferences::achievement_earned(achievement)) 
    73128        return; 
     
    95150    // do OpenFeint stuff 
    96151    [OFAchievementService unlockAchievement:ids[achievement]]; 
     152#endif 
    97153} 
Note: See TracChangeset for help on using the changeset viewer.