add copy ctor for ActorCommands. (This was an attempt to fix a crash,
and wasn't the problem, but is very important anyway; it's currently unused, so untested.)
This commit is contained in:
@@ -27,6 +27,29 @@ ActorCommands::~ActorCommands()
|
||||
Unregister();
|
||||
}
|
||||
|
||||
ActorCommands::ActorCommands( const ActorCommands& cpy )
|
||||
{
|
||||
m_sLuaFunctionName = GetNextFunctionName();
|
||||
|
||||
/* We need to make a new function, since we'll be unregistered separately. Set
|
||||
* the function by reference, so we don't make a new function unless we're actually
|
||||
* changed. */
|
||||
ostringstream s;
|
||||
s << m_sLuaFunctionName << " = " << cpy.GetFunctionName();
|
||||
|
||||
CString s2 = s.str();
|
||||
LUA->RunScript( s2 );
|
||||
}
|
||||
|
||||
ActorCommands &ActorCommands::operator=( const ActorCommands& cpy )
|
||||
{
|
||||
if( this == &cpy )
|
||||
return *this;
|
||||
|
||||
*this = cpy;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CString ActorCommands::GetFunctionName() const
|
||||
{
|
||||
return m_sLuaFunctionName;
|
||||
|
||||
@@ -11,6 +11,8 @@ class ActorCommands
|
||||
public:
|
||||
ActorCommands( const Commands& cmds );
|
||||
~ActorCommands();
|
||||
ActorCommands( const ActorCommands& cpy );
|
||||
ActorCommands &operator=( const ActorCommands& cpy );
|
||||
|
||||
|
||||
CString GetFunctionName() const;
|
||||
|
||||
Reference in New Issue
Block a user