[unrelated-to-swift] an issue with structs in C++?


(Ethin Probst) #1

Hello all,
I have the following structured array:
  static struct {
    LPCSTR text;
    float x;
    float y;
    float z;
  } lines[50000] = {
      { "MARKER" },
            { "MICHAEL'S HOUSE", -852.4f, 160.0f, 65.6f },
      { "FRANKLIN'S HOUSE", 7.9f, 548.1f, 175.5f },
      { "TREVOR'S TRAILER", 1985.7f, 3812.2f, 32.2f },
      { "AIRPORT ENTRANCE", -1034.6f, -2733.6f, 13.8f },
      { "AIRPORT FIELD", -1336.0f, -3044.0f, 13.9f },
      { "ELYSIAN ISLAND", 338.2f, -2715.9f, 38.5f },
      { "JETSAM", 760.4f, -2943.2f, 5.8f },
      { "STRIPCLUB", 127.4f, -1307.7f, 29.2f },
      { "ELBURRO HEIGHTS", 1384.0f, -2057.1f, 52.0f },
      { "FERRIS WHEEL", -1670.7f, -1125.0f, 13.0f },
      { "CHUMASH", -3192.6f, 1100.0f, 20.2f },
      { "WINDFARM", 2354.0f, 1830.3f, 101.1f },
      { "MILITARY BASE", -2047.4f, 3132.1f, 32.8f },
      { "MCKENZIE AIRFIELD", 2121.7f, 4796.3f, 41.1f },
      { "DESERT AIRFIELD", 1747.0f, 3273.7f, 41.1f },
      { "CHILLIAD", 425.4f, 5614.3f, 766.5f },
      {"Strip Club DJ Booth", 126.135f, -1278.583f, 29.270f},
{"Blaine County Savings Bank", -109.299f, 6464.035f, 31.627f},
{"Police Station", 436.491f, -982.172f, 30.699f},
{"Humane Labs Entrance", 3619.749f, 2742.740f, 28.690f},
{"Burnt FIB Building", 160.868f, -745.831f, 250.063f},
{"North Yankton Bank", 5309.519f, -5212.375f, 83.522f},
{"10 Car Garage Back Room", 223.193f, -967.322f, 99.000f},
{"Humane Labs Tunnel", 3525.495f, 3705.301f, 20.992f},
{"Ammunation Office", 12.494f, -1110.130f, 29.797f},
{"Ammunation Gun Range", 22.153f, -1072.854f, 29.797f},
{"Trevor's Meth Lab", 1391.773f, 3608.716f, 38.942f},
{"Pacific Standard Bank Vault", 255.851f, 217.030f, 101.683f},
{"Lester's House", 1273.898f, -1719.304f, 54.771f},
{"Floyd's Apartment", -1150.703f, -1520.713f, 10.633f},
{"FIB Top Floor", 135.733f, -749.216f, 258.152f},
{"IAA Office", 117.220f, -620.938f, 206.047f},
{"Pacific Standard Bank", 235.046f, 216.434f, 106.287f},
{"Fort Zancudo ATC entrance", -2344.373f, 3267.498f, 32.811f},
{"Fort Zancudo ATC top floor", -2358.132f, 3249.754f, 101.451f},
{"Damaged Hospital", 356.822f, -590.151f, 43.315f},
{"Slaughterhouse", -80.557f, 6220.006f, 31.090f},
{"Los Santos County Coroner Office/Morgue", 243.351f, -1376.014f, 39.534f},
{"Torture Room", 147.170f, -2201.804f, 4.688f},
{"O'neil Ranch", 2441.216f, 4968.585f, 51.707f},
{"Main LS Customs", -365.425f, -131.809f, 37.873f},
{"Yacht", -2023.661f, -1038.038f, 5.577f},
{"Carrier (MP Only)", 3069.330f, -4704.220f, 15.043f},
{"Fort Zankudo UFO", 2052.000f, 3237.000f, 1456.973f},
{"Very High Up", -129.964f, 8130.873f, 6705.307f},
{"IAA Roof", 134.085f, -637.859f, 262.851f},
{"FIB Roof", 150.126f, -754.591f, 262.865f},
{"Maze Bank Roof", -75.015f, -818.215f, 326.176f},
{"Top of the Mt Chilad", 450.718f, 5566.614f, 806.183f},
{"Most Northerly Point", 24.775f, 7644.102f, 19.055f},
{"Vinewood Bowl Stage", 686.245f, 577.950f, 130.461f},
{"Sisyphus Theater Stage", 205.316f, 1167.378f, 227.005f},
{"Director Mod Trailer", -20.004f, -10.889f, 500.602f},
{"Galileo Observatory Roof", -438.804f, 1076.097f, 352.411f},
{"Kortz Center", -2243.810f, 264.048f, 174.615f},
{"Chumash Historic Family Pier", -3426.683f, 967.738f, 8.347f},
{"Paleto Bay Pier", -275.522f, 6635.835f, 7.425f},
{"God's thumb", -1006.402f, 6272.383f, 1.503f},
{"Calafia Train Bridge", -517.869f, 4425.284f, 89.795f},
{"Altruist Cult Camp", -1170.841f, 4926.646f, 224.295f},
{"Maze Bank Arena Roof", -324.300f, -1968.545f, 67.002f},
{"Marlowe Vineyards", -1868.971f, 2095.674f, 139.115f},
{"Hippy Camp", 2476.712f, 3789.645f, 41.226f},
{"Devin Weston's House", -2639.872f, 1866.812f, 160.135f},
{"Abandon Mine", -595.342f, 2086.008f, 131.412f},
{"Weed Farm", 2208.777f, 5578.235f, 53.735f},
{"Stab City", 126.975f, 3714.419f, 46.827f},
{"Airplane Graveyard Airplane Tail", 2395.096f, 3049.616f, 60.053f},
{"Satellite Dish Antenna", 2034.988f, 2953.105f, 74.602f},
{"Satellite Dishes", 2062.123f, 2942.055f, 47.431f},
{"Windmill Top", 2026.677f, 1842.684f, 133.313f},
{"Sandy Shores Building Site Crane", 1051.209f, 2280.452f, 89.727f},
{"Rebel Radio", 736.153f, 2583.143f, 79.634f},
{"Quarry", 2954.196f, 2783.410f, 41.004f},
{"Palmer-Taylor Power Station Chimney", 2732.931f, 1577.540f, 83.671f},
{"Merryweather Dock", 486.417f, -3339.692f, 6.070f},
{"Cargo Ship", 899.678f, -2882.191f, 19.013f},
{"Del Perro Pier", -1850.127f, -1231.751f, 13.017f},
{"Play Boy Mansion", -1475.234f, 167.088f, 55.841f},
{"Jolene Cranley-Evans Ghost", 3059.620f, 5564.246f, 197.091f},
{"NOOSE Headquarters", 2535.243f, -383.799f, 92.993f},
{"Snowman", 971.245f, -1620.993f, 30.111f},
{"Oriental Theater", 293.089f, 180.466f, 104.301f},
{"Beach Skatepark", -1374.881f, -1398.835f, 6.141f},
{"Underpass Skatepark", 718.341f, -1218.714f, 26.014f},
{"Casino", 925.329f, 46.152f, 80.908f},
{"University of San Andreas", -1696.866f, 142.747f, 64.372f},
{"La Puerta Freeway Bridge", -543.932f, -2225.543f, 122.366f},
{"Land Act Dam", 1660.369f, -12.013f, 170.020f},
{"Mount Gordo", 2877.633f, 5911.078f, 369.624f},
{"Little Seoul", -889.655f, -853.499f, 20.566f},
{"Epsilon Building", -695.025f, 82.955f, 55.855f, 55.855f},
{"The Richman Hotel", -1330.911f, 340.871f, 64.078f},
{"Vinewood sign", 711.362f, 1198.134f, 348.526f},
{"Los Santos Golf Club", -1336.715f, 59.051f, 55.246f},
{"Chicken", -31.010f, 6316.830f, 40.083f},
{"Little Portola", -635.463f, -242.402f, 38.175f},
{"Pacific Bluffs Country Club", -3022.222f, 39.968f, 13.611f},
{"Vinewood Cemetery", -1659993.000f, -128.399f, 59.954f},
{"Paleto Forest Sawmill Chimney", -549.467f, 5308.221f, 114.146f},
{"Mirror Park", 1070.206f, -711.958f, 58.483f},
{"Rocket", 1608.698f, 6438.096f, 37.637f},
{"El Gordo Lighthouse", 3430.155f, 5174.196f, 41.280f},
{"Mile High Club", -144.274f, -946.813f, 269.135f},
{"Sunken Body", -3161.078f, 3001.998f, -37.974f},
{"Underwater WW2 Tank", 4201.633f, 3643.821f, -39.016f},
{"Dead Sea Monster", -3373.726f, 504.714f, -24.656f},
{"Underwater UFO", 762.426f, 7380.371f, -111.377f},
{"Underwater Hatch", 4273.950f, 2975.714f, -170.746f},
{"Sunken Plane", -942.350f, 6608.752f, -20.912f},
{"Sunken Cargo Ship", 3199.748f, -379.018f, -22.500f}
  };
