From: Michael H. <mh...@us...> - 2000-09-17 10:46:21
|
Update of /cvsroot/pythianproject/PythianProject/Source/Units In directory slayer.i.sourceforge.net:/tmp/cvs-serv5988/Source/Units Modified Files: VoterAICore.pas convFileIO.pas conversationObjectsUnit.pas Log Message: renamed AI designer form file. Conversation editor mods. -mike Index: VoterAICore.pas =================================================================== RCS file: /cvsroot/pythianproject/PythianProject/Source/Units/VoterAICore.pas,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** VoterAICore.pas 2000/09/04 17:51:55 1.4 --- VoterAICore.pas 2000/09/17 10:46:17 1.5 *************** *** 35,43 **** FName :string; FAuthor :string; ! FNotes :string; public property Name :string read FName write FName; property Author :String read FAuthor write FAuthor; ! property Notes :string read FNotes write FNotes; property Goals :TList read FGoals; property Ideas :TDataContainerManager read FIdeas; --- 35,45 ---- FName :string; FAuthor :string; ! FNotes :TStringList; ! function GetNotes: string; ! procedure SetNotes(const Value: string); public property Name :string read FName write FName; property Author :String read FAuthor write FAuthor; ! property Notes :string read GetNotes write SetNotes; property Goals :TList read FGoals; property Ideas :TDataContainerManager read FIdeas; *************** *** 127,130 **** --- 129,150 ---- end; + // stimulus and idea objects come here + // they are a little odd because other objects do not reference them + // directly. Instead, they have unique names that are used in + // data keys and interaction goes through a key manager. + + TStimulusShell = class(TStimulus) + end; + + TStimulus = class(TStimulusShell) + end; + + TIdeaShell = class(TDataKey) + + end; + + TIdea = class(TIdeaShell) + end; + var DomImpl :TDomImplementation; *************** *** 141,145 **** FGoals := TList.Create; FName := newName; ! FScript := TScript.Create; end; --- 161,166 ---- FGoals := TList.Create; FName := newName; ! FScript := TScript.Create; ! FNotes := TStringList.Create; end; *************** *** 163,166 **** --- 184,197 ---- end; + function TAIShell.GetNotes: string; + begin + Result := FNotes.Text; + end; + + procedure TAIShell.SetNotes(const Value: string); + begin + FNotes.Text := Value; + end; + { TKeySetShell } *************** *** 255,259 **** E1,SE, E2,E3,E4 :TdomElement; T1: TdomText; ! a,b,c,d,e:integer; AI:TAIShell; G:TGoalShell; --- 286,290 ---- E1,SE, E2,E3,E4 :TdomElement; T1: TdomText; ! a,b,c,d:integer; AI:TAIShell; G:TGoalShell; Index: convFileIO.pas =================================================================== RCS file: /cvsroot/pythianproject/PythianProject/Source/Units/convFileIO.pas,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** convFileIO.pas 2000/09/10 16:47:17 1.2 --- convFileIO.pas 2000/09/17 10:46:17 1.3 *************** *** 108,129 **** newpos.AppendChild(element); end else ! if child is TConversationGroupEnable then begin // @@mike 16/7/00 ! element := d.CreateElement('groupenable'); element.SetAttribute('id',IntToStr(child.ID)); ! if Assigned(TConversationGroupEnable(child).TargetGroup) then ! element.SetAttribute('target',IntToStr(TConversationGroupEnable(child).TargetGroup.ID)) else element.SetAttribute('target',''); SetEnabled(child,element); newpos.AppendChild(element); end else ! if child is TConversationGroupDisable then begin // @@mike 16/7/00 ! element := d.CreateElement('groupdisable'); element.SetAttribute('id',IntToStr(child.ID)); ! if assigned(TConversationGroupDisable(child).TargetGroup) then ! element.SetAttribute('target',IntToStr(TConversationGroupDisable(child).TargetGroup.ID)) else element.SetAttribute('target',''); SetEnabled(child,element); --- 108,129 ---- newpos.AppendChild(element); end else ! if child is TConversationEnable then begin // @@mike 16/7/00 ! element := d.CreateElement('enable'); element.SetAttribute('id',IntToStr(child.ID)); ! if Assigned(TConversationEnable(child).Target) then ! element.SetAttribute('target',IntToStr(TConversationEnable(child).Target.ID)) else element.SetAttribute('target',''); SetEnabled(child,element); newpos.AppendChild(element); end else ! if child is TConversationDisable then begin // @@mike 16/7/00 ! element := d.CreateElement('disable'); element.SetAttribute('id',IntToStr(child.ID)); ! if assigned(TConversationDisable(child).Target) then ! element.SetAttribute('target',IntToStr(TConversationDisable(child).Target.ID)) else element.SetAttribute('target',''); SetEnabled(child,element); *************** *** 303,309 **** TConversationGroup(LastParent).AddChild(obj); end else ! if TdomElement(node).GetTagName = 'groupenable' then begin ! obj := TConversationGroupEnable.Create(nil); if not TdomElement(node).hasAttribute('id') then raise Exception.Create('Internal Exception 0: Element does not have ID: TranslateDOMToConvTree'); obj.ID := StrToInt(TdomElement(node).GetAttribute('id')); --- 303,309 ---- TConversationGroup(LastParent).AddChild(obj); end else ! if TdomElement(node).GetTagName = 'enable' then begin ! obj := TConversationEnable.Create(nil); if not TdomElement(node).hasAttribute('id') then raise Exception.Create('Internal Exception 0: Element does not have ID: TranslateDOMToConvTree'); obj.ID := StrToInt(TdomElement(node).GetAttribute('id')); *************** *** 315,325 **** target := StrToInt(TdomElement(node).getAttribute('target')); LinkList.Add(TLinkLoaderObj.Create(obj,target,CurConv)); ! end else TConversationGroupEnable(obj).TargetGroup := nil; if not (LastParent is TConversationGroup) then raise Exception.Create('Internal Exception 7: TranslateDOMToConvTree'); TConversationGroup(LastParent).AddChild(obj); end else ! if TdomElement(node).GetTagName = 'groupdisable' then begin ! obj := TConversationGroupDisable.Create(nil); if not TdomElement(node).hasAttribute('id') then raise Exception.Create('Internal Exception 0: Element does not have ID: TranslateDOMToConvTree'); obj.ID := StrToInt(TdomElement(node).GetAttribute('id')); --- 315,325 ---- target := StrToInt(TdomElement(node).getAttribute('target')); LinkList.Add(TLinkLoaderObj.Create(obj,target,CurConv)); ! end else TConversationEnable(obj).Target := nil; if not (LastParent is TConversationGroup) then raise Exception.Create('Internal Exception 7: TranslateDOMToConvTree'); TConversationGroup(LastParent).AddChild(obj); end else ! if TdomElement(node).GetTagName = 'disable' then begin ! obj := TConversationDisable.Create(nil); if not TdomElement(node).hasAttribute('id') then raise Exception.Create('Internal Exception 0: Element does not have ID: TranslateDOMToConvTree'); obj.ID := StrToInt(TdomElement(node).GetAttribute('id')); *************** *** 331,335 **** LinkList.Add(TLinkLoaderObj.Create(obj,target,Curconv)); end else ! TConversationGroupDisable(obj).TargetGroup := nil; if not (LastParent is TConversationGroup) then raise Exception.Create('Internal Exception 10: TranslateDOMToConvTree'); GetEnabled(obj,node); --- 331,335 ---- LinkList.Add(TLinkLoaderObj.Create(obj,target,Curconv)); end else ! TConversationDisable(obj).Target := nil; if not (LastParent is TConversationGroup) then raise Exception.Create('Internal Exception 10: TranslateDOMToConvTree'); GetEnabled(obj,node); *************** *** 346,353 **** if llo.obj is TConversationJump then TConversationJump(llo.obj).WhereTo := llo.LinkConv.GetObjOfID(llo.LinkId) ! else if llo.obj is TConversationGroupEnable then ! TConversationGroupEnable(llo.obj).TargetGroup := TConvGroup(llo.LinkConv.GetObjOfID(llo.LinkID)) ! else if llo.obj is TConversationGroupDisable then ! TConversationGroupDisable(llo.obj).TargetGroup := TConvGroup(llo.LinkConv.GetObjOfID(llo.LinkId)); end; while linklist.count > 0 do --- 346,353 ---- if llo.obj is TConversationJump then TConversationJump(llo.obj).WhereTo := llo.LinkConv.GetObjOfID(llo.LinkId) ! else if llo.obj is TConversationEnable then ! TConversationEnable(llo.obj).Target := TConvGroup(llo.LinkConv.GetObjOfID(llo.LinkID)) ! else if llo.obj is TConversationDisable then ! TConversationDisable(llo.obj).Target := TConvGroup(llo.LinkConv.GetObjOfID(llo.LinkId)); end; while linklist.count > 0 do Index: conversationObjectsUnit.pas =================================================================== RCS file: /cvsroot/pythianproject/PythianProject/Source/Units/conversationObjectsUnit.pas,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** conversationObjectsUnit.pas 2000/09/15 17:33:44 1.5 --- conversationObjectsUnit.pas 2000/09/17 10:46:17 1.6 *************** *** 126,147 **** end; ! TConversationGroupEnable = class(TConversationCommand) private ! FTargetGroup:TConvGroup; ! procedure SetTargetGroup(newTarget:TConvGroup); public ! property TargetGroup :TConvGroup read FTargetGroup write SetTargetGroup; ! constructor Create(ATarget:TConvgroup); procedure RemoveLinks(obj:TConversationObject); override ; procedure Run; override; end; ! TConversationGroupDisable = class(TConversationCommand) private ! FTargetGroup:TConvGroup; ! procedure SetTargetGroup(newTarget:TConvGroup); public ! property TargetGroup :TConvGroup read FTargetGroup write SetTargetGroup; ! constructor Create(ATarget:TConvgroup); procedure RemoveLinks(obj:TConversationObject); override ; procedure Run; override; --- 126,147 ---- end; ! TConversationEnable = class(TConversationCommand) private ! FTarget:TConversationObject; ! procedure SetTarget(newTarget:TConversationObject); public ! property Target :TConversationObject read FTarget write SetTarget; ! constructor Create(ATarget:TConversationObject); procedure RemoveLinks(obj:TConversationObject); override ; procedure Run; override; end; ! TConversationDisable = class(TConversationCommand) private ! FTarget:TConversationObject; ! procedure SetTarget(newTarget:TConversationObject); public ! property Target :TConversationObject read FTarget write SetTarget; ! constructor Create(ATarget:TConversationObject); procedure RemoveLinks(obj:TConversationObject); override ; procedure Run; override; *************** *** 271,278 **** function TNPCSpeech.ReturnStrRepr: string; begin ! if Text.Count > 0 then Result := Text.Strings[0] else if Text.Count > 1 then ! Result := Text.Strings[0] + '...' else Result := 'NPC Speech: empty'; --- 271,278 ---- function TNPCSpeech.ReturnStrRepr: string; begin ! if Text.Count = 1 then Result := Text.Strings[0] else if Text.Count > 1 then ! Result := Text.Strings[0] + ' ...' else Result := 'NPC Speech: empty'; *************** *** 340,348 **** function TConversationGroup.InternalNext: TConversationObject; begin Result := inherited InternalNext; if Children.Count > 0 then ! Result := TConversationGroup(Children.Items[0]); ! // 1st child (item) end; --- 340,355 ---- function TConversationGroup.InternalNext: TConversationObject; + var a:integer; begin Result := inherited InternalNext; if Children.Count > 0 then ! // @@mike - 16/9/2000, fixed bug so first enabled item is selected ! for a := 0 to Children.Count-1 do ! begin ! Result := TConversationGroup(Children.Items[a]); ! if result.enabled then ! break; ! end; ! // 1st child (item) [that is enabled] end; *************** *** 392,395 **** --- 399,407 ---- l:TList; begin + if id = Self.ID then + begin + result := self; + exit; + end; l := tlist.create; FillList(l); *************** *** 457,461 **** function TConvGroup.ReturnStrRepr: string; begin ! Result := name; end; --- 469,475 ---- function TConvGroup.ReturnStrRepr: string; begin ! if name <> '' then ! Result := name ! else Result := 'Unnamed Group'; end; *************** *** 507,510 **** --- 521,525 ---- repeat TConversation(Conversations.Items[0]).Free; + Conversations.Delete(0); until Conversations.Count = 0; end; *************** *** 619,692 **** end; ! { TConversationGroupEnable } ! constructor TConversationGroupEnable.Create(ATarget:TConvgroup); begin ! FTargetGroup := ATarget; ! if FTargetGroup = nil then ! inherited Create('Enable Group (untargeted)') else begin ! inherited Create('Enable Group "'+FTargetGroup.Name+'"'); end; end; ! procedure TConversationGroupEnable.RemoveLinks(obj: TConversationObject); begin ! if TargetGroup = obj then ! TargetGroup := nil; end; ! procedure TConversationGroupEnable.Run; begin inherited; ! if Assigned(FTargetGroup) then ! FTargetGroup.Enabled := True; end; ! procedure TConversationGroupEnable.SetTargetGroup(newTarget: TConvGroup); begin ! FTargetGroup := newTarget; ! if FTargetGroup = nil then ! Name := 'Enable group (untargeted)' else begin ! Name := 'Enable group "'+FTargetGroup.Name+'"'; end; end; ! { TConversationGroupDisable } ! constructor TConversationGroupDisable.Create(ATarget: TConvgroup); begin ! FTargetGroup := ATarget; ! if FTargetGroup = nil then ! inherited Create('Disable Group (untargeted)') ! else ! begin ! inherited Create('Disable Group "'+FTargetGroup.Name+'"'); ! end; end; ! procedure TConversationGroupDisable.RemoveLinks(obj: TConversationObject); begin ! if TargetGroup = obj then ! TargetGroup := nil; end; ! procedure TConversationGroupDisable.Run; begin inherited; ! if Assigned(FTargetGroup) then ! FTargetGroup.Enabled := False; end; ! procedure TConversationGroupDisable.SetTargetGroup(newTarget: TConvGroup); begin ! FTargetGroup := newTarget; ! if FTargetGroup = nil then ! Name := 'Disable group (untargeted)' else begin ! Name := 'Disable group "'+FTargetGroup.Name+'"'; end; end; --- 634,717 ---- end; ! { TConversationEnable } ! constructor TConversationEnable.Create(ATarget:TConversationObject); begin ! FTarget := ATarget; ! if FTarget = nil then ! inherited Create('Enable (untargeted)') else begin ! if Length(FTarget.ReturnStrRepr) > 20 then ! inherited Create('Enable "'+Copy(FTarget.ReturnStrRepr,0,20)+'..."') ! else ! inherited Create('Enable "'+FTarget.ReturnStrRepr+'"'); end; end; ! procedure TConversationEnable.RemoveLinks(obj: TConversationObject); begin ! if Target = obj then ! Target := nil; end; ! procedure TConversationEnable.Run; begin inherited; ! if Assigned(FTarget) then ! FTarget.Enabled := True; end; ! procedure TConversationEnable.SetTarget(newTarget: TConversationObject); begin ! FTarget := newTarget; ! if FTarget = nil then ! Name := 'Enable (untargeted)' else begin ! if Length(FTarget.ReturnStrRepr) > 20 then ! inherited Create('Enable "'+Copy(FTarget.ReturnStrRepr,0,20)+'..."') ! else ! inherited Create('Enable "'+FTarget.ReturnStrRepr+'"'); end; end; ! { TConversationDisable } ! constructor TConversationDisable.Create(ATarget: TConversationObject); begin ! FTarget := ATarget; ! if FTarget = nil then ! inherited Create('Disable (untargeted)') ! else begin ! if Length(FTarget.ReturnStrRepr) > 20 then ! inherited Create('Disable "'+Copy(FTarget.ReturnStrRepr,0,20)+'..."') ! else ! inherited Create('Disable "'+FTarget.ReturnStrRepr+'"'); end; end; ! procedure TConversationDisable.RemoveLinks(obj: TConversationObject); begin ! if Target = obj then ! Target := nil; end; ! procedure TConversationDisable.Run; begin inherited; ! if Assigned(FTarget) then ! FTarget.Enabled := False; end; ! procedure TConversationDisable.SetTarget(newTarget: TConversationObject); begin ! FTarget := newTarget; ! if FTarget = nil then ! Name := 'Disable (untargeted)' else begin ! if Length(FTarget.ReturnStrRepr) > 20 then ! Name := 'Disable "'+Copy(FTarget.ReturnStrRepr,0,20)+'..."' ! else ! Name := 'Disable "'+FTarget.ReturnStrRepr+'"'; end; end; |