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:
Glenn Maynard
2005-01-28 19:54:52 +00:00
parent 703833d7d4
commit c108dce357
2 changed files with 25 additions and 0 deletions
+23
View File
@@ -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;
+2
View File
@@ -11,6 +11,8 @@ class ActorCommands
public:
ActorCommands( const Commands& cmds );
~ActorCommands();
ActorCommands( const ActorCommands& cpy );
ActorCommands &operator=( const ActorCommands& cpy );
CString GetFunctionName() const;