public static void Look(ref TargetInfo value, bool saveDestroyedThings, string label, TargetInfo defaultValue)
 {
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         if (!value.Equals(defaultValue))
         {
             if (value.Thing != null && Scribe_References.CheckSaveReferenceToDestroyedThing(value.Thing, label, saveDestroyedThings))
             {
                 return;
             }
             if (!value.HasThing && value.Cell.IsValid && (value.Map == null || !Find.Maps.Contains(value.Map)))
             {
                 Scribe.saver.WriteElement(label, "null");
             }
             else
             {
                 Scribe.saver.WriteElement(label, value.ToString());
             }
         }
     }
     else if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         value = ScribeExtractor.TargetInfoFromNode(Scribe.loader.curXmlParent[label], label, defaultValue);
     }
     else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
     {
         value = ScribeExtractor.ResolveTargetInfo(value, label);
     }
 }
 public static void Look(ref LocalTargetInfo value, bool saveDestroyedThings, string label, LocalTargetInfo defaultValue)
 {
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         if (!value.Equals(defaultValue))
         {
             if (value.Thing != null)
             {
                 if (Scribe_References.CheckSaveReferenceToDestroyedThing(value.Thing, label, saveDestroyedThings))
                 {
                     return;
                 }
             }
             Scribe.saver.WriteElement(label, value.ToString());
         }
     }
     else if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         value = ScribeExtractor.LocalTargetInfoFromNode(Scribe.loader.curXmlParent[label], label, defaultValue);
     }
     else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
     {
         value = ScribeExtractor.ResolveLocalTargetInfo(value, label);
     }
 }
 public static void Look <T>(ref T refee, string label, bool saveDestroyedThings = false) where T : ILoadReferenceable
 {
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         if (refee == null)
         {
             Scribe.saver.WriteElement(label, "null");
         }
         else
         {
             Thing thing = ((object)refee) as Thing;
             if (thing != null && Scribe_References.CheckSaveReferenceToDestroyedThing(thing, label, saveDestroyedThings))
             {
                 return;
             }
             if (UnityData.isDebugBuild && thing != null)
             {
                 if (!thing.def.HasThingIDNumber)
                 {
                     Log.Error("Trying to cross-reference save Thing which lacks ID number: " + refee);
                     Scribe.saver.WriteElement(label, "null");
                     return;
                 }
                 if (thing.IsSaveCompressible())
                 {
                     Log.Error("Trying to save a reference to a thing that will be compressed away: " + refee);
                     Scribe.saver.WriteElement(label, "null");
                     return;
                 }
             }
             string uniqueLoadID = refee.GetUniqueLoadID();
             Scribe.saver.WriteElement(label, uniqueLoadID);
             Scribe.saver.loadIDsErrorsChecker.RegisterReferenced((ILoadReferenceable)(object)refee, label);
         }
     }
     else if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         if (Scribe.loader.curParent != null && Scribe.loader.curParent.GetType().IsValueType)
         {
             Log.Warning("Trying to load reference of an object of type " + typeof(T) + " with label " + label + ", but our current node is a value type. The reference won't be loaded properly. curParent=" + Scribe.loader.curParent);
         }
         XmlNode xmlNode      = Scribe.loader.curXmlParent[label];
         string  targetLoadID = (xmlNode == null) ? null : xmlNode.InnerText;
         Scribe.loader.crossRefs.loadIDs.RegisterLoadIDReadFromXml(targetLoadID, typeof(T), label);
     }
     else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
     {
         refee = Scribe.loader.crossRefs.TakeResolvedRef <T>(label);
     }
 }