OSDN Git Service

またまたバグ発見、修正
authorKillery <Killery@kiritani-no-mac-mini.local>
Wed, 16 Dec 2015 09:23:58 +0000 (18:23 +0900)
committer桐谷 諭史 <Killery@kiritani-no-Mac-mini.local>
Wed, 16 Dec 2015 09:23:58 +0000 (18:23 +0900)
Awars III/MapEditor.m

index 0c060df..9e436d6 100755 (executable)
     if(EDproceedFlag){
     
     MAPSCRIPT MS = MF[MFselectedRow+1].MS;
-    MS.D = MSDTOPP;
-    for(int i = 0;i < eventListRow;i++){
+    MS.D = MSDTOP;
+    /*
+        for(int i = 0;i < eventListRow;i++){
         MS.D = MS.D->next;
     }
-    
+    */
+        
     if([EDswitch1Btn state] != 0){
         MS.D->switch1f = true;
     }else{
     }else{
         MS.D->switch2f = false;
     }
-    MS.D = MSDTOPP;
         
     }
     
     
     MAPSCRIPT MS = MF[MFselectedRow+1].MS;
     MAPSCRIPTD *mdTop = MS.D;
-
-    for (int i = 0;i < eventListRow;i++) {
+    
+    
+    for (int i = 0;i < eventListRow-1;i++) {
         MS.D = MS.D->next;
     }
-    //msdtop = MS.D;
+    msdtop = MS.D;
     
     if([eventListTV clickedRow] >= 0){
 
             [self didChangeValueForKey:@"eventListMA"];
             [eventListAC setSelectionIndex:[eventListMA count]-2];
             
-            if(!MS.D){
+            if(!mdTop){
                 MS.D = calloc(1, sizeof(MAPSCRIPTD));
                 mdTop = MS.D;
-                //msdtop = MS.D;
+                msdtop = MS.D;
                 MS.D->type = -1;
                 if(!mapLoadFlagForMSD2 && mapLoadFlagForMSD){
                     MSDTOPP->next = MS.D;
                     mapLoadFlagForMSD2 = true;
                 }
                 if(!mapLoadFlagForMSD){
-                    MSDTOPP = msdtop;
+                    MSDTOPP = mdTop;
                     mapLoadFlagForMSD = true;
                 }
-            }
-            else{
-                while (MS.D->next)
-                    MS.D = MS.D->next;
+                MSDTOP = MS.D;
+            }else if(!MS.D->next){
+                MS.D->next = calloc(1, sizeof(MAPSCRIPTD));
                 
-                MS.D->type = -1;
-                MS.D->next = NULL;
-                //msdtop = MS.D->next;
+                MS.D->next->type = -1;
+                MS.D->next->next = NULL;
+                msdtop = MS.D->next;
             }
             
             MS.D = mdTop;
-            
+            MSDTOP = MS.D;
             if(!MS.SCRPTname) MS.SCRPTname = [NSMutableArray new];
             [MS.SCRPTname addObject:@"新規イベント"];
+        }else if([eventListTV clickedRow] == 0){
+            
+            if(MS.D){
+                MS.D->type = -1;
+                msdtop = MS.D;
+            }
+        }else{
+            if(MS.D->next){
+                MS.D = MS.D->next;
+                MS.D->type = -1;
+                msdtop = MS.D;
+            }
+        
         }
         
         
     EDrow = [eventDetailListTV clickedRow];
     
     MAPSCRIPT MS = MF[MFselectedRow+1].MS;
+    MAPSCRIPTD *msd = MF[MFselectedRow+1].MS.D;
     
     MS.D = msdtop;
     
         
     }
     
-    MF[MFselectedRow+1].MS.D = MS.D;
+    msdtop = MS.D;
     
     
+    MF[MFselectedRow+1].MS.D = MS.D;
+    MF[MFselectedRow+1].MS.D = MSDTOPP;
     
    // NSLog(@"oops");
 }
 -(IBAction)eventInsert:(id)sender{
 
     MAPSCRIPT MS = MF[MFselectedRow+1].MS;
-    MSDTOPP = MF[MFselectedRow+1].MS.D;
+    //MSDTOPP = MF[MFselectedRow+1].MS.D;
     NSInteger sel = [eventListAC selectionIndex];
     
     if(sel < [eventListMA count]){