merge
authorkoda
Thu, 07 Apr 2011 13:21:11 +0200
changeset 5116 d70febb51125
parent 5115 276410cc1178 (diff)
parent 5108 b7483e29ea8c (current diff)
child 5117 71f94af9d1a4
merge
--- a/QTfrontend/bgwidget.cpp	Tue Apr 05 16:15:20 2011 -0400
+++ b/QTfrontend/bgwidget.cpp	Thu Apr 07 13:21:11 2011 +0200
@@ -44,7 +44,7 @@
     fY = -1 * iSpriteHeight;
     fX = (qrand() % ((int)(wParent->width() * 1.5))) - wParent->width()/2;
     fYMov = ((qrand() % 400)+300) / 100.0f;
-    fXMov = fYMov * 0.5f;
+    fXMov = fYMov * 0.2f+((qrand()%100)/100.0f * 0.6f); //so between 0.2 and 0.6, or 0.5 +/- 0.3
     iAngle = qrand() % 360;
 }
 
--- a/QTfrontend/hwform.cpp	Tue Apr 05 16:15:20 2011 -0400
+++ b/QTfrontend/hwform.cpp	Thu Apr 07 13:21:11 2011 +0200
@@ -310,7 +310,7 @@
   if (value)
     setWindowState(windowState() | Qt::WindowFullScreen);
   else {
-    setWindowState(windowState() & !Qt::WindowFullScreen);
+    setWindowState(windowState() & static_cast<int>(!Qt::WindowFullScreen));
   }
 }
 
@@ -635,7 +635,7 @@
 void HWForm::RandomNames()
 {
     editedTeam->GetFromPage(this);
-    namegen->TeamRandomNames(editedTeam,FALSE);
+    namegen->TeamRandomNames(editedTeam, true);
     editedTeam->SetToPage(this);
 }
 
--- a/QTfrontend/namegen.cpp	Tue Apr 05 16:15:20 2011 -0400
+++ b/QTfrontend/namegen.cpp	Thu Apr 07 13:21:11 2011 +0200
@@ -40,9 +40,9 @@
 
 
 
-void HWNamegen::TeamRandomName(HWTeam*& team, const int &i)
+void HWNamegen::TeamRandomName(HWTeam*& team, const int HedgehogNumber)
 {
-    RandomNameByHat(team,i);
+    RandomNameByHat(team, HedgehogNumber);
 }
 
 void HWNamegen::TeamRandomNames(HWTeam*& team, const bool changeteamname)
@@ -55,11 +55,13 @@
             if (TypesTeamnames[kind].size() > 0){
                 team->TeamName = TypesTeamnames[kind][rand()%(TypesTeamnames[kind].size())];
             }
-            team->Grave = "Simple"; // Todo: make it semi-random
-            team->Fort = "Island"; // Todo: make it semi-random
+            team->Grave = GetRandomGrave();
+            team->Fort = GetRandomFort();
             team->Voicepack = "Default";
         }
 
+        //give each hedgehog a random name:
+        //TODO: load the dictionary only once! (right now it's loaded once for each hedgehog)
         for(int i = 0; i < 8; i++)
         {
             if ((TypesHatnames[kind].size()) > 0){
@@ -73,15 +75,15 @@
 }
 
 
-void HWNamegen::RandomNameByHat(HWTeam*& team, const int &i)
+void HWNamegen::RandomNameByHat(HWTeam*& team, const int HedgehogNumber)
 {
     QStringList Dictionaries;
-    HatCfgLoad(team->Hedgehogs[i].Hat,Dictionaries);
+    HatCfgLoad(team->Hedgehogs[HedgehogNumber].Hat,Dictionaries);
 
     QStringList Dictionary;
     DictLoad(Dictionaries[rand()%(Dictionaries.size())],Dictionary);
 
-    team->Hedgehogs[i].Name = Dictionary[rand()%(Dictionary.size())];
+    team->Hedgehogs[HedgehogNumber].Name = Dictionary[rand()%(Dictionary.size())];
 }
 
 void HWNamegen::DictLoad(const QString filename, QStringList &list)
@@ -164,3 +166,45 @@
 }
 
 
