Skip to main content
added 130 characters in body
Source Link
user35344
user35344

Your indexing is broken.

for (int xj = 0; xj < line.Split(',').Length - 2; xj++)

Inside the loop you are accessing xj, xj + 1 and xj + 2. Currently then your next iteration will use xj + 1, xj + 2 and xj + 3. You didn't include how you write the save file, but I assume there is a similar issue there as you seem to write vector components into wrong places.

Instead, you want to increment the loop counter with 3 each time, so that instead of reading the same values 3 times, you only read them once and then move onto the next element. So xj += 3 is what your loop increment should be.

for (int xj = 0; xj < line.Split(',')map_.Length; xj += 3)
{
    // Here xj is an index of a X coordinate, xj + 1 is an index of a Y coordinate, xj + 2 is an index of a Z coordinate
}

Also note that you want to iterate until map_.Length, since this is what contains your coordinate values, not line.Split(",").Length.

Your indexing is broken.

for (int xj = 0; xj < line.Split(',').Length - 2; xj++)

Inside the loop you are accessing xj, xj + 1 and xj + 2. Currently then your next iteration will use xj + 1, xj + 2 and xj + 3. You didn't include how you write the save file, but I assume there is a similar issue there as you seem to write vector components into wrong places.

Instead, you want to increment the loop counter with 3 each time, so that instead of reading the same values 3 times, you only read them once and then move onto the next element. So xj += 3 is what your loop increment should be.

for (int xj = 0; xj < line.Split(',').Length; xj += 3)
{
    // Here xj is an index of a X coordinate, xj + 1 is an index of a Y coordinate, xj + 2 is an index of a Z coordinate
}

Your indexing is broken.

for (int xj = 0; xj < line.Split(',').Length - 2; xj++)

Inside the loop you are accessing xj, xj + 1 and xj + 2. Currently then your next iteration will use xj + 1, xj + 2 and xj + 3. You didn't include how you write the save file, but I assume there is a similar issue there as you seem to write vector components into wrong places.

Instead, you want to increment the loop counter with 3 each time, so that instead of reading the same values 3 times, you only read them once and then move onto the next element. So xj += 3 is what your loop increment should be.

for (int xj = 0; xj < map_.Length; xj += 3)
{
    // Here xj is an index of a X coordinate, xj + 1 is an index of a Y coordinate, xj + 2 is an index of a Z coordinate
}

Also note that you want to iterate until map_.Length, since this is what contains your coordinate values, not line.Split(",").Length.

added 62 characters in body
Source Link
user35344
user35344

Your indexing is broken.

for (int xj = 0; xj < line.Split(',').Length - 2; xj++)

Inside the loop you are accessing xj, xj + 1 and xj + 2. Currently then your next iteration will use xj + 1, xj + 2 and xj + 3. You didn't include how you write the save file, but I assume there is a similar issue there as you seem to write vector components into wrong places.

Instead, you want to increment the loop counter with 3 each time, so that instead of reading the same values 3 times, you only read them once and then move onto the next element. So xj += 3 is what your loop increment should be.

for (int xj = 0; xj < line.Split(',').Length; xj += 3)
{
    // Here xj is an index of a X coordinate, xj + 1 is an index of a Y coordinate, xj + 2 is an index of a Z coordinate
}

Your indexing is broken.

for (int xj = 0; xj < line.Split(',').Length - 2; xj++)

Inside the loop you are accessing xj, xj + 1 and xj + 2. Currently then your next iteration will use xj + 1, xj + 2 and xj + 3. You didn't include how you write the save file, but I assume there is a similar issue there as you seem to write vector components into wrong places.

Instead, you want to increment the loop counter with 3 each time, so that instead of reading the same values 3 times, you only read them once and then move onto the next element. So xj += 3 is what your loop increment should be.

Your indexing is broken.

for (int xj = 0; xj < line.Split(',').Length - 2; xj++)

Inside the loop you are accessing xj, xj + 1 and xj + 2. Currently then your next iteration will use xj + 1, xj + 2 and xj + 3. You didn't include how you write the save file, but I assume there is a similar issue there as you seem to write vector components into wrong places.

Instead, you want to increment the loop counter with 3 each time, so that instead of reading the same values 3 times, you only read them once and then move onto the next element. So xj += 3 is what your loop increment should be.

for (int xj = 0; xj < line.Split(',').Length; xj += 3)
{
    // Here xj is an index of a X coordinate, xj + 1 is an index of a Y coordinate, xj + 2 is an index of a Z coordinate
}
deleted 60 characters in body
Source Link
user35344
user35344

Your indexing is broken.

for (int xj = 0; xj < line.Split(',').Length - 2; xj++)
for (int xj = 0; xj < line.Split(',').Length-2; xj++)

Inside the loopsloop you are accessing xj, xj + 1 and xj + 2. Currently then your next iteration will use xj + 1, xj + 2 and xj + 3. You didn't include how you write the save file, but I assume there is a similar issue there as you seem to write vector components into wrong places.

Instead, you want to increment the loop counter with 3 each time, so that instead of reading the same values 3 times, you only read them once and then move onto the next element. So xj += 3 is what your loop increment should be.

Your indexing is broken.

for (int xj = 0; xj < line.Split(',').Length - 2; xj++)
for (int xj = 0; xj < line.Split(',').Length-2; xj++)

Inside the loops you are accessing xj, xj + 1 and xj + 2. Currently then your next iteration will use xj + 1, xj + 2 and xj + 3.

Instead, you want to increment the loop counter with 3 each time, so that instead of reading the same values 3 times, you only read them once and then move onto the next element. So xj += 3 is what your loop increment should be.

Your indexing is broken.

for (int xj = 0; xj < line.Split(',').Length - 2; xj++)

Inside the loop you are accessing xj, xj + 1 and xj + 2. Currently then your next iteration will use xj + 1, xj + 2 and xj + 3. You didn't include how you write the save file, but I assume there is a similar issue there as you seem to write vector components into wrong places.

Instead, you want to increment the loop counter with 3 each time, so that instead of reading the same values 3 times, you only read them once and then move onto the next element. So xj += 3 is what your loop increment should be.

Source Link
user35344
user35344
Loading