Hi SoulRider,
I've just had a look at your files. Generally, they look very good. I think what got you caught was the very first two lines in the header file:
Code: Select all
#ifndef CAFU_GAMESYS_COMPONENT_ENTITY_BASICS_HPP_INCLUDED
#define CAFU_GAMESYS_COMPONENT_ENTITY_BASICS_HPP_INCLUDED
The problem is the "BASICS" part, that is, these two lines are the same as in the
CompBasics.hpp
file.
This error now and then happens to me, too, and often in such cases it is completely unclear from compiler output that this is the root of the problem, because the error messages tend to point entirely elsewhere. If you change these two lines to e.g.
Code: Select all
#ifndef CAFU_GAMESYS_COMPONENT_ENTITY_TEAM_HPP_INCLUDED
#define CAFU_GAMESYS_COMPONENT_ENTITY_TEAM_HPP_INCLUDED
the problem will be solved, and any subsequent compiler error messages start to make sense again.
I'm sure you can figure out the subsequent problems on your own, but I too looked a bit further: Most errors are trivial, such as a missing trailing T in
ComponentTeamT
, a single colon where double colon :: is needed, and so on.
I saw that you implemented
GetTeamNumber()
and
SetTeamNumber()
. This is of course possible, but with variables that are declared of type
TypeSys::VarT<...>
and processed by method
FillMemberVars()
, although it does no harm, it is not necessary, because the component system automatically provides you with Lua get and set methods for such variables:
Code: Select all
-- in Lua code, if Team is your team component:
local tn = Team:get("TeamNum") -- "TeamNum" is the string given in the C++ constructor.
Team:set("TeamNum", 1 - tn) -- toggle 0 and 1 ;-)
See the example scripts in
Games/DeathMatch/Scripts
for plenty of similar examples of the other components, and see the
Base component reference documentation for more details about the
get()
and
set()
methods.
Of course, using these methods with the string parameters is somewhat inconvenient, and implementing custom methods as you are doing is a good method to bridge the gap until our component system can automatically provide script access such as
Team.TeamNum
etc. Another reason for custom methods is any functionality that is not covered by the automatically provided methods.
Finally, in the code in the
cpp
file that mentions
ComponentTeamT::EntityTeamT
, I didn't know what to do with it, and this is where I stopped for now.