mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Make sure a fertilized egg loads properly when loading a pre-ticks save
This commit is contained in:
		
							parent
							
								
									270ac427c8
								
							
						
					
					
						commit
						152a745af2
					
				
					 1 changed files with 8 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -1968,7 +1968,7 @@ namespace RJW_Menstruation
 | 
			
		|||
        public class Egg : IExposable
 | 
			
		||||
        {
 | 
			
		||||
            public bool fertilized;
 | 
			
		||||
            public int lifeSpanTicks;
 | 
			
		||||
            public int lifeSpanTicks;   // Actual ticks scaled by cycleAcceleration
 | 
			
		||||
            public Pawn fertilizer;
 | 
			
		||||
            public int ageTicks;
 | 
			
		||||
            public int ticksSinceFertilization = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -1995,23 +1995,25 @@ namespace RJW_Menstruation
 | 
			
		|||
                {
 | 
			
		||||
                    int lifespanhrs = -1;
 | 
			
		||||
                    int position = -1;
 | 
			
		||||
                    int fertstage = -1;
 | 
			
		||||
                    Scribe_Values.Look(ref lifespanhrs, "lifespanhrs", lifespanhrs, true);
 | 
			
		||||
                    Scribe_Values.Look(ref position, "position", position, true);
 | 
			
		||||
                    Scribe_Values.Look(ref fertstage, "fertstage", fertstage, true);
 | 
			
		||||
                    if (lifespanhrs >= 0) lifeSpanTicks = lifespanhrs * GenDate.TicksPerHour;
 | 
			
		||||
                    if (position >= 0) ageTicks = position * GenDate.TicksPerHour;
 | 
			
		||||
                    if (fertstage >= 0) ticksSinceFertilization = fertstage * GenDate.TicksPerHour;
 | 
			
		||||
                }
 | 
			
		||||
                Scribe_References.Look(ref fertilizer, "fertilizer", true);
 | 
			
		||||
                Scribe_Values.Look(ref fertilized, "fertilized", false);
 | 
			
		||||
                Scribe_Values.Look(ref lifeSpanTicks, "lifeSpanTicks", lifeSpanTicks, true);
 | 
			
		||||
                Scribe_Values.Look(ref ageTicks, "ageTicks", ageTicks, true);
 | 
			
		||||
                Scribe_Values.Look(ref ticksSinceFertilization, "ticksSinceFertilization", 0);
 | 
			
		||||
                if (ticksSinceFertilization == 0 && Scribe.mode == LoadSaveMode.LoadingVars)
 | 
			
		||||
                {
 | 
			
		||||
                    // A bit awkward to do this twice, but it prevents ticksSinceFertilization from getting overwritten on a fertstage load
 | 
			
		||||
                    int fertstage = -1;
 | 
			
		||||
                    Scribe_Values.Look(ref fertstage, "fertstage", fertstage, true);
 | 
			
		||||
                    if (fertstage >= 0) ticksSinceFertilization = fertstage * GenDate.TicksPerHour;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class HediffComp_Anus : HediffComp
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue