Enum Error: error 008: must be a constant expression; assumed zero
#5

Yes I understand that what you said on the skins, and I've fixed my issue with the way you suggested. I'll explain the last part some more trying to use an example, I'll use houses as my example.

Say you have a MySQL table called house. This table has a row for each house on your server. It contains the following values: HouseID, OwnerID. I know realistically there would be more data than that, but just for ease.

Anyways, so you create an Enum in your script called House. It would look like the following:

Код:
enum House{
	HouseID,
	OwnerID
}
Whilst in game, an admin can create a new house. Therefore the MySQL house table will always be getting new rows. There is no way to determine what CONSTANT NUMBER OF ROWS the House table would hold, as it can be added to any time.

So my questions is, if I wanted to pull from the database all of the houses, and then instantiate a new House enum for each one, how would I do this? I wouldn't be able to put something like "new Skin[MAX_HOUSES][House];" because I wouldn't be able to define exactly how many houses there is going to be, as this would be a dynamic value. Sometimes there might be 20 houses, othertimes there might be 35 houses, it could be any amount.

From my logic, I would need to get the row count from the MySQL after query execution and do something like "new Skin[sqlRowCount][House];", but that wouldn't work as sqlRowCount wouldn't be a constant value.

I hope that makes sense and you can understand what I'm asking from that.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)