engine_gettaskinfo problem

Posted By: Talemon

engine_gettaskinfo problem - 09/16/14 12:55

Hello, I need a quick help from you. I'm trying to track down a bug, which crashes the game ONLY on Win8+ machines. I've tracked until a wait(1) statement and I'm trying to use engine_gettaskinfo to list what function will get called next but on this occasion, its output is a bit strange.

One of the function names is either (null) or some garbled data 4-5 characters long. When this happens, the list is printed twice as if the control variable is reset. And if it's not "(null)", it crashes the program.

Is there a length limit on function names for the engine(A8)? What can cause such an issue with an engine function?

I'm using this code to print out the function names:

Code:
char* l_tmp = sys_malloc(sizeof(char) * 100);
ENTITY* l_me = NULL;
var i = 0;
diag("\nRUNNING FUNCTIONS");
while(engine_gettaskinfo(i, &l_tmp, &l_me) != NULL)
{
	diag("\n");
	diag(l_tmp);
	i++;
}
sys_free(l_tmp);

Posted By: Ch40zzC0d3r

Re: engine_gettaskinfo problem - 09/16/14 16:40

Diag takes a string parameter so use
Code:
diag(_str(l_tmp));



Also why not just do
Code:
char l_tmp[100];


Much shorter if you dont need the data outside of the stack tongue
Posted By: Talemon

Re: engine_gettaskinfo problem - 09/17/14 08:06

Thanks, I'll try that.
Because then you have to write something like this:
diag(&(l_tmp[0]));
Posted By: FBL

Re: engine_gettaskinfo problem - 09/17/14 14:43

&l_tmp[0] is the same as l_tmp
© 2024 lite-C Forums