void main () { vector pos = cInvalidVector; pos = xsVectorSet(4.5, 1.5, 0.0); /* These lines of code should not change the spawn location of the palisade, but they do. The note after each line indicates the location if only that line is uncommented. */ xsChatData("Printing this message causes the palisade to spawn in the wrong place."); /* spawns at (0.5, -0.5) */ // float f = 8.5; /* spawns at (8.5, 1.5) or x=f in general */ // float y = xsVectorGetY(pos); /* spawns at (1.5, 1.5) or x=y in general */ xsCreateUnit(72, 1, pos, false, false, false); /* 72 = Palisade wall */ xsChatData("pos = " + pos); /* Prints correct values */ xsDisplayInstructions("A palisade should spawn at (4.5, 1.5), marked by the road tile. The coordinates are stored in a local vector `pos`, which is then used inside `xsCreateUnit`.", 9999, 1, -1, cPanelTop); xsDisplayInstructions("On Mac (and not Windows), unrelated code between assigning value to `pos` and calling `xsCreateUnit(..., pos, ...)` interferes with the placement. Uncomment different lines to see different wrong positions.", 9999, 1, -1, cPanelMiddle); xsDisplayInstructions("When printing the value of `pos` later, correct values are printed.", 9999, 1, -1, cPanelBottom); }