void CreateReloadPaths(string groupID) { if(CheckAttribute(&objFastReloadTable,"Paths.table") && objFastReloadTable.Paths.table == groupID) return; DeleteAttribute(&objFastReloadTable,"Paths"); objFastReloadTable.Paths.table = groupID; objFastReloadTable.Paths.shipLocation = Characters[GetMainCharacterIndex()].location.from_sea; aref tbl; makearef(tbl,objFastReloadTable.Paths.table); int i,j,n; string outLocName,goLocName; aref reloadList,curReload; // запишем все переходы в локациях используемой группы for(i=0; i=MAX_LOCATIONS || finishLocName=="") return; string checkLocation, nextLocName, reloadName; checkLocation = Locations[startLocIdx].id; if(checkLocation==finishLocName) { Log_SetStringToLog(XI_ConvertString("You are already there")); return; } while(checkLocation!=finishLocName) { if( CheckQuestPresents(checkLocation) ) {break;} if( GetNextLocationForPath(checkLocation, finishLocName, &nextLocName, &reloadName) ) { if(nextLocName=="") {break;} checkLocation = nextLocName; break; } if(checkLocation == nextLocName) break; checkLocation = nextLocName; } if(checkLocation!=Locations[startLocIdx].id) { reloadName = GetFastReloadName(Locations[startLocIdx].id,checkLocation); if(reloadName=="") { Log_SetStringToLog(XI_ConvertString("There is no way there now")); return; } else { DoReloadCharacterToLocation(checkLocation,"reload",reloadName); } } if(checkLocation!=finishLocName) { if(checkLocation==Locations[startLocIdx].id) Log_SetStringToLog(XI_ConvertString("You can't leave this location now")); else Log_SetStringToLog(XI_ConvertString("Your walk was interrupted")); Log_SetStringToLog(XI_ConvertString("Looks like something is going to happen here")); } } int GetLocationNation(aref arLocation) { if( CheckAttribute(arLocation,"ItsNation") ) return sti(arLocation.ItsNation); if( CheckAttribute(arLocation,"fastreload") ) { string islName,locName; if( GetFortReloadFromTable(arLocation.fastreload, &islName, &locName) ) { int chidx = Fort_FindCharacter(islName,"reload",locName); if(chidx>=0) { ref chref = GetCharacter(chidx); return sti(chref.nation); } } } return -1; } bool GetFortReloadFromTable(string tblName, ref refIslName, ref refLocName) { switch (tblName) { case "Conceicao": refIslName="Conceicao"; refLocName="reload_fort1"; return true; break; case "Douwesen": refIslName="Douwesen"; refLocName="reload_fort1"; return true; break; case "Falaise_de_fleur": refIslName="FalaiseDeFleur"; refLocName="reload_fort1"; return true; break; case "Muelle": refIslName="IslaMuelle"; refLocName="reload_fort1"; return true; break; case "Oxbay": refIslName="Oxbay"; refLocName="reload_fort2"; return true; break; case "Greenford": refIslName="Oxbay"; refLocName="reload_fort1"; return true; break; /*case "QC": refIslName=""; refLocName=""; return true; break;*/ case "Redmond": refIslName="Redmond"; refLocName="reload_fort1"; return true; break; } refIslName = ""; refLocName = ""; return false; } void SetTownCapturedState(string townName, bool captured) { aref arTown,arTownsList; makearef(arTownsList,objTownStateTable.towns); int i,q; q = GetAttributesNum(arTownsList); for(i=0; i=q) return; aref arData; if(!CheckAttribute(arTown,"crew.data")) return; makearef(arData,arTown.crew.data); int nYear = 1; int nMonth = 1; int nDay = 1; if( CheckAttribute(arData,"year") ) nYear = sti(arData.year); if( CheckAttribute(arData,"month") ) nMonth = sti(arData.month); if( CheckAttribute(arData,"day") ) nDay = sti(arData.day); int pastDays = GetPastTime( "day", nYear,nMonth,nDay,0.0, GetDataYear(),GetDataMonth(),GetDataDay(),0.0 ); if(pastDays<10) return; arData.year = GetDataYear(); arData.month = GetDataMonth(); arData.day = GetDataDay(); int nPastQ = 0; int nPastM = MORALE_NORMAL; if(CheckAttribute(arTown,"crew.quantity")) nPastQ = sti(arTown.crew.quantity); if(CheckAttribute(arTown,"crew.morale")) nPastM = sti(arTown.crew.morale); int nNeedCrew = 0; int cn; for(i=0; i<4; i++) { cn = GetCompanionIndex(GetMainCharacter(),i); if(cn>=0) { nNeedCrew += GetMaxCrewQuantity(GetCharacter(cn)); } } if(nPastQ>nNeedCrew) { nPastM = MORALE_NORMAL + rand(MORALE_MAX-MORALE_NORMAL); nPastQ = nNeedCrew + rand(nNeedCrew); } else { nPastM = MORALE_NORMAL/3 + rand(MORALE_NORMAL/3*2); nPastQ = nNeedCrew/2 + rand(nNeedCrew); } arTown.crew.quantity = nPastQ; arTown.crew.morale = nPastM; } void RecalculateJumpTable() { string outGroupName = ""; if( CheckAttribute(&objFastReloadTable,"Paths.table") ) outGroupName = objFastReloadTable.Paths.table; objFastReloadTable.Paths.table = ""; CreateReloadPaths(outGroupName); } bool CheckFastJump(string sFromLocation, string sToLocation) { if(sFromLocation==sToLocation) return false; string curLocName, nextLocName, reloadName; bool bNoBreak = true; curLocName = sFromLocation; while(bNoBreak && curLocName!=sToLocation) { bNoBreak = !GetNextLocationForPath(curLocName, sToLocation, &nextLocName, &reloadName); if(nextLocName=="" || reloadName=="") {return false;} if( !IsEnableLocToLocReload(curLocName,nextLocName,reloadName) ) {return false;} curLocName = nextLocName; } return true; } bool IsEnableLocToLocReload(string sFromLocName, string sToLocName, string locatorName) { aref tbl; makearef(tbl,objFastReloadTable.Paths.table); if( !CheckAttribute(tbl,sFromLocName) ) return false; return chrCheckReload( &Locations[sti(tbl.(sFromLocName))], locatorName ); /* int n, q, nFromIdx; aref arRootReload, arReload; nFromIdx = sti(tbl.(sFromLocName)); makearef(arRootReload, Locations[nFromIdx].reload); q = GetAttributesNum(arRootReload); for(n=0; n0 ) {return false;} return true; } } return false;*/ }