+
+QString HWNamegen::GetRandomGrave()
+{
+    QStringList Graves;
+
+    //list all available Graves
+    QDir tmpdir;
+    tmpdir.cd(datadir->absolutePath());
+    tmpdir.cd("Graphics/Graves");
+    tmpdir.setFilter(QDir::Files);
+    Graves.append(tmpdir.entryList(QStringList("*.png")).replaceInStrings(QRegExp("^(.*)\\.png"), "\\1"));
+
+    if(Graves.size()==0)
+    {
+        //do some serious error handling
+        return "Error";
+    }
+
+    //pick a random grave
+    return Graves[rand()%(Graves.size())];
+}
+
+QString HWNamegen::GetRandomFort()
+{
+    QStringList Forts;
+
+    //list all available Forts
+    QDir tmpdir;
+    tmpdir.cd(datadir->absolutePath());
+    tmpdir.cd("Forts");
+    tmpdir.setFilter(QDir::Files);
+    Forts.append(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1"));
+
+    if(Forts.size()==0)
+    {
+        //do some serious error handling
+        return "Error";
+    }
+
+    //pick a random fort
+    return Forts[rand()%(Forts.size())];
+}
--- a/QTfrontend/namegen.h	Tue Apr 05 16:15:20 2011 -0400
+++ b/QTfrontend/namegen.h	Thu Apr 07 13:21:11 2011 +0200
@@ -31,9 +31,9 @@
     HWNamegen();
     ~HWNamegen();
 
-    void TeamRandomName(HWTeam*& team, const int &i);
+    void TeamRandomName(HWTeam*& team, const int HedgehogNumber);
     void TeamRandomNames(HWTeam*& team, const bool changeteamname);
-    void RandomNameByHat(HWTeam*& team, const int &i);
+    void RandomNameByHat(HWTeam*& team, const int HedgehogNumber);
 
 private:
 
@@ -43,6 +43,9 @@
         void TypesLoad();
         void DictLoad(const QString filename, QStringList &list);
         void HatCfgLoad(const QString hatname, QStringList &list);
+
+		QString GetRandomGrave();
+		QString GetRandomFort();
 };
 
 
--- a/QTfrontend/selectWeapon.cpp	Tue Apr 05 16:15:20 2011 -0400
+++ b/QTfrontend/selectWeapon.cpp	Thu Apr 07 13:21:11 2011 +0200
@@ -35,7 +35,7 @@
 QImage getAmmoImage(int num)
 {
     static QImage ammo(":Ammos.png");
-    int x = floor(num/(ammo.height()/32));
+    int x = num/(ammo.height()/32);
     int y = (num-((ammo.height()/32)*x))*32;
     x*=32;
     return ammo.copy(x, y, 32, 32);
--- a/hedgewars/hwengine.pas	Tue Apr 05 16:15:20 2011 -0400
+++ b/hedgewars/hwengine.pas	Thu Apr 07 13:21:11 2011 +0200
@@ -209,11 +209,7 @@
     cFullScreen:= false;
     cTimerInterval:= 8;
     PathPrefix:= 'Data';
-{$IFDEF DEBUGFILE}
-    cShowFPS:= true;
-{$ELSE}
-    cShowFPS:= false;
-{$ENDIF}
+    cShowFPS:= {$IFDEF DEBUGFILE}true{$ELSE}false{$ENDIF};
     val(gameArgs[0], ipcPort);
     val(gameArgs[1], cScreenWidth);
     val(gameArgs[2], cScreenHeight);
@@ -264,13 +260,16 @@
     InitKbdKeyTable();
 
     LoadLocale(Pathz[ptLocale] + '/en.txt');  // Do an initial load with english
+    if (Length(cLocaleFName) > 6) then cLocale := Copy(cLocaleFName,1,5)
+    else cLocale := Copy(cLocaleFName,1,2);
     if cLocaleFName <> 'en.txt' then
         begin
         // Try two letter locale first before trying specific locale overrides
-        if (Length(cLocaleFName) > 6) and (Copy(cLocaleFName,1,2)+'.txt' <> 'en.txt') then
-            LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocaleFName,1,2)+'.txt');
+        if (Length(cLocale) > 2) and (Copy(cLocale,1,2) <> 'en') then
+            LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocale,1,2)+'.txt');
         LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName);
-        end;
+        end
+    else cLocale := 'en';
 
     WriteLnToConsole(msgGettingConfig);
 
--- a/hedgewars/uSound.pas	Tue Apr 05 16:15:20 2011 -0400
+++ b/hedgewars/uSound.pas	Thu Apr 07 13:21:11 2011 +0200
@@ -20,7 +20,7 @@
 
 unit uSound;
 interface
-uses SDLh, uConsts, uTypes;
+uses SDLh, uConsts, uTypes, sysutils;
 
 var MusicFN: shortstring;
 