Yes, I know that 50000 items is way too much for this array, but it
was what I thought of at the time. Anyways, I'm getting 'too many
initializers' whenever I try and compile this particular part of code.
As you guys respond the fastest, is there any suggestions you guys can
offer?

···

--
Signed,
Ethin D. Probst


(Saagar Jha) #2

Looks like someone’s trying to solve the Mt. Chiliad Mystery :slight_smile: Anyways, it appears that “Epsilon Building” has 5 members instead of 4. That’s probably causing the issue.

Saagar Jha

···

On Jan 11, 2017, at 8:46 PM, Ethin Probst via swift-users <swift-users@swift.org> wrote:

Hello all,
I have the following structured array:
  static struct {
    LPCSTR text;
    float x;
    float y;
    float z;
  } lines[50000] = {
      { "MARKER" },
            { "MICHAEL'S HOUSE", -852.4f, 160.0f, 65.6f },
      { "FRANKLIN'S HOUSE", 7.9f, 548.1f, 175.5f },
      { "TREVOR'S TRAILER", 1985.7f, 3812.2f, 32.2f },
      { "AIRPORT ENTRANCE", -1034.6f, -2733.6f, 13.8f },
      { "AIRPORT FIELD", -1336.0f, -3044.0f, 13.9f },
      { "ELYSIAN ISLAND", 338.2f, -2715.9f, 38.5f },
      { "JETSAM", 760.4f, -2943.2f, 5.8f },
      { "STRIPCLUB", 127.4f, -1307.7f, 29.2f },
      { "ELBURRO HEIGHTS", 1384.0f, -2057.1f, 52.0f },
      { "FERRIS WHEEL", -1670.7f, -1125.0f, 13.0f },
      { "CHUMASH", -3192.6f, 1100.0f, 20.2f },
      { "WINDFARM", 2354.0f, 1830.3f, 101.1f },
      { "MILITARY BASE", -2047.4f, 3132.1f, 32.8f },
      { "MCKENZIE AIRFIELD", 2121.7f, 4796.3f, 41.1f },
      { "DESERT AIRFIELD", 1747.0f, 3273.7f, 41.1f },
      { "CHILLIAD", 425.4f, 5614.3f, 766.5f },
      {"Strip Club DJ Booth", 126.135f, -1278.583f, 29.270f},
{"Blaine County Savings Bank", -109.299f, 6464.035f, 31.627f},
{"Police Station", 436.491f, -982.172f, 30.699f},
{"Humane Labs Entrance", 3619.749f, 2742.740f, 28.690f},
{"Burnt FIB Building", 160.868f, -745.831f, 250.063f},
{"North Yankton Bank", 5309.519f, -5212.375f, 83.522f},
{"10 Car Garage Back Room", 223.193f, -967.322f, 99.000f},
{"Humane Labs Tunnel", 3525.495f, 3705.301f, 20.992f},
{"Ammunation Office", 12.494f, -1110.130f, 29.797f},
{"Ammunation Gun Range", 22.153f, -1072.854f, 29.797f},
{"Trevor's Meth Lab", 1391.773f, 3608.716f, 38.942f},
{"Pacific Standard Bank Vault", 255.851f, 217.030f, 101.683f},
{"Lester's House", 1273.898f, -1719.304f, 54.771f},
{"Floyd's Apartment", -1150.703f, -1520.713f, 10.633f},
{"FIB Top Floor", 135.733f, -749.216f, 258.152f},
{"IAA Office", 117.220f, -620.938f, 206.047f},
{"Pacific Standard Bank", 235.046f, 216.434f, 106.287f},
{"Fort Zancudo ATC entrance", -2344.373f, 3267.498f, 32.811f},
{"Fort Zancudo ATC top floor", -2358.132f, 3249.754f, 101.451f},
{"Damaged Hospital", 356.822f, -590.151f, 43.315f},
{"Slaughterhouse", -80.557f, 6220.006f, 31.090f},
{"Los Santos County Coroner Office/Morgue", 243.351f, -1376.014f, 39.534f},
{"Torture Room", 147.170f, -2201.804f, 4.688f},
{"O'neil Ranch", 2441.216f, 4968.585f, 51.707f},
{"Main LS Customs", -365.425f, -131.809f, 37.873f},
{"Yacht", -2023.661f, -1038.038f, 5.577f},
{"Carrier (MP Only)", 3069.330f, -4704.220f, 15.043f},
{"Fort Zankudo UFO", 2052.000f, 3237.000f, 1456.973f},
{"Very High Up", -129.964f, 8130.873f, 6705.307f},
{"IAA Roof", 134.085f, -637.859f, 262.851f},
{"FIB Roof", 150.126f, -754.591f, 262.865f},
{"Maze Bank Roof", -75.015f, -818.215f, 326.176f},
{"Top of the Mt Chilad", 450.718f, 5566.614f, 806.183f},
{"Most Northerly Point", 24.775f, 7644.102f, 19.055f},
{"Vinewood Bowl Stage", 686.245f, 577.950f, 130.461f},
{"Sisyphus Theater Stage", 205.316f, 1167.378f, 227.005f},
{"Director Mod Trailer", -20.004f, -10.889f, 500.602f},
{"Galileo Observatory Roof", -438.804f, 1076.097f, 352.411f},
{"Kortz Center", -2243.810f, 264.048f, 174.615f},
{"Chumash Historic Family Pier", -3426.683f, 967.738f, 8.347f},
{"Paleto Bay Pier", -275.522f, 6635.835f, 7.425f},
{"God's thumb", -1006.402f, 6272.383f, 1.503f},
{"Calafia Train Bridge", -517.869f, 4425.284f, 89.795f},
{"Altruist Cult Camp", -1170.841f, 4926.646f, 224.295f},
{"Maze Bank Arena Roof", -324.300f, -1968.545f, 67.002f},
{"Marlowe Vineyards", -1868.971f, 2095.674f, 139.115f},
{"Hippy Camp", 2476.712f, 3789.645f, 41.226f},
{"Devin Weston's House", -2639.872f, 1866.812f, 160.135f},
{"Abandon Mine", -595.342f, 2086.008f, 131.412f},
{"Weed Farm", 2208.777f, 5578.235f, 53.735f},
{"Stab City", 126.975f, 3714.419f, 46.827f},
{"Airplane Graveyard Airplane Tail", 2395.096f, 3049.616f, 60.053f},
{"Satellite Dish Antenna", 2034.988f, 2953.105f, 74.602f},
{"Satellite Dishes", 2062.123f, 2942.055f, 47.431f},
{"Windmill Top", 2026.677f, 1842.684f, 133.313f},
{"Sandy Shores Building Site Crane", 1051.209f, 2280.452f, 89.727f},
{"Rebel Radio", 736.153f, 2583.143f, 79.634f},
{"Quarry", 2954.196f, 2783.410f, 41.004f},
{"Palmer-Taylor Power Station Chimney", 2732.931f, 1577.540f, 83.671f},
{"Merryweather Dock", 486.417f, -3339.692f, 6.070f},
{"Cargo Ship", 899.678f, -2882.191f, 19.013f},
{"Del Perro Pier", -1850.127f, -1231.751f, 13.017f},
{"Play Boy Mansion", -1475.234f, 167.088f, 55.841f},
{"Jolene Cranley-Evans Ghost", 3059.620f, 5564.246f, 197.091f},
{"NOOSE Headquarters", 2535.243f, -383.799f, 92.993f},
{"Snowman", 971.245f, -1620.993f, 30.111f},
{"Oriental Theater", 293.089f, 180.466f, 104.301f},
{"Beach Skatepark", -1374.881f, -1398.835f, 6.141f},
{"Underpass Skatepark", 718.341f, -1218.714f, 26.014f},
{"Casino", 925.329f, 46.152f, 80.908f},
{"University of San Andreas", -1696.866f, 142.747f, 64.372f},
{"La Puerta Freeway Bridge", -543.932f, -2225.543f, 122.366f},
{"Land Act Dam", 1660.369f, -12.013f, 170.020f},
{"Mount Gordo", 2877.633f, 5911.078f, 369.624f},
{"Little Seoul", -889.655f, -853.499f, 20.566f},
{"Epsilon Building", -695.025f, 82.955f, 55.855f, 55.855f},
{"The Richman Hotel", -1330.911f, 340.871f, 64.078f},
{"Vinewood sign", 711.362f, 1198.134f, 348.526f},
{"Los Santos Golf Club", -1336.715f, 59.051f, 55.246f},
{"Chicken", -31.010f, 6316.830f, 40.083f},
{"Little Portola", -635.463f, -242.402f, 38.175f},
{"Pacific Bluffs Country Club", -3022.222f, 39.968f, 13.611f},
{"Vinewood Cemetery", -1659993.000f, -128.399f, 59.954f},
{"Paleto Forest Sawmill Chimney", -549.467f, 5308.221f, 114.146f},
{"Mirror Park", 1070.206f, -711.958f, 58.483f},
{"Rocket", 1608.698f, 6438.096f, 37.637f},
{"El Gordo Lighthouse", 3430.155f, 5174.196f, 41.280f},
{"Mile High Club", -144.274f, -946.813f, 269.135f},
{"Sunken Body", -3161.078f, 3001.998f, -37.974f},
{"Underwater WW2 Tank", 4201.633f, 3643.821f, -39.016f},
{"Dead Sea Monster", -3373.726f, 504.714f, -24.656f},
{"Underwater UFO", 762.426f, 7380.371f, -111.377f},
{"Underwater Hatch", 4273.950f, 2975.714f, -170.746f},
{"Sunken Plane", -942.350f, 6608.752f, -20.912f},
{"Sunken Cargo Ship", 3199.748f, -379.018f, -22.500f}
  };
Yes, I know that 50000 items is way too much for this array, but it
was what I thought of at the time. Anyways, I'm getting 'too many
initializers' whenever I try and compile this particular part of code.
As you guys respond the fastest, is there any suggestions you guys can
offer?

--
Signed,
Ethin D. Probst
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users