// We set up the same values as monsterdata.json:
int str = fbb.createString("MyMonster");
+ int test1 = fbb.createString("test1");
+ int test2 = fbb.createString("test2");
Monster.startInventoryVector(fbb, 5);
for (byte i = 4; i >=0; i--) fbb.addByte(i);
Test.createTest(fbb, (short)30, (byte)40);
int test4 = fbb.endVector();
+ Monster.startTestarrayofstringVector(fbb, 2);
+ fbb.addOffset(test2);
+ fbb.addOffset(test1);
+ int testArrayOfString = fbb.endVector();
+
Monster.startMonster(fbb);
Monster.addPos(fbb, Vec3.createVec3(fbb, 1.0f, 2.0f, 3.0f, 3.0,
(byte)4, (short)5, (byte)6));
Monster.addTestType(fbb, (byte)1);
Monster.addTest(fbb, mon2);
Monster.addTest4(fbb, test4);
+ Monster.addTestarrayofstring(fbb, testArrayOfString);
int mon = Monster.endMonster(fbb);
fbb.finish(mon);
Test test_1 = monster.test4(1);
TestEq(monster.test4Length(), 2);
TestEq(test_0.a() + test_0.b() + test_1.a() + test_1.b(), 100);
+
+ TestEq(monster.testarrayofstringLength(), 2);
+ TestEq(monster.testarrayofstring(0),"test1");
+ TestEq(monster.testarrayofstring(1),"test2");
}
static <T> void TestEq(T a, T b) {
public Vec3 pos(Vec3 obj) { int o = __offset(4); return o != 0 ? obj.__init(o + bb_pos, bb) : null; }
public short mana() { int o = __offset(6); return o != 0 ? bb.getShort(o + bb_pos) : 150; }
public short hp() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) : 100; }
- public String name() { int o = __offset(10); return o != 0 ? __string(o) : null; }
+ public String name() { int o = __offset(10); return o != 0 ? __string(o + bb_pos) : null; }
public byte inventory(int j) { int o = __offset(14); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
public int inventoryLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; }
public byte color() { int o = __offset(16); return o != 0 ? bb.get(o + bb_pos) : 8; }