@@ -61,13 +61,29 @@
 
 function  AskForVoicepack(name: shortstring): Pointer;
 var i: Longword;
+    locName, path: shortstring;
 begin
 i:= 0;
+    // First, attempt to locate a localised version of the voice
+    if cLocale <> 'en' then
+        begin
+        locName:= name+'_'+cLocale;
+        path:= Pathz[ptVoices] + '/' + locName;
+        if DirectoryExists(path) then name:= locName
+        else if Length(cLocale) > 2 then
+            begin
+            locName:= name+'_'+Copy(cLocale,1,2);
+            path:= Pathz[ptVoices] + '/' + locName;
+            if DirectoryExists(path) then name:= locName
+            end
+        end;
+
+    // If that fails, use the unmodified one
     while (voicepacks[i].name <> name) and (voicepacks[i].name <> '') do
-    begin
+        begin
         inc(i);
         TryDo(i <= cMaxTeams, 'Engine bug: AskForVoicepack i > cMaxTeams', true)
-    end;
+        end;
 
     voicepacks[i].name:= name;
     AskForVoicepack:= @voicepacks[i]
--- a/hedgewars/uStore.pas	Tue Apr 05 16:15:20 2011 -0400
+++ b/hedgewars/uStore.pas	Thu Apr 07 13:21:11 2011 +0200
@@ -931,7 +931,7 @@
         x:= (SDL_WINDOWPOS_CENTERED_MASK or {$IFDEF IPHONEOS}(SDL_GetNumVideoDisplays() - 1){$ELSE}0{$ENDIF});
         y:= (SDL_WINDOWPOS_CENTERED_MASK or {$IFDEF IPHONEOS}(SDL_GetNumVideoDisplays() - 1){$ELSE}0{$ENDIF});
         SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN
-                        {$IFDEF IPHONEOS} or SDL_WINDOW_BORDERLESS {$ENDIF});
+                          {$IFDEF IPHONEOS} or SDL_WINDOW_BORDERLESS {$ENDIF});  // do not set SDL_WINDOW_RESIZABLE on iOS
         SDLrender:= SDL_CreateRenderer(SDLwindow, -1, SDL_RENDERER_ACCELERATED or SDL_RENDERER_PRESENTVSYNC);
     end;
 
--- a/hedgewars/uVariables.pas	Tue Apr 05 16:15:20 2011 -0400
+++ b/hedgewars/uVariables.pas	Thu Apr 07 13:21:11 2011 +0200
@@ -33,6 +33,7 @@
     isSoundEnabled  : boolean     = true;
     isMusicEnabled  : boolean     = false;
     cLocaleFName    : shortstring = 'en.txt';
+    cLocale         : shortstring = 'en';
     cInitVolume     : LongInt     = 100;
     cTimerInterval  : LongInt     = 8;
     PathPrefix      : shortstring = './';
--- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Tue Apr 05 16:15:20 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Thu Apr 07 13:21:11 2011 +0200
@@ -35,25 +35,14 @@
 
 #define BLACKVIEW_TAG 17935
 #define SECONDBLACKVIEW_TAG 48620
-#define VALGRIND "/opt/fink/bin/valgrind"
+
+@implementation SDLUIKitDelegate (customDelegate)
 
-int main (int argc, char *argv[]) {
-#ifdef VALGRIND_REXEC
-    // Using the valgrind build config, rexec ourself in valgrind
-    // from http://landonf.bikemonkey.org/code/iphone/iPhone_Simulator_Valgrind.20081224.html
-    if (argc < 2 || (argc >= 2 && strcmp(argv[1], "-valgrind") != 0))
-        execl(VALGRIND, VALGRIND, "--leak-check=full", "--dsymutil=yes", argv[0], "-valgrind", NULL);
-#endif
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    int retVal = UIApplicationMain(argc, argv, nil, @"HedgewarsAppDelegate");
-    [pool release];
-    return retVal;
++(NSString *)getAppDelegateClassName {
+    return @"HedgewarsAppDelegate";
 }
 
-int SDL_main(int argc, char **argv) {
-    // dummy function to prevent linkage fail
-    return 0;
-}
+@end
 
 @implementation HedgewarsAppDelegate
 @synthesize mainViewController, overlayController, uiwindow, secondWindow, isInGame;
@@ -222,8 +211,12 @@
     print_free_memory();
 }
 
