PDA

View Full Version : Passing Defined things



ImpactDNI
05-06-2003, 10:08 AM
Sorry, this is all C++ i know, but for some reason i couldn't find it in MSDN library... anyway, i have an array of models, "models[7]"... and each # is a diferent model... yah, anyway, i made some defines... "#define MODEL_CUBE 0" etc.
now, when i want to pass the # of the model to load, loadfunction(MODEL_CUBE); it wont take it... it says it cant convert it to a different type... the defines are just so i dont have to remember the numbers.... (like that cube = 0, and torus = 1...) how do i pass something like that, so that in the function i just get a number?

starman
05-06-2003, 10:56 AM
What compiler error(s) are you getting? Just declare your function to accept an int parameter:

void loadFunction(int model_num)
{
// do something with models[model_num]
}

int main()
{
loadFunction(MODEL_CUBE);
}

ImpactDNI
05-06-2003, 11:22 AM
i found a way around it =P (ripped someone elses code for help =P)... but it was giving me like a cannot convert *int to *char [2].... which is odd..