Impossible?
#1

Hey, well, here it is (array inside an array inside an array, or something like this).

Код:
enum HotelRooms
{
    Float:Pos[4],
    Floor
}

new HotelRoom[sizeof(Hotels)][][HotelRooms] =
{
    {
		{{2192.4495, -1814.8971, 13.5469, 0.0}, 0},
		{{2185.8474, -1814.8676, 13.5469, 0.0}, 0},
		{{2176.4341, -1814.9058, 13.5469, 0.0}, 0},
		{{2168.9521, -1814.8550, 13.5469, 0.0}, 0},
		{{2162.6604, -1814.9034, 13.5469, 0.0}, 0},
		{{2155.8359, -1814.8665, 13.5469, 0.0}, 0},
		{{2151.3428, -1815.1371, 13.5469, 270.0}, 0},
		{{2151.4187, -1807.9465, 13.5465, 270.0}, 0},
		{{2151.3711, -1789.0697, 13.5097, 270.0}, 0},
		{{2145.0974, -1802.1052, 16.1406, 180.0}, 0},
		{{2141.5112, -1802.0051, 16.1475, 270.0}, 0},
		{{2146.8064, -1808.4049, 16.1406, 270.0}, 0},
		{{2146.7305, -1815.0356, 16.1406, 270.0}, 0},
		{{2151.8972, -1819.3024, 16.1406, 0.0}, 0},
		{{2158.3147, -1819.5031, 16.1406, 0.0}, 0},
		{{2164.7566, -1819.1158, 16.1406, 0.0}, 0},
		{{2172.3660, -1819.3573, 16.1406, 0.0}, 0},
		{{2176.1350, -1821.7032, 16.1451, 90.0}, 0},
		{{2176.0784, -1828.3782, 16.1406, 90.0}, 0}
	},
	{
		{{2242.6187, -1159.8792, 1029.7969, 90.0}, 1},
		{{2239.8164, -1159.6061, 1029.7969, 270.0}, 1},
		{{2242.5227, -1170.7321, 1029.7969, 90.0}, 1},
		{{2239.8430, -1170.5103, 1029.7969, 270.0}, 1},
		{{2225.8137, -1189.9596, 1029.7969, 0.0}, 1},
		{{2225.5347, -1187.2761, 1029.7969, 180.0}, 1},
		{{2209.5046, -1190.0829, 1029.7969, 357.0}, 1},
		{{2209.5669, -1187.3671, 1029.7969, 180.0}, 1},
		{{2191.8999, -1173.0846, 1029.7969, 270.0}, 1},
		{{2194.5781, -1172.9945, 1029.7969, 90.0}, 1},
		{{2191.7917, -1156.9670, 1029.7969, 270.0}, 1},
		{{2194.5789, -1156.8497, 1029.7969, 90.0}, 1},
		{{2242.6187, -1159.8792, 1029.7969, 90.0}, 2},
		{{2239.8164, -1159.6061, 1029.7969, 270.0}, 2},
		{{2242.5227, -1170.7321, 1029.7969, 90.0}, 2},
		{{2239.8430, -1170.5103, 1029.7969, 270.0}, 2},
		{{2225.8137, -1189.9596, 1029.7969, 0.0}, 2},
		{{2225.5347, -1187.2761, 1029.7969, 180.0}, 2},
		{{2209.5046, -1190.0829, 1029.7969, 357.0}, 2},
		{{2209.5669, -1187.3671, 1029.7969, 180.0}, 2},
		{{2191.8999, -1173.0846, 1029.7969, 270.0}, 2},
		{{2194.5781, -1172.9945, 1029.7969, 90.0}, 2},
		{{2191.7917, -1156.9670, 1029.7969, 270.0}, 2},
		{{2194.5789, -1156.8497, 1029.7969, 90.0}, 2},
		{{2242.6187, -1159.8792, 1029.7969, 90.0}, 3},
		{{2239.8164, -1159.6061, 1029.7969, 270.0}, 3},
		{{2242.5227, -1170.7321, 1029.7969, 90.0}, 3},
		{{2239.8430, -1170.5103, 1029.7969, 270.0}, 3},
		{{2225.8137, -1189.9596, 1029.7969, 0.0}, 3},
		{{2225.5347, -1187.2761, 1029.7969, 180.0}, 3},
		{{2209.5046, -1190.0829, 1029.7969, 357.0}, 3},
		{{2209.5669, -1187.3671, 1029.7969, 180.0}, 3},
		{{2191.8999, -1173.0846, 1029.7969, 270.0}, 3},
		{{2194.5781, -1172.9945, 1029.7969, 90.0}, 3},
		{{2191.7917, -1156.9670, 1029.7969, 270.0}, 3},
		{{2194.5789, -1156.8497, 1029.7969, 90.0}, 3}
	},
	{
		{{2286.4241, -595.6748, 77.9894, 90.0},  1},
		{{2281.8203, -593.4830, 77.9894, 270.0},  1},
		{{2286.4414, -590.4153, 77.9894, 90.0},  1},
		{{2281.7788, -588.1367, 77.9894, 270.0},  1},
		{{2286.4041, -584.4052, 77.9894, 90.0},  1},
		{{2281.8127, -582.5616, 77.9894, 270.0},  1},
		{{2286.4155, -578.4544, 77.9894, 90.0},  1},
		{{2281.7593, -576.4732, 77.9894, 270.0},  1},
		{{2286.4004, -573.0441, 77.9894, 90.0},  1},
		{{2281.7808, -570.8545, 77.9894, 270.0},  1},
		{{2286.4241, -595.6748, 77.9894, 90.0},  2},
		{{2281.8203, -593.4830, 77.9894, 270.0},  2},
		{{2286.4414, -590.4153, 77.9894, 90.0},  2},
		{{2281.7788, -588.1367, 77.9894, 270.0},  2},
		{{2286.4041, -584.4052, 77.9894, 90.0},  2},
		{{2281.8127, -582.5616, 77.9894, 270.0},  2},
		{{2286.4155, -578.4544, 77.9894, 90.0},  2},
		{{2281.7593, -576.4732, 77.9894, 270.0},  2},
		{{2286.4004, -573.0441, 77.9894, 90.0},  2},
		{{2281.7808, -570.8545, 77.9894, 270.0},  2},
		{{2286.4241, -595.6748, 77.9894, 90.0},  3},
		{{2281.8203, -593.4830, 77.9894, 270.0},  3},
		{{2286.4414, -590.4153, 77.9894, 90.0},  3},
		{{2281.7788, -588.1367, 77.9894, 270.0},  3},
		{{2286.4041, -584.4052, 77.9894, 90.0},  3},
		{{2281.8127, -582.5616, 77.9894, 270.0},  3},
		{{2286.4155, -578.4544, 77.9894, 90.0},  3},
		{{2281.7593, -576.4732, 77.9894, 270.0},  3},
		{{2286.4004, -573.0441, 77.9894, 90.0},  3},
		{{2281.7808, -570.8545, 77.9894, 270.0},  3},
		{{2286.4241, -595.6748, 77.9894, 90.0},  4},
		{{2281.8203, -593.4830, 77.9894, 270.0},  4},
		{{2286.4414, -590.4153, 77.9894, 90.0},  4},
		{{2281.7788, -588.1367, 77.9894, 270.0},  4},
		{{2286.4041, -584.4052, 77.9894, 90.0},  4},
		{{2281.8127, -582.5616, 77.9894, 270.0},  4},
		{{2286.4155, -578.4544, 77.9894, 90.0},  4},
		{{2281.7593, -576.4732, 77.9894, 270.0},  4},
		{{2286.4004, -573.0441, 77.9894, 90.0},  4},
		{{2281.7808, -570.8545, 77.9894, 270.0},  4},
		{{2286.4241, -595.6748, 77.9894, 90.0},  5},
		{{2281.8203, -593.4830, 77.9894, 270.0},  5},
		{{2286.4414, -590.4153, 77.9894, 90.0},  5},
		{{2281.7788, -588.1367, 77.9894, 270.0},  5},
		{{2286.4041, -584.4052, 77.9894, 90.0},  5},
		{{2281.8127, -582.5616, 77.9894, 270.0},  5},
		{{2286.4155, -578.4544, 77.9894, 90.0},  5},
		{{2281.7593, -576.4732, 77.9894, 270.0},  5},
		{{2286.4004, -573.0441, 77.9894, 90.0},  5},
		{{2281.7808, -570.8545, 77.9894, 270.0},  5}
	},
	{
		{{2585.4756, -656.3309, 96.2272, 270.0}, 1},
		{{2585.4529, -646.4376, 96.2272, 270.0}, 1},
		{{2590.1147, -646.4531, 96.2272, 90.0}, 1},
		{{2590.1257, -656.2684, 96.2272, 90.0}, 1},
		{{2585.4587, -666.8497, 96.2272, 270.0}, 1},
		{{2585.4595, -675.4648, 96.2272, 270.0}, 1},
		{{2590.1238, -675.4837, 96.2272, 90.0}, 1},
		{{2590.1228, -666.9805, 96.2272, 90.0}, 1},
		{{2585.4756, -656.3309, 96.2272, 270.0}, 2},
		{{2585.4529, -646.4376, 96.2272, 270.0}, 2},
		{{2590.1147, -646.4531, 96.2272, 90.0}, 2},
		{{2590.1257, -656.2684, 96.2272, 90.0}, 2},
		{{2585.4587, -666.8497, 96.2272, 270.0}, 2},
		{{2585.4595, -675.4648, 96.2272, 270.0}, 2},
		{{2590.1238, -675.4837, 96.2272, 90.0}, 2},
		{{2590.1228, -666.9805, 96.2272, 90.0}, 2},
		{{2585.4756, -656.3309, 96.2272, 270.0}, 3},
		{{2585.4529, -646.4376, 96.2272, 270.0}, 3},
		{{2590.1147, -646.4531, 96.2272, 90.0}, 3},
		{{2590.1257, -656.2684, 96.2272, 90.0}, 3},
		{{2585.4587, -666.8497, 96.2272, 270.0}, 3},
		{{2585.4595, -675.4648, 96.2272, 270.0}, 3},
		{{2590.1238, -675.4837, 96.2272, 90.0}, 3},
		{{2590.1228, -666.9805, 96.2272, 90.0}, 3},
		{{2585.4756, -656.3309, 96.2272, 270.0}, 4},
		{{2585.4529, -646.4376, 96.2272, 270.0}, 4},
		{{2590.1147, -646.4531, 96.2272, 90.0}, 4},
		{{2590.1257, -656.2684, 96.2272, 90.0}, 4},
		{{2585.4587, -666.8497, 96.2272, 270.0}, 4},
		{{2585.4595, -675.4648, 96.2272, 270.0}, 4},
		{{2590.1238, -675.4837, 96.2272, 90.0}, 4},
		{{2590.1228, -666.9805, 96.2272, 90.0}, 4},
		{{2585.4756, -656.3309, 96.2272, 270.0}, 5},
		{{2585.4529, -646.4376, 96.2272, 270.0}, 5},
		{{2590.1147, -646.4531, 96.2272, 90.0}, 5},
		{{2590.1257, -656.2684, 96.2272, 90.0}, 5},
		{{2585.4587, -666.8497, 96.2272, 270.0}, 5},
		{{2585.4595, -675.4648, 96.2272, 270.0}, 5},
		{{2590.1238, -675.4837, 96.2272, 90.0}, 5},
		{{2590.1228, -666.9805, 96.2272, 90.0}, 5}
	},
	{
		{{1706.4465, -1648.1760, 20.2247, 180.0}, 1},
		{{1701.0509, -1650.3156, 20.2193, 270.0}, 1},
		{{1701.0829, -1656.1892, 20.2193, 270.0}, 1},
		{{1701.2179, -1661.9034, 20.2194, 270.0}, 1},
		{{1734.7375, -1662.1298, 20.2415, 90.0}, 1},
		{{1734.7500, -1656.0935, 20.2415, 90.0}, 1},
		{{1734.7158, -1649.8925, 20.2347, 90.0}, 1},
		{{1734.7456, -1643.8621, 20.2306, 90.0}, 1},
		{{1734.7981, -1659.9923, 23.7187, 90.0}, 2},
		{{1734.7196, -1654.3068, 23.7311, 90.0}, 2},
		{{1734.7291, -1648.0933, 23.7448, 90.0}, 2},
		{{1734.7605, -1642.3568, 23.7527, 90.0}, 2},
		{{1709.0303, -1649.1915, 23.6953, 270.0}, 2},
		{{1709.0353, -1654.6066, 23.7011, 270.0}, 2},
		{{1709.0657, -1659.7111, 23.7023, 270.0}, 2},
		{{1709.0306, -1664.8696, 23.7036, 270.0}, 2},
		{{1709.0974, -1670.2623, 23.7048, 270.0}, 2},
		{{1715.3292, -1673.4901, 27.2064, 0.0}, 3},
		{{1720.9989, -1673.5028, 27.2059, 0.0}, 3},
		{{1734.7682, -1659.9248, 27.2157, 90.0}, 3},
		{{1734.7208, -1654.1005, 27.2246, 90.0}, 3},
		{{1734.7343, -1648.1334, 27.2332, 90.0}, 3},
		{{1734.7260, -1642.2648, 27.2357, 90.0}, 3},
		{{1709.0381, -1649.2734, 27.1953, 270.0}, 3},
		{{1708.9999, -1654.5089, 27.1953, 270.0}, 3},
		{{1709.0120, -1659.7993, 27.1953, 270.0}, 3},
		{{1709.0789, -1665.0492, 27.1953, 270.0}, 3},
		{{1709.0303, -1670.0830, 27.1953, 270.0}, 3}
	}
};
I don't know really why, but it chose to give the error specifically on the end of the second HotelRooms array (bold in the code).

