public void GotoToil(LordToil newLordToil) { LordToil previousToil = curLordToil; if (curLordToil != null) { curLordToil.Cleanup(); } curLordToil = newLordToil; ticksInToil = 0; if (curLordToil.lord != this) { Log.Error("curLordToil lord is " + ((curLordToil.lord == null) ? "null (forgot to add toil to graph?)" : curLordToil.lord.ToString())); curLordToil.lord = this; } curLordToil.Init(); for (int i = 0; i < graph.transitions.Count; i++) { if (graph.transitions[i].sources.Contains(curLordToil)) { graph.transitions[i].SourceToilBecameActive(graph.transitions[i], previousToil); } } curLordToil.UpdateAllDuties(); }
public void AddPawn(Pawn p) { if (ownedPawns.Contains(p)) { Log.Error("Lord for " + faction.ToStringSafe() + " tried to add " + p + " whom it already controls."); return; } if (p.GetLord() != null) { Log.Error("Tried to add pawn " + p + " to lord " + this + " but this pawn is already a member of lord " + p.GetLord() + ". Pawns can't be members of more than one lord at the same time."); return; } ownedPawns.Add(p); numPawnsEverGained++; Map.attackTargetsCache.UpdateTarget(p); curLordToil.UpdateAllDuties(); curJob.Notify_PawnAdded(p); }