While ogres were sleeping CPP - default code is wrong

I just need help figuring out if this is a bug and just move on or if there is an issue I am just overlooking.

Hello. This is the second level where I can not complete it do to an error with the base code. Rewriting it does not seem to help me. I can’t use the points. Here is a screenshot of the error.
I am only trying to figure out why I am getting an error from the start of the code.

I think the way the code should be written is:

but this will throw an error in CoCo.
a workaround :

    auto points [] = {{21, 8}, {33, 8}, {45, 8},
        {57, 8}, {68, 8}, {68, 18},
        {68, 28}, {68, 38}, {68, 48},
        {68, 58}, {56, 58}, {44, 58}, 
        {32, 58}, {20, 58}, {10, 60}};
        hero.moveXY(point[0], point[1]);

the rest is trivial

Are you johnyjohnm? How many of the levels you have completed are written in c ++ ?

1 Like

Interesting… Okay I will make adjustments once I have a chance.
I am almost done with the desert. Granted stuck with a couple levels.

hey, thanks again that helped a lot. I didn’t think I would need the after " auto points".
That is kind of weird in my opinion but i am still learning as I go!!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.

Another way to write the same thing is:

    Vector points [] = {Vector(21, 8), Vector(33, 8),Vector(45, 8),
        Vector(57, 8), Vector(68, 8), Vector(68, 18),
        Vector(68, 28), Vector(68, 38), Vector(68, 48),
        Vector(68, 58), Vector(56, 58), Vector(44, 58)}; 

    int pointIndex = 0;
    while (pointIndex < points.size()) {
        Vector point = points[pointIndex];
        hero.moveXY(point.x, point.y); 

but in both cases the default code is wrong

1 Like

Yes, it definitely is.

well i really appreciate the help. I have not touched anything this complicated yet. So, lack of knowledge I assumed it would be right.

Yea, if I were in your shoes, I would have thought so too.

We’re making a fix to our C++ sample code generator to be able to handle this case. Thanks for the bug report!