From: Ian D. <ia...@us...> - 2004-05-10 16:17:13
|
Update of /cvsroot/planeshift/planeshift/src/common/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30858 Modified Files: adminmessage.cpp adminmessage.h Log Message: a response in xml can now have a <script> and a <pronoun> part. Index: adminmessage.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/common/admin/adminmessage.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** adminmessage.cpp 26 Apr 2004 06:52:02 -0000 1.21 --- adminmessage.cpp 10 May 2004 16:17:02 -0000 1.22 *************** *** 486,498 **** int responseStart = 0; ! responseStart = set.FindTag( "response", responseStart ); while ( responseStart != -1 ) { psXMLTag tag( set, responseStart ); csString say; ! tag.GetTagParm("say", say); newdialog->responses.AddResponse(say); ! responseStart = set.FindTag( "response", responseStart+1 ); } --- 486,498 ---- int responseStart = 0; ! responseStart = set.FindTag( "say", responseStart ); while ( responseStart != -1 ) { psXMLTag tag( set, responseStart ); csString say; ! tag.GetTagParm("value", say); newdialog->responses.AddResponse(say); ! responseStart = set.FindTag( "say", responseStart+1 ); } *************** *** 763,768 **** } ! int psDialogManager::InsertResponseSet( stringList responseSet ) { //Notify1("Inserting the response Set"); --- 763,770 ---- } ! int psDialogManager::InsertResponseSet( psResponse &response ) { + stringList responseSet = response.responses; + csString script = response.script; //Notify1("Inserting the response Set"); *************** *** 795,800 **** command.Append ( ", pronoun_him, pronoun_her, pronoun_it, pronoun_them,script)"); ! sprintf(buffer, " VALUES ( %s, '','','','','' )", (const char*)values); ! command.Append( buffer ); //Notify2("Final Command: %s\n", command.GetData()); --- 797,811 ---- command.Append ( ", pronoun_him, pronoun_her, pronoun_it, pronoun_them,script)"); ! script = db->Escape(script); ! sprintf(buffer, " VALUES ( %s, '%s','%s','%s','%s', '%s' )", ! (const char*)values, ! response.pronoun_her.GetData(), ! response.pronoun_her.GetData(), ! response.pronoun_it.GetData(), ! response.pronoun_them.GetData(), ! script.GetData()); ! command += csString(buffer); ! ! printf("%s\n",command.GetData()); //Notify2("Final Command: %s\n", command.GetData()); *************** *** 868,872 **** psAttitudeBlock* currAttitude = currTrig->attitudes[att]; ! int id = InsertResponseSet( currAttitude->responseSet.responses ); // Store the database ID for later use by triggers. --- 879,883 ---- psAttitudeBlock* currAttitude = currTrig->attitudes[att]; ! int id = InsertResponseSet( currAttitude->responseSet ); // Store the database ID for later use by triggers. *************** *** 902,906 **** int respID = currTrig->attitudes[att]->responseSet.databaseID; ! int databaseID = InsertTrigger( phrase, playerName.GetData(), attMax, attMin, respID, goodPriorResponseID ); --- 913,917 ---- int respID = currTrig->attitudes[att]->responseSet.databaseID; ! int databaseID = InsertTrigger( phrase, area.GetData(), attMax, attMin, respID, goodPriorResponseID ); *************** *** 918,922 **** int responseID = InsertResponse( spResp->response ); int triggerID = InsertTrigger( spResp->type, ! playerName, spResp->attMax, spResp->attMin, --- 929,933 ---- int responseID = InsertResponse( spResp->response ); int triggerID = InsertTrigger( spResp->type, ! area, spResp->attMax, spResp->attMin, *************** *** 1021,1025 **** // Read in the response tags //========================== ! int responseStart = data.FindTag( "response" ); while ( responseStart != -1 ) { --- 1032,1036 ---- // Read in the response tags //========================== ! int responseStart = data.FindTag( "say" ); while ( responseStart != -1 ) { *************** *** 1027,1033 **** csString* newResponse = new csString; ! tag.GetTagParm( "say", *newResponse); responseSet.responses.Push( newResponse ); ! responseStart = data.FindTag("response", responseStart+1 ); } --- 1038,1067 ---- csString* newResponse = new csString; ! tag.GetTagParm( "value", *newResponse); responseSet.responses.Push( newResponse ); ! responseStart = data.FindTag("say", responseStart+1 ); ! } ! ! int scriptStart = data.FindTag("script"); ! responseSet.script=""; ! if (scriptStart!=-1) ! { ! psXMLString tag; ! data.GetWithinTagSection(scriptStart, "script", tag); ! // remove \n and \r chars from the string ! for (int i=0;i<tag.Length();i++) ! if (tag.GetAt(i)!='\r'&&tag.GetAt(i)!='\n') ! responseSet.script+=tag.GetAt(i); ! } ! ! int pronounStart = data.FindTag("pronoun"); ! ! if (pronounStart!=-1) ! { ! psXMLTag tag( data, pronounStart ); ! tag.GetTagParm( "him" , responseSet.pronoun_him); ! tag.GetTagParm( "her" , responseSet.pronoun_her); ! tag.GetTagParm( "it" , responseSet.pronoun_it); ! tag.GetTagParm( "them", responseSet.pronoun_them); } Index: adminmessage.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/common/admin/adminmessage.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** adminmessage.h 18 Apr 2004 18:22:09 -0000 1.13 --- adminmessage.h 10 May 2004 16:17:02 -0000 1.14 *************** *** 347,350 **** --- 347,351 ---- class psAttitudeBlock; class psSpecialResponse; + class psResponse; PS_TYPEDEF_GROWING_ARRAY( triggerBlockList, psTriggerBlock* ); *************** *** 395,405 **** idList responseIDs; ! int playerID; ! csString playerName; bool WriteToDatabase(); int InsertResponse( csString& response ); ! int InsertResponseSet( stringList responseSet ); int InsertTrigger( const char* trigger, const char* area, int maxAttitude, int minAttitude, int responseID, int priorID ); --- 396,405 ---- idList responseIDs; ! csString area; bool WriteToDatabase(); int InsertResponse( csString& response ); ! int InsertResponseSet( psResponse &response ); int InsertTrigger( const char* trigger, const char* area, int maxAttitude, int minAttitude, int responseID, int priorID ); *************** *** 497,500 **** --- 497,506 ---- stringList responses; + csString script; + csString pronoun_him, + pronoun_her, + pronoun_it, + pronoun_them; + //! The internal ID given by the dialog manager. int givenID; |