Game Development Community

Problem with console command getServerConnection() in 1.4?

by kcpdad · in Torque Game Engine · 01/08/2006 (11:58 am) · 1 replies

A script call that worked in 1.3 fails to compile in 1.4
%gameconn = GameConnection::getServerConnection();
fails

%gameconn = GameConnection::getServerConnection(0);
works.

In game/gameConnection.cc
this in 1.3
ConsoleStaticMethod(GameConnection, getServerConnection, S32, 1, 1, "() Get the server connection if any.")
{
   if(GameConnection::getServerConnection())
      return GameConnection::getServerConnection()->getId();
   else
   {
      Con::errorf("GameConnection::getServerConnection - no connection available.");
      return -1;
   }
}
changed to
ConsoleStaticMethod(GameConnection, getServerConnection, S32, 2, 2, "() Get the server connection if any.")
{
   if(GameConnection::getConnectionToServer())
      return GameConnection::getConnectionToServer()->getId();
   else
   {
      Con::errorf("GameConnection::getServerConnection - no connection available.");
      return -1;
   }
}
in 1.4.
The now required parameter does nothing.

About the author

Hobbyist working on a tank game when time allows. Play the prototype at => http://www.sytrept.com/60tons/


#1
01/08/2006 (4:43 pm)
I distinctly remember changing that to address a bug, but I guess it was a misguided fix! #1088.