+//TODO: when the SDLUIKitDelegate methods applicationWillResignActive and applicationDidBecomeActive do work
+// you'll be able to remove the methods below and just handle the SDL_WINDOWEVENT_MINIMIZED/SDL_WINDOWEVENT_RESTORED
+// events in the MainLoop
+
 -(void) applicationWillResignActive:(UIApplication *)application {
-    [super applicationWillResignActive: application];
+    //[super applicationWillResignActive:application];
 
     UIDevice* device = [UIDevice currentDevice];
     if ([device respondsToSelector:@selector(isMultitaskingSupported)] &&
@@ -247,7 +240,7 @@
 }
 
 -(void) applicationDidBecomeActive:(UIApplication *)application {
-    [super applicationDidBecomeActive:application];
+    //[super applicationDidBecomeActive:application];
 
     UIDevice* device = [UIDevice currentDevice];
     if ([device respondsToSelector:@selector(isMultitaskingSupported)] &&
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m	Tue Apr 05 16:15:20 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m	Thu Apr 07 13:21:11 2011 +0200
@@ -154,3 +154,10 @@
 void updateVisualsNewTurn(void) {
     [amvc_instance updateAmmoVisuals];
 }
+
+// dummy function to prevent linkage fail
+int SDL_main(int argc, char **argv) {
+    return 0;
+}
+
+
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Tue Apr 05 16:15:20 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Thu Apr 07 13:21:11 2011 +0200
@@ -53,9 +53,6 @@
     BOOL useClassicMenu;
     NSInteger initialOrientation;
     
-    // the containing window
-    UIWindow *containerWindow;
-    
     // dual head support
     NSInteger initialScreenCount;
     NSInteger a, b;
@@ -68,7 +65,6 @@
 @property (assign) BOOL isNetGame;
 @property (assign) BOOL useClassicMenu;
 @property (assign) NSInteger initialOrientation;
-@property (assign) UIWindow *containerWindow;
 
 -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
 -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Tue Apr 05 16:15:20 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Thu Apr 07 13:21:11 2011 +0200
@@ -39,10 +39,11 @@
                             [[self.view viewWithTag:GRENADE_TAG] removeFromSuperview];
 
 @implementation OverlayViewController
-@synthesize popoverController, popupMenu, helpPage, amvc, isNetGame, useClassicMenu, initialOrientation, containerWindow;
+@synthesize popoverController, popupMenu, helpPage, amvc, isNetGame, useClassicMenu, initialOrientation;
 
 #pragma mark -
 #pragma mark rotation
+
 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
     // don't rotate until the game is running for performance and synchronization with the sdlview
     if (isGameRunning() == NO)
@@ -98,17 +99,20 @@
         return;
 
     UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
-    
+    UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG];
+
     [UIView beginAnimations:@"rotation" context:NULL];
     [UIView setAnimationDuration:0.7];
     switch (orientation) {
         case UIDeviceOrientationLandscapeLeft:
             self.view.frame = [[UIScreen mainScreen] bounds];
             self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
+            sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(a));
             break;
         case UIDeviceOrientationLandscapeRight:
             self.view.frame = [[UIScreen mainScreen] bounds];
             self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
+            sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(b));
             break;
         default:
             // a debug log would spam too much
@@ -151,7 +155,6 @@
         initialScreenCount = 1;
 
     // set initial orientation of the controller orientation
-    if (IS_DUALHEAD()) {
         switch (self.interfaceOrientation) {
             case UIDeviceOrientationLandscapeLeft:
                 self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
@@ -168,7 +171,6 @@
                                                  selector:@selector(dualHeadRotation:)
                                                      name:UIDeviceOrientationDidChangeNotification
                                                    object:nil];
-    }
 
     // the timer used to dim the overlay
     dimTimer = [[NSTimer alloc] initWithFireDate:(IS_DUALHEAD()) ? HIDING_TIME_NEVER : [NSDate dateWithTimeIntervalSinceNow:6]
@@ -205,8 +207,6 @@
                                                    object:nil];
     }
     
-    self.containerWindow = [[UIApplication sharedApplication] keyWindow];
-
     // present the overlay
     [UIView beginAnimations:@"showing overlay" context:NULL];
     [UIView setAnimationDuration:2];
