So you are trying to find out the class of an object just by the object id? Why not just take my advice and do this at one point in your program:
tnpc npc[100];
int id = dbPickObject(...);
if(id > 499 && id < 600)
// Object belongs to tnpc class.
npc[id - 500].Function();
if(id > 599 && id < 700)
// Object belongs to some other class.
Is that what you want? If you are asking me if dbPickObject() can return the name of class object that has an object id stored in it, well, it can't. But there are workarounds like above. You can also have an inline function inside your class that checks if dbPickObject() returns the object's id that is stored in the class. For example:
class tnpc {
public:
int sprite_number;
tnpc() {
static int next_sprite_number = 499; //FYI: Will not be initialized again to 499
next_sprite_number++; //Increment it by 1
sprite_number = next_sprite_number;
}
bool Check_dbPickObject() {
if(dbPickObject(...) == sprite_number)
return true;
return false;
}
};
tnpc obj;
if(obj.Check_dbPickObject())
// Mouse is over obj. Carry out necessary stuff here.
Those are just some ways. I'm sure there are plenty more.
#ifdef _DEBUG
FixBugs(All);
#endif