c++ Tutorial fix (#4494)

This commit is contained in:
Hong Wu 2017-11-16 12:09:48 -06:00 committed by Wouter van Oortmerssen
parent 853f7033e0
commit 1336d26252
1 changed files with 4 additions and 3 deletions

View File

@ -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>