--- a/project_files/HedgewarsMobile/SDL.patch	Tue Apr 05 16:15:20 2011 -0400
+++ b/project_files/HedgewarsMobile/SDL.patch	Thu Apr 07 13:21:11 2011 +0200
@@ -1,26 +1,26 @@
-diff -r 48067bfc300c Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
---- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Mon Feb 14 11:50:18 2011 -0600
-+++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sun Mar 13 18:22:16 2011 +0100
-@@ -1695,6 +1695,7 @@
+diff -r 8a04b596b472 Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
+--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Tue Apr 05 09:50:25 2011 -0700
++++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Tue Apr 05 22:19:33 2011 +0200
+@@ -1602,6 +1602,7 @@
  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  				GCC_C_LANGUAGE_STANDARD = c99;
  				GCC_DEBUGGING_SYMBOLS = full;
 +				GCC_THUMB_SUPPORT = NO;
  				GCC_WARN_ABOUT_RETURN_TYPE = YES;
  				GCC_WARN_UNUSED_VARIABLE = NO;
- 				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
-@@ -1712,6 +1713,7 @@
+ 				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
+@@ -1619,6 +1620,7 @@
  				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  				GCC_C_LANGUAGE_STANDARD = c99;
 +				GCC_THUMB_SUPPORT = NO;
  				GCC_WARN_ABOUT_RETURN_TYPE = YES;
  				GCC_WARN_UNUSED_VARIABLE = NO;
- 				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
-diff -r 48067bfc300c include/SDL_config_iphoneos.h
---- a/include/SDL_config_iphoneos.h	Mon Feb 14 11:50:18 2011 -0600
-+++ b/include/SDL_config_iphoneos.h	Sun Mar 13 18:22:16 2011 +0100
-@@ -119,7 +119,7 @@
+ 				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
+diff -r 8a04b596b472 include/SDL_config_iphoneos.h
+--- a/include/SDL_config_iphoneos.h	Tue Apr 05 09:50:25 2011 -0700
++++ b/include/SDL_config_iphoneos.h	Tue Apr 05 22:19:33 2011 +0200
+@@ -107,7 +107,7 @@
  /* enable iPhone version of Core Audio driver */
  #define SDL_AUDIO_DRIVER_COREAUDIOIPHONE 1
  /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
@@ -29,7 +29,7 @@
  
  /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
  #define SDL_HAPTIC_DISABLED	1
-@@ -140,15 +140,18 @@
+@@ -128,15 +128,18 @@
  
  /* Supported video drivers */
  #define SDL_VIDEO_DRIVER_UIKIT	1
@@ -51,7 +51,7 @@
  
  /* enable iPhone keyboard support */
  #define SDL_IPHONE_KEYBOARD 1
-@@ -158,4 +161,7 @@
+@@ -146,4 +149,7 @@
   */
  #define SDL_IPHONE_MAX_GFORCE 5.0
  
@@ -59,33 +59,14 @@
 +#define SDL_VIEW_TAG 456987
 +
  #endif /* _SDL_config_iphoneos_h */
-diff -r 48067bfc300c src/video/uikit/SDL_uikitappdelegate.m
---- a/src/video/uikit/SDL_uikitappdelegate.m	Mon Feb 14 11:50:18 2011 -0600
-+++ b/src/video/uikit/SDL_uikitappdelegate.m	Sun Mar 13 18:22:16 2011 +0100
-@@ -35,6 +35,7 @@
- static int forward_argc;
- static char **forward_argv;
- 
-+#if 0
- int main(int argc, char **argv) {
- 
-     int i;
-@@ -55,6 +56,7 @@
-     [pool release];
-     
- }
-+#endif
- 
- @implementation SDLUIKitDelegate
- 
-diff -r 48067bfc300c src/video/uikit/SDL_uikitopengles.m
---- a/src/video/uikit/SDL_uikitopengles.m	Mon Feb 14 11:50:18 2011 -0600
-+++ b/src/video/uikit/SDL_uikitopengles.m	Sun Mar 13 18:22:16 2011 +0100
+diff -r 8a04b596b472 src/video/uikit/SDL_uikitopengles.m
+--- a/src/video/uikit/SDL_uikitopengles.m	Tue Apr 05 09:50:25 2011 -0700
++++ b/src/video/uikit/SDL_uikitopengles.m	Tue Apr 05 22:19:33 2011 +0200
 @@ -117,6 +117,7 @@
                                      majorVersion: _this->gl_config.major_version];
      
      data->view = view;
 +    view.tag = SDL_VIEW_TAG;
-     
-     /* add the view to our window */
-     [uiwindow addSubview: view ];
+     view->viewcontroller = data->viewcontroller;
+     if (view->viewcontroller != nil) {
+         [view->viewcontroller setView:view];