Use array<> for jointlist

This commit is contained in:
Kp 2015-02-14 22:48:30 +00:00
parent 68e2168377
commit 2c63744fd3
2 changed files with 7 additions and 10 deletions

View file

@ -146,9 +146,8 @@ struct robot_info : prohibit_void_ptr<robot_info>
ubyte behavior; // Default behavior.
ubyte aim; // 255 = perfect, less = more likely to miss. 0 != random, would look stupid. 0=45 degree spread. Specify in bitmaps.tbl in range 0.0..1.0
#endif
//animation info
jointlist anim_states[MAX_GUNS+1][N_ANIM_STATES];
array<array<jointlist, N_ANIM_STATES>, MAX_GUNS+1> anim_states;
int always_0xabcd; // debugging
};

View file

@ -180,15 +180,13 @@ void robot_set_angles(robot_info *r,polymodel *pm,vms_angvec angs[N_ANIM_STATES]
/*
* reads n jointlist structs from a PHYSFS_file
*/
static int jointlist_read_n(jointlist *jl, int n, PHYSFS_file *fp)
static void jointlist_read(PHYSFS_File *fp, array<jointlist, N_ANIM_STATES> &jl)
{
int i;
for (i = 0; i < n; i++) {
jl[i].n_joints = PHYSFSX_readShort(fp);
jl[i].offset = PHYSFSX_readShort(fp);
range_for (auto &i, jl)
{
i.n_joints = PHYSFSX_readShort(fp);
i.offset = PHYSFSX_readShort(fp);
}
return i;
}
/*
@ -294,7 +292,7 @@ void robot_info_read(PHYSFS_File *fp, robot_info &ri)
#endif
range_for (auto &j, ri.anim_states)
jointlist_read_n(j, N_ANIM_STATES, fp);
jointlist_read(fp, j);
ri.always_0xabcd = PHYSFSX_readInt(fp);
}