Connecting two enums together
#1

Hello.
Code:
enum apartments {
	apID,
	apType,
	apName[64],
	apOwner,
	apOwnerName[MAX_PLAYER_NAME],
	apTill,
	Float:apX,
	Float:apY,
	Float:apZ,
	Float:apExitX,
	Float:apExitY,
	Float:apExitZ,
};
new apInfo[MAX_APARTMENTS][apartments];

enum apartmentroom {
	apID, // How do I make this apID connected to the apID in the other enum?
	aprOwner,
	aprOwnerName[MAX_PLAYER_NAME],
	aprCost,
	aprRentFee,
	aprLocked,
	Float:aprX,
	Float:aprZ,
	Float:aprZ,
};
My question is, how do I make 'apID' in the second enum connected to the one in the first enum?
Reply
#2

Probably some kind of loop like
PHP Code:
for(new ii<MAX_APARTMENTSi++) thevaryouhaveforthesecondenum[i][apID] = apInfo[i][apID]; 
Reply
#3

The only way to effectivelly do this would be to use apID as the index.

Other way would be to set apID to the id on each array at the same time, and letting each enum have a cache variable to hold the array position of the same apID on the other one and avoid having to loop in order to find each other.

I'm afraid Arrays aren't really made to be related to elements outside of themselves, not without some bodging at least, which will usually come in the shape of caching related indexes or search loops as mentioned.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)