Skip to content
Permalink
Browse files

Reduce unnecessary copying when calling CG_Init

This also helps me avoid hitting a new codegen bug in Visual Studio
where it can't copy std::array<std::string, 1024> correctly.
  • Loading branch information...
slipher committed Mar 25, 2019
1 parent 69acc75 commit 12fa1852e5e55e76db7487881eacd97481a23944
Showing with 3 additions and 3 deletions.
  1. +2 −2 src/cgame/cg_api.cpp
  2. +1 −1 src/cgame/cg_main.cpp
@@ -44,7 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

int VM::VM_API_VERSION = CGAME_API_VERSION;

void CG_Init( int serverMessageNum, int clientNum, glconfig_t gl, GameStateCSs gameState );
void CG_Init( int serverMessageNum, int clientNum, const glconfig_t& gl, const GameStateCSs& gameState );
void CG_Shutdown();

void VM::VMHandleSyscall(uint32_t id, Util::Reader reader) {
@@ -62,7 +62,7 @@ void VM::VMHandleSyscall(uint32_t id, Util::Reader reader) {
break;

case CG_INIT:
IPC::HandleMsg<CGameInitMsg>(VM::rootChannel, std::move(reader), [] (int serverMessageNum, int clientNum, glconfig_t gl, GameStateCSs gamestate) {
IPC::HandleMsg<CGameInitMsg>(VM::rootChannel, std::move(reader), [] (int serverMessageNum, int clientNum, const glconfig_t& gl, const GameStateCSs& gamestate) {
CG_Init(serverMessageNum, clientNum, gl, gamestate);
cmdBuffer.TryFlush();
});
@@ -1442,7 +1442,7 @@ Will perform callbacks to make the loading info screen update.
=================
*/

void CG_Init( int serverMessageNum, int clientNum, glconfig_t gl, GameStateCSs gameState)
void CG_Init( int serverMessageNum, int clientNum, const glconfig_t& gl, const GameStateCSs& gameState)
{
const char *s;

0 comments on commit 12fa185

Please sign in to comment.
You can’t perform that action at this time.