Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Merging norefs
- - By PeterW [gb] Date 2010-08-03 22:40
Okay, I think all scripts are fixed, see commit. If a scripter cares about what I might have done to his script, he should better have a look.

Now I guess only saving support is missing, then norefs should be merge-ready.
Parent - - By Günther [de] Date 2010-08-03 23:50 Edited 2010-08-04 00:23
You should take a look at the diff from 5de9fd9bfa22 to c40d5914b57b and fix the mismerges. (In hgtk log, click on 5de9fd9bfa22 and then on "diff to second Parent". It's not quite as informative as gitk's merge diff view, but better than nothing.) For example, planet/Objects.c4d/Environment.c4d/Clouds.c4d/Script.c got a superflous function, planet/Parkour.c4f/Cavern.c4s/Script.c still has conflict markers, and I'm not sure why the noref branch should change a mesh and a skeleton.

Also, your conflict resolution in C4AulParse.cpp left case AB_PARN_SET: without it's break. (I've noticed that while trying to do the merge myself. Here's the diff to your version, complete with a new mismerge in C4AulParse.cpp that was automatically resolved by mercurial or kdiff3:
diff -r 5de9fd9bfa22 -r 84cc5f6d1848 planet/Objects.c4d/Environment.c4d/Clouds.c4d/Script.c
--- a/planet/Objects.c4d/Environment.c4d/Clouds.c4d/Script.c  Sun Aug 01 16:23:36 2010 +0100
+++ b/planet/Objects.c4d/Environment.c4d/Clouds.c4d/Script.c  Wed Aug 04 01:17:11 2010 +0200
@@ -1,27 +1,5 @@
/*-- Cloud Placer --*/

-<<<<<<< local
-//Great thanks to Maikel for the following function provided
-global func FindPosInMat(string sMat, int iXStart, int iYStart, int iWidth, int iHeight, int iSize)
-{
-  var iX, iY;
-  for(var i = 0; i < 500; i++)
-  {
-    iX = iXStart+Random(iWidth);
-    iY = iYStart+Random(iHeight);
-    if(GetMaterial(AbsX(iX),AbsY(iY))==Material(sMat) &&
-       GetMaterial(AbsX(iX+iSize),AbsY(iY+iSize))==Material(sMat) &&
-       GetMaterial(AbsX(iX+iSize),AbsY(iY-iSize))==Material(sMat) &&
-       GetMaterial(AbsX(iX-iSize),AbsY(iY-iSize))==Material(sMat) &&
-       GetMaterial(AbsX(iX-iSize),AbsY(iY+iSize))==Material(sMat)
-    ) {
-      return [iX, iY]; // Location found.
-    }
-  }
-  return 0; // No location found.
-}
-=======
->>>>>>> other
protected func Initialize()
{
   var iCount = LandscapeWidth()/65; //Determines how many clouds should be on a map
diff -r 5de9fd9bfa22 -r 84cc5f6d1848 planet/Parkour.c4f/Cavern.c4s/Script.c
--- a/planet/Parkour.c4f/Cavern.c4s/Script.c  Sun Aug 01 16:23:36 2010 +0100
+++ b/planet/Parkour.c4f/Cavern.c4s/Script.c  Wed Aug 04 01:17:11 2010 +0200
@@ -19,12 +19,8 @@
     if (!(pos = FindPosInMat("Tunnel", 0, LandscapeHeight() - d - 80, LandscapeWidth(), 80, 20)) || !Random(3))
       pos = FindPosInMat("Sky", 0, LandscapeHeight() - d - 80, LandscapeWidth(), 80, 20);
     else
-<<<<<<< local
-      mode = mode | RACE_CP_Respawn;
+      mode = mode | PARKOUR_CP_Respawn;
     x = pos[0]; y = pos[1];
-=======
-      mode = mode | PARKOUR_CP_Respawn;
->>>>>>> other
     // All checkpoints ordered.
     mode = mode | PARKOUR_CP_Ordered;
     goal->AddCheckpoint(x, y, mode);
diff -r 5de9fd9bfa22 -r 84cc5f6d1848 planet/System.c4g/Commits.c
--- a/planet/System.c4g/Commits.c  Sun Aug 01 16:23:36 2010 +0100
+++ b/planet/System.c4g/Commits.c  Wed Aug 04 01:17:11 2010 +0200
@@ -377,4 +377,5 @@
     }
   }
   return 0; // No location found.
