Commit 1336d262 authored by Hong Wu's avatar Hong Wu Committed by Wouter van Oortmerssen

c++ Tutorial fix (#4494)

parent 853f7033
......@@ -604,7 +604,7 @@ traversal. This is generally easy to do on any tree structures.
// Create a `vector` representing the inventory of the Orc. Each number
// could correspond to an item that can be claimed after he is slain.
unsigned char treasure = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
unsigned char treasure[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
auto inventory = builder.CreateVector(treasure, 10);
~~~
</div>
......@@ -811,7 +811,7 @@ for the `path` field above:
<div class="language-cpp">
~~~{.cpp}
Vec3 points[] = { Vec3(1.0f, 2.0f, 3.0f), Vec3(4.0f, 5.0f, 6.0f) };
auto path = fbb.CreateVectorOfStructs(points, 2);
auto path = builder.CreateVectorOfStructs(points, 2);
~~~
</div>
<div class="language-java">
......@@ -1028,13 +1028,14 @@ a bit more flexibility.
// manually.
MonsterBuilder monster_builder(builder);
monster_builder.add_pos(&pos);
auto pos = Vec3(1.0f, 2.0f, 3.0f);
monster_builder.add_hp(hp);
monster_builder.add_name(name);
monster_builder.add_inventory(inventory);
monster_builder.add_color(Color_Red);
monster_builder.add_weapons(weapons);
monster_builder.add_equipped_type(Equipment_Weapon);
monster_builder.add_equpped(axe);
monster_builder.add_equpped(axe.Union());
auto orc = monster_builder.Finish();
~~~
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment