////////////////////////////////////////////////// // rts_pathing //================================================ // By Deva Bryson Winblood // 12/08/2003 ////////////////////////////////////////////////// #include "rts_wp_header" /////////////////////// // PROTOTYPES /////////////////////// // FILE: rts_pathing // oCurrent = Current Area // oDest = Object trying to reach // sDestID = UNC, UND, DWF, SPID // nOpt = 0 = Path choosing preferably the same area type as current // 1 = Path choosing preferably underground ways // 2 = Path choosing preferably aboveground ways // 3 = Path choosing below ground during day, above ground at night // 4 = Below ground a MUST! Also seek below ground shelter object fnReversePath(object oCurrent,object oDest,string sDestID,int nOpt=0); ///////////////////////////////////////////////////////// // SUPPORT FUNCTIONS ///////////////////////////////////////////////////////// void fnPathingError(string sMsg) { // PATHING ERROR object oPC=GetFirstPC(); while(oPC!=OBJECT_INVALID) { // pathing error SendMessageToPC(oPC,"ERROR-ERROR-:"+sMsg); oPC=GetNextPC(); } // pathing error PrintString("ERROR-ERROR-:"+sMsg); } // fnPathingError() object fnRandomTrans(object oArea) { // return a random transition door or trigger object oRet=OBJECT_INVALID; int nC=GetLocalInt(oArea,"nPathingTC"); if (nC<1) { fnBuildTransRand(oArea); return OBJECT_INVALID; } else { nC=Random(nC)+1; oRet=GetLocalObject(oArea,"oPathingTrans"+IntToString(nC)); } return oRet; } // fnRandomTrans() object fnRandomObjects(object oArea) { // return an object in this area object oRet=OBJECT_INVALID; int nC=GetLocalInt(oArea,"nPathingOC"); if (nC<1) { fnBuildObjectRand(oArea); return OBJECT_INVALID; } else { nC=Random(nC)+1; oRet=GetLocalObject(oArea,"oPathingObs"+IntToString(nC)); } return oRet; } // fnRandomObjects() string fnParse(string sSource,string sDelim=".") { // parse string sRet=""; string sMaster=sSource; while(GetStringLeft(sMaster,1)!=sDelim&&GetStringLength(sMaster)>0) { // parse sRet=sRet+GetStringLeft(sMaster,1); sMaster=GetStringRight(sMaster,GetStringLength(sMaster)-1); } // parse return sRet; } // fnParse() string fnRemoveParsed(string sSource,string sParsed,string sDelim=".") { // remove the portion parsed from the original string string sRet=""; if (GetStringLength(sSource)