Jfirewall Publicado 4 de Abril del 2018 Reportar Compartir Publicado 4 de Abril del 2018 Hola, andaba creando funciones y me daba pereza agregar siempre en el quest_fuctions entonces decidí quitarlo desde mi qc Primero vamos a qc.cc y buscamos: enum parse_state dentro de esto eliminamos esto ST_FUNCTION_NAME, luego buscamos y eliminamos esto : int none_c_function(lua_State* L) { return 0; } set<string> function_defs; set<string> function_calls; void RegisterDefFunction(const string& fname) { function_defs.insert(fname); } void RegisterUsedFunction(const string& fname) { function_calls.insert(fname); } void CheckUsedFunction() { bool hasError = false; set<string> error_func; for (typeof(function_calls.begin()) it = function_calls.begin(); it != function_calls.end(); ++it) { if (function_defs.find(*it) == function_defs.end()) { hasError = true; error_func.insert(*it); } cout << "Used : " << *it << endl; } if (hasError) { cout << "Calls undeclared function! : " << endl; for (typeof(error_func.begin()) it = error_func.begin(); it != error_func.end(); ++it) { cout << *it << endl; } abort(); } } void load_quest_function_list(const char* filename) { ifstream inf(filename); string s; while (!inf.eof()) { inf >> s; if (inf.fail()) break; RegisterDefFunction(s); } } luego buscamos esto y lo eliminamos: load_quest_function_list("quest_functions"); luego buscamos esto y lo eliminamos: else if (t.token == TK_FUNCTION) { ps = ST_FUNCTION_NAME; luego buscamos esto y lo eliminamos OJO EXISTEN DOS ELIMINAR LOS DOS: if (!callname.empty()) { lookahead(&lexstate); if (lexstate.lookahead.token == '(') { RegisterUsedFunction(callname); registered = true; } callname.clear(); } else if (lexstate.t.token == '(') { if (!registered && prev.t.token == TK_NAME) RegisterUsedFunction(getstr(prev.t.seminfo.ts)); registered = false; } luego buscamos esto y lo eliminamos: case ST_FUNCTION_NAME: if (t.token == TK_NAME) { current_function_name = getstr(t.seminfo.ts); RegisterDefFunction(quest_name+"."+current_function_name); ps = ST_FUNCTION_ARG; } break; luego buscamos esto y lo eliminamos: CheckUsedFunction(); Compilamos nuestro qc, y listo ya no tendran que declarar mas funciones nuevas en el quest_fuctions Citar Enlace para comentar Compartir en otros sitios Mas opciones de compartir...
KnightFall Publicado 4 de Abril del 2018 Reportar Compartir Publicado 4 de Abril del 2018 que sepa las funciones pueden estar dentro de la misma quest que implementes, pero por arranque de sistema para compilar si no equivoco siempre debe agregarse si no no te compila por la función faltante Citar Enlace para comentar Compartir en otros sitios Mas opciones de compartir...
Jfirewall Publicado 4 de Abril del 2018 Author Reportar Compartir Publicado 4 de Abril del 2018 hace 20 minutos, KnightFall dijo: que sepa las funciones pueden estar dentro de la misma quest que implementes, pero por arranque de sistema para compilar si no equivoco siempre debe agregarse si no no te compila por la función faltante tu puedes crear tus funciones dentro de una misma quest la funcionalidad de esto es para esto por ejm, tu creas una nueva funcion en tu source ejm questlua_pc int pc_zone(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); ch->ChatPacket(CHAT_TYPE_INFO, "hola zone"); } quet zone begin state start begin when login begin pc.zone() end end end cuando tu compilas te generaria un error el cual seria que debes declarar esta funcion pc.zone, lo que hace lo que publico es quitar que te genere el error y solo compiles y ya, aclaro esto es para los que nos da pereza cada rato estar agregando y agregando funciones Citar Enlace para comentar Compartir en otros sitios Mas opciones de compartir...
Shang Publicado 4 de Abril del 2018 Reportar Compartir Publicado 4 de Abril del 2018 hace 9 horas, Jfirewall dijo: Hola, andaba creando funciones y me daba pereza agregar siempre en el quest_fuctions entonces decidí quitarlo desde mi qc Primero vamos a qc.cc y buscamos: enum parse_state dentro de esto eliminamos esto ST_FUNCTION_NAME, luego buscamos y eliminamos esto : int none_c_function(lua_State* L) { return 0; } set<string> function_defs; set<string> function_calls; void RegisterDefFunction(const string& fname) { function_defs.insert(fname); } void RegisterUsedFunction(const string& fname) { function_calls.insert(fname); } void CheckUsedFunction() { bool hasError = false; set<string> error_func; for (typeof(function_calls.begin()) it = function_calls.begin(); it != function_calls.end(); ++it) { if (function_defs.find(*it) == function_defs.end()) { hasError = true; error_func.insert(*it); } cout << "Used : " << *it << endl; } if (hasError) { cout << "Calls undeclared function! : " << endl; for (typeof(error_func.begin()) it = error_func.begin(); it != error_func.end(); ++it) { cout << *it << endl; } abort(); } } void load_quest_function_list(const char* filename) { ifstream inf(filename); string s; while (!inf.eof()) { inf >> s; if (inf.fail()) break; RegisterDefFunction(s); } } luego buscamos esto y lo eliminamos: load_quest_function_list("quest_functions"); luego buscamos esto y lo eliminamos: else if (t.token == TK_FUNCTION) { ps = ST_FUNCTION_NAME; luego buscamos esto y lo eliminamos OJO EXISTEN DOS ELIMINAR LOS DOS: if (!callname.empty()) { lookahead(&lexstate); if (lexstate.lookahead.token == '(') { RegisterUsedFunction(callname); registered = true; } callname.clear(); } else if (lexstate.t.token == '(') { if (!registered && prev.t.token == TK_NAME) RegisterUsedFunction(getstr(prev.t.seminfo.ts)); registered = false; } luego buscamos esto y lo eliminamos: case ST_FUNCTION_NAME: if (t.token == TK_NAME) { current_function_name = getstr(t.seminfo.ts); RegisterDefFunction(quest_name+"."+current_function_name); ps = ST_FUNCTION_ARG; } break; luego buscamos esto y lo eliminamos: CheckUsedFunction(); Compilamos nuestro qc, y listo ya no tendran que declarar mas funciones nuevas en el quest_fuctions #define DISABLE_QUEST_FUNCTIONS #ifndef DISABLE_QUEST_FUNCTIONS CheckUsedFunction(); #endif Qué mierda? Jfirewall reacciono a esto 1 Citar Enlace para comentar Compartir en otros sitios Mas opciones de compartir...
PACI Publicado 4 de Abril del 2018 Reportar Compartir Publicado 4 de Abril del 2018 No tienes pq agregar las funciones al quest_functions. El qc te avisa que hay funciones que no existen en ese archivo, la quest se compila igual. Jfirewall reacciono a esto 1 Citar Enlace para comentar Compartir en otros sitios Mas opciones de compartir...
Mensajes recomendados
Unirse a la conversación
Puedes publicar ahora y registrarte más tarde. Si tienes una cuenta, regístrate para publicar con su cuenta.