PDA

Просмотр полной версии : [Вопрос] Вопрос по переводу Mysql 39 - 41



ALIT13
03.01.2019, 20:31
Добрый вечер ув. пользователи хотел узнать правильно ли я перевёл или нет с Mysql 39 - 41

39

OtelInfo[idx][oID] = cache_get_field_content_int(idx-1,"oID",connectsql);
OtelInfo[idx][oOwned] = cache_get_field_content_int(idx-1,"oOwned",connectsql);
cache_get_field_content(idx-1,"oOwner",OtelInfo[idx][oOwner],connectsql,32);
OtelInfo[idx][oX] = cache_get_field_content_float(idx-1,"oX",connectsql);
OtelInfo[idx][oY] = cache_get_field_content_float(idx-1,"oY",connectsql);
OtelInfo[idx][oZ] = cache_get_field_content_float(idx-1,"oZ",connectsql);
OtelInfo[idx][oExitX] = cache_get_field_content_float(idx-1,"oExitX",connectsql);
OtelInfo[idx][oExitY] = cache_get_field_content_float(idx-1,"oExitY",connectsql);
OtelInfo[idx][oExitZ] = cache_get_field_content_float(idx-1,"oExitZ",connectsql);
OtelInfo[idx][oExitC] = cache_get_field_content_float(idx-1,"oExitC",connectsql);
OtelInfo[idx][oBuyPrice] = cache_get_field_content_int(idx-1,"oBuyPrice",connectsql);
OtelInfo[idx][oRenda] = cache_get_field_content_int(idx-1,"oRenda",connectsql);
OtelInfo[idx][oPlata] = cache_get_field_content_int(idx-1,"oPlata",connectsql);
OtelInfo[idx][oEtag] = cache_get_field_content_int(idx-1,"oEtag",connectsql);

41

cache_get_value_name_int(idx,"oID", OtelInfo[idx][oID]);
cache_get_value_name_int(idx-1,"oOwned", OtelInfo[idx][oOwned]);
cache_get_value_name(idx-1,"oOwner",OtelInfo[idx][oOwner],32);
cache_get_value_name_float(idx-1,"oX",OtelInfo[idx][oX]);
cache_get_value_name_float(idx-1,"oY",OtelInfo[idx][oY]);
cache_get_value_name_float(idx-1,"oZ",OtelInfo[idx][oZ]);
cache_get_value_name_float(idx-1,"oExitX",OtelInfo[idx][oExitX]);
cache_get_value_name_float(idx-1,"oExitY",OtelInfo[idx][oExitY]);
cache_get_value_name_float(idx-1,"oExitZ",OtelInfo[idx][oExitZ]);
cache_get_value_name_float(idx-1,"oExitC",OtelInfo[idx][oExitC]);
cache_get_value_name_int(idx-1,"oBuyPrice",OtelInfo[idx][oBuyPrice]);
cache_get_value_name_int(idx-1,"oRenda",OtelInfo[idx][oRenda]);
cache_get_value_name_int(idx-1,"oPlata",OtelInfo[idx][oPlata]);
cache_get_value_name_int(idx-1,"oEtag",OtelInfo[idx][oEtag]);

39

cache_get_field_content(idx-1,"name",temp); strmid(name, temp, 0, strlen(temp), 32);
cache_get_field_content(idx-1,"lip",temp); strmid(ip, temp, 0, strlen(temp), 16);
cache_get_field_content(idx-1,"rip",temp); strmid(ip2, temp, 0, strlen(temp), 16);

41

cache_get_value_name(idx-1, "name",temp); strmid(name, temp, 0, strlen(temp), 32);
cache_get_value_name(idx-1, "lip",temp); strmid(ip, temp, 0, strlen(temp), 16);
cache_get_value_name(idx-1, "rip",temp); strmid(ip2, temp, 0, strlen(temp), 16);

m1n1vv
04.01.2019, 02:46
Не по теме. Зачем strmid?

strcat((ip[0] = EOS, ip), temp);

ALIT13
04.01.2019, 11:45
Я не знаю, я взял готовый мод и перевожу mysql

strcat((ip[0] = EOS, ip), temp);

pawnoholic
04.01.2019, 13:09
Я не знаю, я взял готовый мод и перевожу mysql

strcat((ip[0] = EOS, ip), temp);

Для удобства:

#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)

Использование:

strcpy(ip, temp);

ALIT13
04.01.2019, 13:50
Парни ну я вообще другой вопрос задал

ziggi
04.01.2019, 19:33
Для удобства:

#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)

Использование:

strcpy(ip, temp);

Этот макрос будет некорректно работать с 2+ мерными массивами. Да и вообще, не надо такие макросы юзать, лучше нормальную функцию написать.
stock strcpy(result[], const source[], const size = sizeof(result))
{
result[0] = 0;
return strcat(result, source, size);
}
А использование конструкций вида strcat((ip[0] = EOS, ip), temp); ничего не даёт, только усложняет читабельность кода.

ALIT13
04.01.2019, 20:24
Парни у меня вопросы был в другом правильно я перевёл мускл с 39 на 41?

DeimoS
13.01.2019, 06:37
По части работоспособоности - да (мог бы просто скопилировать код, запустить и проверить).
По части оптимизации - она хромает что в первоначальном варианте, что в законченном.