public AttackSuccessfulCompletionType(pAttack_Successful_Completion_Type p) : base(1) { if (null != p.EngramRange) { this.Range = new EngramRange(p.EngramRange); } this.species = p.Species; this.capability = p.Capability; this.targetSpecies = p.TargetSpecies; this.newState = p.NewState; if (null != p.DoThisList) { for (int i = 0; i < p.DoThisList.Count; i++) { object performer = p.DoThisList[i]; switch (performer.GetType().Name.ToString()) { // Chatropom manipulation is not supported here -- what would be the intent? case "pMoveType": this.doThisList.Add(new Move_EventType((pMoveType)performer)); /* * this is not needed because in ScenarioEvent constructor(?) if (!this.AllUnits.Contains(((pMoveType)performer).UnitID)) { this.AllUnits.Add(((pMoveType)performer).UnitID); } */ break; case "pRevealType": Reveal_EventType r = new Reveal_EventType((pRevealType)performer); r.Genus = Genealogy.GetGenus(r.UnitID); this.doThisList.Add(r); break; case "pStateChangeType": this.doThisList.Add(new StateChangeEvent((pStateChangeType)performer)); break; case "pDockType": this.doThisList.Add(new StateChangeEvent((pStateChangeType)performer)); break; case "pTransferType": this.doThisList.Add(new TransferEvent((pTransferType)performer)); break; case "pLaunchType": this.doThisList.Add(new LaunchEventType((pLaunchType)performer)); if (!this.AllUnits.Contains(((pLaunchType)performer).Child)) { this.AllUnits.Add(((pLaunchType)performer).Child); } break; case "pWeaponLaunchType": this.doThisList.Add(new WeaponLaunchEventType((pWeaponLaunchType)performer)); if (!this.AllUnits.Contains(((pWeaponLaunchType)performer).Child)) { this.AllUnits.Add(((pWeaponLaunchType)performer).Child); } break; case "pChangeEngramType": this.doThisList.Add(new ChangeEngramType((pChangeEngramType)performer)); break; case "pRemoveEngramType": this.doThisList.Add(new RemoveEngramEvent((pRemoveEngramType)performer)); break; case "pFlushEventType": this.doThisList.Add(new FlushEvents((pFlushEventsType)performer)); break; default: Coordinator.debugLogger.LogError("Scenario reader", "Unknown happening event type for " + performer.ToString()); break; } } } }
public override pAttack_Successful_Completion_Type pGetAttackSuccessfulCompletion() { string species = "Unknown species"; try { reader.Read(); // command name pEngramRange engramRange = null; if ("EngramRange" == reader.Name) { engramRange = pGetEngramRange(); } species = pGetString(); string capability = pGetString(); string targetSpecies = ""; // List<object> targetDoThisList = new List<object>(); if ("TargetSpecies" == reader.Name) targetSpecies = pGetString(); // targetDoThisList = pGetDoThisList(); string newState = ""; if ("NewState" == reader.Name) newState = pGetString(); List<object> doThisList = pGetDoThisList(); pAttack_Successful_Completion_Type returnValue = new pAttack_Successful_Completion_Type(species, capability, doThisList, targetSpecies,/* targetDoThisList, */engramRange, newState); return returnValue; } catch (SystemException e) { throw new ApplicationException("Problem parsing Attack_Successful_Completion for species: " + species, e); } }