-}
\ No newline at end of file
+}
+
diff -r 5de9fd9bfa22 -r 84cc5f6d1848 src/C4Version.h
--- a/src/C4Version.h  Sun Aug 01 16:23:36 2010 +0100
+++ b/src/C4Version.h  Wed Aug 04 01:17:11 2010 +0200
@@ -42,7 +42,7 @@
#define C4XVERBUILD           2
#define C4VERSIONBUILDNAME    "Cerulean"
#define C4VERSIONEXTRA        "Beta"
-#define C4REVISION            "8b0d67bef90e+c40d5914b57b+"
+#define C4REVISION            "25a791c06fff+"

#define C4ENGINEINFO          "OpenClonk Reborn Beta"
#define C4ENGINEINFOLONG      "OpenClonk Reborn Beta (Cerulean)"
diff -r 5de9fd9bfa22 -r 84cc5f6d1848 src/game/object/C4DefGraphics.cpp
--- a/src/game/object/C4DefGraphics.cpp  Sun Aug 01 16:23:36 2010 +0100
+++ b/src/game/object/C4DefGraphics.cpp  Wed Aug 04 01:17:11 2010 +0200
@@ -1084,7 +1084,7 @@
       }

       C4Value value;
-      pDef->GetPropertyVal(P_MeshTransformation, &value);
+      pDef->GetPropertyVal(P_MeshTransformation, value);
       StdMeshMatrix matrix;
       if (C4ValueToMatrix(value, &matrix))
         lpDDraw->SetMeshTransform(&matrix);
diff -r 5de9fd9bfa22 -r 84cc5f6d1848 src/script/C4AulExec.cpp
--- a/src/script/C4AulExec.cpp  Sun Aug 01 16:23:36 2010 +0100
+++ b/src/script/C4AulExec.cpp  Wed Aug 04 01:17:11 2010 +0200
@@ -204,7 +204,8 @@
         break;
       case AB_PARN_SET:
         pCurCtx->Pars[pCPos->Par.i] = pCurVal[0];
-     
+        break;
+
       case AB_PARN_CONTEXT:
         PushValue(AulExec.GetContext(AulExec.GetContextDepth()-2)->Pars[pCPos->Par.i]);
         break;
diff -r 5de9fd9bfa22 -r 84cc5f6d1848 src/script/C4AulExec.h
--- a/src/script/C4AulExec.h  Sun Aug 01 16:23:36 2010 +0100
+++ b/src/script/C4AulExec.h  Wed Aug 04 01:17:11 2010 +0200
@@ -154,7 +154,7 @@
     }
     else if (pStructure->ConvertTo(C4V_PropList) && pStructure->GetType() != C4V_Any)
     {
-      if (!pIndex->ConvertTo(C4V_String) || !pIndex->_getStr())
+      if (!pIndex->ConvertTo(C4V_String))
         throw new C4AulExecError(pCurCtx->Obj, FormatString("proplist access: index of type %s, string expected!", pIndex->GetTypeName()).getData());
       return C4V_PropList;
     }
diff -r 5de9fd9bfa22 -r 84cc5f6d1848 src/script/C4AulParse.cpp
--- a/src/script/C4AulParse.cpp  Sun Aug 01 16:23:36 2010 +0100
+++ b/src/script/C4AulParse.cpp  Wed Aug 04 01:17:11 2010 +0200
@@ -1028,12 +1028,12 @@
   case AB_NIL:
   case AB_VARN:
   case AB_PARN:
-  case AB_PARN_CONTEXT:
-  case AB_VARN_CONTEXT:
   case AB_LOCALN:
   case AB_GLOBALN:
   case AB_DUP:
     return 1;
+  case AB_PARN_CONTEXT:
+  case AB_VARN_CONTEXT:

   case AB_Pow:
   case AB_Div:
