Phones that are not associated with the player data
#1

Hello, I thought of a phone system: player can have as many phones as he wants. Player can put the phone in his house, garage or in any vehicle. The thing is, even if he's not carrying it, the phone stays active(kind of).

Table design(maybe it will help to understand what am I trying to achieve)
Code:
CREATE TABLE IF NOT EXISTS phones (
	number INT NOT NULL,
	online TINYINT NOT NULL DEFAULT '1',
	added_on DATETIME NOT NULL,
	location_type TINYINT NOT NULL,
	location_id INT NOT NULL,
	PRIMARY KEY(number),
	INDEX(location_type),
	INDEX(location_id)
) ENGINE=INNODB DEAFULT CHARSET=cp1257 COLLATE=cp1257_bin;
The question

How to keep in memory? One large array for ALL phone data? Or at loading time I should load them into separate arrays for people, garages, vehicles and houses?

The first approach seems more elegant as I will be able to maintain all their data in one place.

The second obviously will be faster, no need to loop through the large array to find that phone.
Reply


Messages In This Thread
Phones that are not associated with the player data - by dusk - 24.04.2015, 12:48
Re: Phones that are not associated with the player data - by spell - 24.04.2015, 13:18
Re: Phones that are not associated with the player data - by dusk - 24.04.2015, 13:48
Re: Phones that are not associated with the player data - by spell - 24.04.2015, 14:03

Forum Jump:


Users browsing this thread: 1 Guest(s)