g_cmdpool.cpp

来自「PC网络游戏的编程」· C++ 代码 · 共 42 行

CPP
42
字号
// g_cmdpool.cpp: implementation of the CG_CmdPool class.

#include "g_cmdpool.h"

CG_CmdPool::CG_CmdPool()
{

}

CG_CmdPool::~CG_CmdPool()
{

}

bool CG_CmdPool::AddCmd(SCmd *cmd)
{
	m_cmdList.push_back(*cmd);
	return true;
}

SCmd *CG_CmdPool::GetCmdByStr(char *str)
{
	for(int i=0;i<m_cmdList.size();i++)
	{
		if(m_cmdList[i].str==str) return &m_cmdList[i]; 
	}
	return NULL;
}

SCmd *CG_CmdPool::GetCmdByNum(int num)
{
	for(int i=0;i<m_cmdList.size();i++)
	{
		if (m_cmdList[i].num==num) return &m_cmdList[i];
	}
	return NULL;
}

int CG_CmdPool::GetCmdCount()
{
	return m_cmdList.size();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?