03.10.2012, 17:15
Как можно оптимизировать данныe public`i
Код:
public LoadProperty() { new arrCoords[47][64]; new strFromFile2[256]; new File: file = fopen("house/property.cfg", io_read); if (file) { new idx; while (idx < sizeof(HouseInfo)) { fread(file, strFromFile2); split(strFromFile2, arrCoords, ','); HouseInfo[idx][hEntrancex] = floatstr(arrCoords[0]); HouseInfo[idx][hEntrancey] = floatstr(arrCoords[1]); HouseInfo[idx][hEntrancez] = floatstr(arrCoords[2]); HouseInfo[idx][hExitx] = floatstr(arrCoords[3]); HouseInfo[idx][hExity] = floatstr(arrCoords[4]); HouseInfo[idx][hExitz] = floatstr(arrCoords[5]); HouseInfo[idx][hHealthx] = strval(arrCoords[6]); HouseInfo[idx][hHealthy] = strval(arrCoords[7]); HouseInfo[idx][hHealthz] = strval(arrCoords[8]); HouseInfo[idx][hArmourx] = strval(arrCoords[9]); HouseInfo[idx][hArmoury] = strval(arrCoords[10]); HouseInfo[idx][hArmourz] = strval(arrCoords[11]); //printf("HouseInfo hEntrancez %f",HouseInfo[idx][hEntrancez]); strmid(HouseInfo[idx][hOwner], arrCoords[12], 0, strlen(arrCoords[12]), 255); strmid(HouseInfo[idx][hDiscription], arrCoords[13], 0, strlen(arrCoords[13]), 255); HouseInfo[idx][hValue] = strval(arrCoords[14]); HouseInfo[idx][hHel] = strval(arrCoords[15]); HouseInfo[idx][hArm] = strval(arrCoords[16]); HouseInfo[idx][hInt] = strval(arrCoords[17]); HouseInfo[idx][hLock] = strval(arrCoords[18]); HouseInfo[idx][hOwned] = strval(arrCoords[19]); HouseInfo[idx][hRooms] = strval(arrCoords[20]); HouseInfo[idx][hRent] = strval(arrCoords[21]); HouseInfo[idx][hRentabil] = strval(arrCoords[22]); HouseInfo[idx][hTakings] = strval(arrCoords[23]); HouseInfo[idx][hVec] = strval(arrCoords[24]); if(HouseInfo[idx][hVec] == 457) { HouseInfo[idx][hVec] = 411; } HouseInfo[idx][hVcol1] = strval(arrCoords[25]); HouseInfo[idx][hVcol2] = strval(arrCoords[26]); HouseInfo[idx][hDate] = strval(arrCoords[27]); HouseInfo[idx][hLevel] = strval(arrCoords[28]); HouseInfo[idx][hWorld] = strval(arrCoords[29]); HouseInfo[idx][hPjob] = strval(arrCoords[30]); HouseInfo[idx][hWheel] = strval(arrCoords[31]); HouseInfo[idx][hSpoiler] = strval(arrCoords[32]); HouseInfo[idx][hHood] = strval(arrCoords[33]); HouseInfo[idx][hRoof] = strval(arrCoords[34]); HouseInfo[idx][hSideskirt] = strval(arrCoords[35]); HouseInfo[idx][hLamps] = strval(arrCoords[36]); HouseInfo[idx][hNitro] = strval(arrCoords[37]); HouseInfo[idx][hExhaust] = strval(arrCoords[38]); HouseInfo[idx][hStereo] = strval(arrCoords[39]); HouseInfo[idx][hHydraulics] = strval(arrCoords[40]); HouseInfo[idx][hFrontbumper] = strval(arrCoords[41]); HouseInfo[idx][hRearbumper] = strval(arrCoords[42]); HouseInfo[idx][hVentright] = strval(arrCoords[43]); HouseInfo[idx][hVentleft] = strval(arrCoords[44]); HouseInfo[idx][hNeonleft] = strval(arrCoords[45]); HouseInfo[idx][hNeonright] = strval(arrCoords[46]); printf("Информация о доме:%d Владелец:%s",idx,HouseInfo[idx][hOwner]); idx++; } fclose(file); } return true; }
Код:
public LoadFlats() { new arrCoords[17][64]; new strFromFile2[256]; new File: file = fopen("house/flats.cfg", io_read); if (file) { new idx; while (idx < sizeof(FlatsInfo)) { fread(file, strFromFile2); split(strFromFile2, arrCoords, ','); FlatsInfo[idx][fOwned] = strval(arrCoords[0]); strmid(FlatsInfo[idx][fOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255); FlatsInfo[idx][fEntrancex] = floatstr(arrCoords[2]); FlatsInfo[idx][fEntrancey] = floatstr(arrCoords[3]); FlatsInfo[idx][fEntrancez] = floatstr(arrCoords[4]); FlatsInfo[idx][fExitx] = floatstr(arrCoords[5]); FlatsInfo[idx][fExity] = floatstr(arrCoords[6]); FlatsInfo[idx][fExitz] = floatstr(arrCoords[7]); FlatsInfo[idx][fInt] = strval(arrCoords[8]); FlatsInfo[idx][fVirtWorld] = strval(arrCoords[9]); FlatsInfo[idx][fValue] = strval(arrCoords[10]); FlatsInfo[idx][fLock] = strval(arrCoords[11]); FlatsInfo[idx][fRent] = strval(arrCoords[12]); FlatsInfo[idx][fRentabil] = strval(arrCoords[13]); FlatsInfo[idx][fTakings] = strval(arrCoords[14]); FlatsInfo[idx][fDate] = strval(arrCoords[15]); FlatsInfo[idx][fLevel] = strval(arrCoords[16]); printf("Квартира: [%d] | Владелец: [%s]",idx,FlatsInfo[idx][fOwner]); idx++; } fclose(file); } return true; }
Код:
public LoadBizz() { new arrCoords[24][64]; new strFromFile2[256]; new File: file = fopen("logs/bizz.cfg", io_read); if (file) { new idx; while (idx < sizeof(BizzInfo)) { fread(file, strFromFile2); split(strFromFile2, arrCoords, '|'); BizzInfo[idx][bOwned] = strval(arrCoords[0]); strmid(BizzInfo[idx][bOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255); strmid(BizzInfo[idx][bMessage], arrCoords[2], 0, strlen(arrCoords[2]), 255); strmid(BizzInfo[idx][bExtortion], arrCoords[3], 0, strlen(arrCoords[3]), 255); BizzInfo[idx][bEntranceX] = floatstr(arrCoords[4]); BizzInfo[idx][bEntranceY] = floatstr(arrCoords[5]); BizzInfo[idx][bEntranceZ] = floatstr(arrCoords[6]); BizzInfo[idx][bExitX] = floatstr(arrCoords[7]); BizzInfo[idx][bExitY] = floatstr(arrCoords[8]); BizzInfo[idx][bExitZ] = floatstr(arrCoords[9]); BizzInfo[idx][bBuyPrice] = strval(arrCoords[10]); BizzInfo[idx][bEntranceCost] = strval(arrCoords[11]); BizzInfo[idx][b2Till] = strval(arrCoords[12]); BizzInfo[idx][bLocked] = strval(arrCoords[13]); BizzInfo[idx][bInterior] = strval(arrCoords[14]); BizzInfo[idx][bProducts] = strval(arrCoords[15]); BizzInfo[idx][bMaxProducts] = strval(arrCoords[16]); BizzInfo[idx][bPriceProd] = strval(arrCoords[17]); BizzInfo[idx][b2Till] = strval(arrCoords[18]); BizzInfo[idx][bCena] = strval(arrCoords[19]); BizzInfo[idx][bBarX] = floatstr(arrCoords[20]); BizzInfo[idx][bBarY] = floatstr(arrCoords[21]); BizzInfo[idx][bBarZ] = floatstr(arrCoords[22]); BizzInfo[idx][bMafia] = strval(arrCoords[23]); //BizzInfo[idx][bWorld] = strval(arrCoords[19]); idx++; } fclose(file); } return true; }