void LoadDatabase(QueryResult * pResult) { pResult = SD2Database.PQuery( "SELECT flag, data0, data1, CatId, C.name, destid " "FROM sd2p_npc_tele_category C, sd2p_npc_tele_association A " "WHERE C.id = CatId ORDER BY C.name, CatId"); VCategorie.clear(); if (pResult) { outstring_log("SD2P: Chargement \"sd2p_npc_tele_category\" et \"sd2p_npc_tele_association\"..."); barGoLink Bar(pResult->GetRowCount()); uint32 CatId = 0; uint32 NbDest = 0; bool IsValidCat = true; bool FirstTime = true; do { Bar.step(); Field * pFields = pResult->Fetch(); if (!GetDestination(pFields[5].GetUInt32())) { outstring_log("SD2P >> Destination introuvable (DestID: %u).", pFields[5].GetUInt32()); continue; } if (!IsValidCat && CatId == pFields[3].GetUInt32() && !FirstTime) continue; IsValidCat = true; FirstTime = false; if (!IsValidData(pFields[3].GetUInt32(), (Flag_t)pFields[0].GetUInt8(), pFields[1].GetUInt64(), pFields[2].GetUInt32())) { IsValidCat = false; CatId = pFields[3].GetUInt32(); continue; } if (CatId != pFields[3].GetUInt32()) { CatId = pFields[3].GetUInt32(); Categorie Cat (CatId, pFields[4].GetCppString(), (Flag_t)pFields[0].GetUInt8(), pFields[1].GetUInt64(), pFields[2].GetUInt32()); VCategorie.push_back(Cat); } VCategorie.back().AddDest(pFields[5].GetUInt32()); ++NbDest; } while (pResult->NextRow()); delete pResult; outstring_log(""); outstring_log(">> %u npc_teleport charge(s).", NbDest); } else outstring_log("WARNING >> 0 npc_teleport charge."); }
void LoadDatabase(void) { // Verification integrite des donnees de la DB QueryResult * pResult = SD2Database.PQuery( " SELECT 0 NumRel, T.Entry Entry" " FROM sd2p_object_tele_relation0 T, sd2p_object_tele_definition D " " WHERE T.Entry = D.Entry " " AND relation_id <> 0 " "UNION " " SELECT 1 NumRel, T.Entry Entry" " FROM sd2p_object_tele_relation1 T, sd2p_object_tele_definition D " " WHERE T.Entry = D.Entry " " AND relation_id <> 1 " "ORDER BY NumRel, Entry"); if (pResult) { outstring_log("½Å±¾¿â£º ERREUR >> %u objects incorrectement configures...", pResult->GetRowCount()); do { Field * pFields = pResult->Fetch(); outstring_log("\tIdObject : %u (Relation invalide : %u)", pFields[0].GetUInt32(), pFields[1].GetUInt8()); } while (pResult->NextRow()); delete pResult; } // Recuperation des donnees de la DB pResult = SD2Database.PQuery( " SELECT relation_id, flag, Data0, Data1, T.Entry Entry, DestId " " FROM sd2p_object_tele_definition D, sd2p_object_tele_relation0 T " " WHERE D.Entry = T.Entry " " AND relation_id = 0 " "UNION " " SELECT relation_id, flag, Data0, Data1, T.Entry Entry, DestId " " FROM sd2p_object_tele_definition D, sd2p_object_tele_relation1 T " " WHERE D.Entry = T.Entry " " AND relation_id = 1 " "ORDER BY relation_id, Entry, flag, Data0 DESC "); MDefObject.clear(); if (pResult) { outstring_log( "SD2P: Chargement \"sd2p_object_tele_definition\" et \"sd2p_object_tele_relation0\"..."); barGoLink Bar(pResult->GetRowCount()); uint32 IdObject = 0; uint32 NbDest = 0; DefinitionObject * pLastDefIt; do { Bar.step(); Field * pFields = pResult->Fetch(); if (!GetDestination(pFields[5].GetUInt32())) { outstring_log("SD2P >> Destination introuvable (DestID: %u).", pFields[0].GetUInt32()); continue; } if (!IsValidData(pFields[4].GetUInt32(), (Relation)pFields[0].GetUInt8(), pFields[1].GetUInt32(), pFields[2].GetUInt64(), pFields[3].GetUInt32())) continue; if (IdObject != pFields[4].GetUInt32()) { IdObject = pFields[4].GetUInt32(); DefinitionObject DefIt(IdObject, (Relation)pFields[0].GetUInt8(), pFields[1].GetUInt8()); pLastDefIt = &MDefObject.insert(MDefObject_t::value_type(IdObject, DefIt)).first->second; } DestObjectTele Dest = { pFields[5].GetUInt32(), // DestId pFields[2].GetUInt64(), // Data0 pFields[3].GetUInt32(), // Data1 }; pLastDefIt->AddDest(Dest); ++NbDest; } while (pResult->NextRow()); delete pResult; outstring_log(""); outstring_log(">> %u object_teleport charge(s).", NbDest); } else outstring_log("ATTENTION >> 0 object_teleport charge."); }
bool XgnExtDataDlg::GetLineBE(Kline* pKline,int nKline,ARRAY_BE & lineOut,int nID,CReportData* pdt) { if(!IsValidData( nID)) return false; #ifdef Client_Xgn InOutHeadData head; FileExtendData fl; int nm = nID; fl.GetIndicatorInfo(head.m_info,nm); #endif //FileExtendData ext; //RecordIndicator* pData = NULL; //CString sSymbol = FormatStr(pdt); //int nDays = -1; //int n = ext.ReadData(pData, sSymbol, nID,nDays) ; //int m = 0 ; //float fPre = 0; //int nFirst = -1; //bool bDay = true; //IndicatorInfo data; //bool b = ext.GetIndicatorInfo( data, nID); //if(b == false) // return false; //if(data.m_nKlineKind != 5) // bDay = false; //for(int i = lineOut.b ;i<nKline;i++) //{ // int t1 = FileExtendData::RegularTime(pKline[i].day, bDay); // lineOut.line [i] = fPre; // for(;m<n;m++) // { // int t2 = FileExtendData::RegularTime(pData[m].m_time , bDay); // if(t2<t1) continue; // if(t2==t1) // { // if(nFirst == -1) // nFirst = i; // lineOut.line [i] = pData[m].m_fValue; // m++; // fPre = lineOut.line [i] ; // break; // } // break; // } // ; //} //if(nFirst != -1) // lineOut.b = nFirst; //else // return false; //if(pData) delete [] pData; return true; }