Quote:

hotelsystem.pwn(173) : error 018: initialization data exceeds declared size

Reply
#2

pawn Код:
[sizeof(Hotels)]
isn't actually needed. Also, you get a extra '{' on every single line. Why do you even need a array inside a array, it should work fine anyway.
Reply
#3

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
pawn Код:
[sizeof(Hotels)]
isn't actually needed. Also, you get a extra '{' on every single line. Why do you even need a array inside a array, it should work fine anyway.
This array is for multiple hotels, sizeof(Hotels) is to make this system as dynamic as I can in case I'll add more hotels in the future (I currently have 5 as you see).
The extra '{}' is for the enum, I attach the floor number to each room position.
The problem is the amount of rooms which changes in every other hotel.
Reply
#4

Appearantly, in PAWN you cannot do this too:
Код:
new ArrayTest[2][] =
{
    {
		1,
		2,
		3,
		4,
		5,
		6,
		7
	},
	{
		1,
		2,
		3,
		4,
		5
	}
};


	for(new i; i < sizeof(RoomPos); i++)
		printf("%d", sizeof(RoomPos[i]));
Is there any other way to do store different amount of vars (in subarrays) all in the same array? If not, is there any other way to do this without having to create multiple arrays in different names? (for this I'll need to always browse verbally through all the arrays and search for the one I actually need - without the option to loop through all..
Reply
#5

what are you talking about? i'm sure you can do that... my fire system is just like that arraytest, i believe your doing something wrong.. i can't look at my script right now since i'm on vacation but something like this should work

pawn Код:
new ArrayTest[2][][] =
for(new i; i < sizeof(ArrayTest); i++)
        printf("%d", ArrayTest[i][0]);
0 = 1,2,3,4,5,6,7
1 = 1,2,3,4,5
Reply
#6

How do you get the size of ArrayTest[0] then?(without the 'i')
Reply
#7

PHP код:
new ArrayTest[3][4][5];
sizeof(ArrayTest) = 3
sizeof
(ArrayTest[]) = 4
sizeof
(ArrayTest[][]) = 
Reply
#8

Код:
new RoomArray[2][] =
{
    {
		0,
		1
	},
	{
		0,
		1,
		2
	}
};

	for(new hotel; hotel < 2; hotel++)
	{
	    for(new room; room < sizeof(RoomArray[]); room++)
	    {
	    
		}
	}
Quote:

sizeof(RoomArray[]) - error 001: expected token: "]", but found "-integer value-"

or:

Код:
for(new room; room < sizeof(RoomArray[0]); room++)
Quote:

sizeof(RoomArray[0]) - warning 224: indeterminate array size in "sizeof" expression (symbol "")

Reply
#9

I don't know, but to solve it, you can use constant definitions to maitain the same lenght in arrays.

pawn Код:
#define ARRAYSSIZE 30

new Hotel[ARRAYSIZE];

new HotelRooms[ARRAYSIZE][3][1];
Reply
#10

Yes, but my problem is that the amount of rooms is changing in every hotel. What I'm trying to do is to put all the rooms of all hotels in the same big array.

Код:
new HotelRooms[number of hotels - constant (in my case five)][amount of rooms - changing in every hotel][room information - constant (enum)];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)