From 1336d2625284b4e91ba30264b6ae060e84eb1ebf Mon Sep 17 00:00:00 2001 From: Hong Wu Date: Thu, 16 Nov 2017 12:09:48 -0600 Subject: [PATCH] c++ Tutorial fix (#4494) --- docs/source/Tutorial.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/Tutorial.md b/docs/source/Tutorial.md index 01d05933d..a1eea12ca 100644 --- a/docs/source/Tutorial.md +++ b/docs/source/Tutorial.md @@ -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); ~~~ @@ -811,7 +811,7 @@ for the `path` field above:
~~~{.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); ~~~
@@ -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(); ~~~