@@ -1994,11 +1994,9 @@
       if (pFunc && (Type == PARSER))
       {
         C4V_Type to = pFunc->GetParType()[size];
-        // pFunc either was the return value from a GetFirstFunc-Call or
-        // pFunc is the only function that could be called, so this loop is superflous
-        C4AulFunc * pFunc2 = pFunc;
-        while ((pFunc2 = a->Engine->GetNextSNFunc(pFunc2)))
+        {
           if (pFunc2->GetParType()[size] != to) to = C4V_Any;
+        }
         C4V_Type from;
         switch ((a->CPos-1)->bccType)
         {
diff -r 5de9fd9bfa22 -r 84cc5f6d1848 src/script/C4Value.h
--- a/src/script/C4Value.h  Sun Aug 01 16:23:36 2010 +0100
+++ b/src/script/C4Value.h  Wed Aug 04 01:17:11 2010 +0200
@@ -60,7 +60,6 @@
   // cheat a little - assume that all members have the same length
   operator void * () { return Obj; }
   operator const void * () const { return Obj; }
-  bool operator== (C4V_Data b) { return Obj == b.Obj; }
   C4V_Data &operator = (void *p) { Obj = reinterpret_cast<C4Object *>(p); return *this; }
};
Reply
Parent - - By PeterW [gb] Date 2010-08-04 10:21
I think I already fixed the first one. After Mercurial just deleted my first merge, I got kind of sloppy, I guess. No idea why that break disappeared though.

Anything else?
Parent - - By Günther [de] Date 2010-08-04 13:49
You didn't, you left the duplicate function in the script. Apart from the break and the other script, the operator== in C4Value.h should be removed.
Reply
Parent - - By PeterW [gb] Date 2010-08-04 16:51 Edited 2010-08-04 16:53
Oh, the merge duplicated it? Now this makes even less sense. And why should the operator be removed? I don't remember why I added it, but it doesn't seem to do any harm.
Parent - By Günther [de] Date 2010-08-05 02:27

> Oh, the merge duplicated it?


You modified the function in one branch, and someone else moved it in the other. Git supposedly has code to track code movement, but Mercurial is lost by such merges.

> And why should the operator be removed? I don't remember why I added it, but it doesn't seem to do any harm.


You changed the operator because it used the Ref member. And I removed it in the other branch because nobody should ever use it. If I remember correctly, I added the operator to implement the old C4Script ==, which probably was a bad idea even back then. Comparing two C4V_Data instances directly never makes any sense, because of the possibility of an integer aliasing a pointer, and on 64 bit with half of the union being unused in the integer case.
Reply
Parent - - By Newton [de] Date 2010-08-04 15:39
With which tool are you looking at the changes?
Parent - - By Günther [de] Date 2010-08-04 16:38
I used Mercurial, hgtk and kdiff3. I prefer gitk, though, and kdiff3 might be to blame for that mismerge, so another merge tool (like meld) might have been better.
Reply
Parent - By PeterW [gb] Date 2010-08-04 16:50
For the record: I used neither. That merge was done with a combination of a text editor and screw-me-over-in-every-possible-way Mercurial.
Parent - - By Newton [de] Date 2010-08-04 15:40
What are you doing in UK, btw?
Parent - By PeterW [gb] Date 2010-08-04 16:52
A PhD, as already discussed previously. University of Leeds, in case someone wants to come visit ;)
Parent - - By Newton [de] Date 2010-08-13 00:04
If I see this correctly, you forgot at least:
1. parts of the System.c4g (I remember that there was at least one function in Colors.c that used references)
2. to update the documentation
Parent - - By PeterW [gb] Date 2010-08-13 09:23 Edited 2010-08-13 09:27
You mean SplitRGBaValue? I think I fixed that earlier.

If you want a complete overview, you should also look at my first script cleanup commit - some of which was eaten up by conflicts and fixed again later.
Parent - By Newton [de] Date 2010-08-13 10:58
Ah, okay. So I take point one back.
- By Günther [de] Date 2010-09-11 19:49
I fixed the mentioned merge mistakes and merged the norefs branch. The problem with array saving isn't fixed yet, but proplists should be more reliable now, and I want the other improvements merged.
Reply
Up Topic Development / Developer's Corner / Merging norefs

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill