
手游项目4
利来利往
幽默,诚实,守时,守信,适应能力强。
展开
-
[手游项目5]windows获得当前进程名
#include <windows.h>#include <stdio.h>#include <string>using namespace std;void SplitString2Int(const string& src, string delimit, vector<string>& vecRet){ string null_subst = "0"; if (src.empty() || src == "" || d.原创 2020-09-04 13:40:59 · 276 阅读 · 0 评论 -
【手游项目4】过滤特殊字符,游戏账号名,玩家游戏名,数据库特殊字符检测
//过滤特殊字符会导致数据库存储失败 空格、制表符、回车符、换行符组成的字符串inline bool CheckNameVaild( const char* pStrName ){ int nLen = strlen(pStrName); if(nLen < 1) return false; for (int i=0; i < nLen; i++) { char c = pStrName[i]; switch (c) { case '\'': case .原创 2020-07-08 23:53:09 · 504 阅读 · 0 评论 -
【手游项目4】计算两个经纬度间的距离,应用于开房游戏限制判断
//计算两个经纬度间的距离double D_jw(double wd1, double jd1, double wd2, double jd2){ double x, y, out; double PI = 3.14159265; double R = 6.371229*1e6; x = (jd2 - jd1)*PI*R*cos(((wd1, wd2) / 2) *PI / 180) / 180; y = (wd2 - wd1)*PI*R / 180; out = hypot(x, y);.原创 2020-07-08 23:49:50 · 281 阅读 · 0 评论 -
【手游项目4】手动拆包逻辑
比如我们和前端互通的包大小限制是4K,如果发一个大于4K的包就无法发送,这时候就需要和前端拆包和包。bool LobbyServer::SendPbMsgToClient(PlayerNode *lpPlayerNode, unsigned short type, void *buf, long len, int end){ __log(_ERROR, __FUNCTION__, "type[%d],len[%d],end[%d]", type, len, end); tagNetMsg pNe原创 2020-06-26 23:22:49 · 990 阅读 · 0 评论 -
【手游项目4】windows和linux通用时间管理类封装
#pragma once#ifdef _WIN32#include <time.h>#else#include <sys/time.h>#endif#include <string>typedef unsigned long long uint64;namespace Extralib{ namespace Timer { // 时间,精确到s,可以调用GetCurMillis,获得ms时间 class DateTime {.原创 2020-06-04 21:19:02 · 238 阅读 · 0 评论 -
[手游项目4]GM系统,消息映射
#include <string>#include <map>#include <vector>#include "LobbyPlayer.h"#include "LobbyServer.h"using namespace std;typedef bool(*NetMsgProcProtoType)(LobbyPlayer* pPlayer, vector<int> &args);struct NetMsgFunction{..原创 2020-06-03 17:27:43 · 308 阅读 · 0 评论 -
[手游项目4]-24-Linux下实现C语言的HTTP请求实现
第三部分 网络编程 (8 Linux下实现C语言的HTTP请求实现)https://blog.youkuaiyun.com/u013162035/article/details/80843720编译环境安装curl-7.59.0.tar 安装$tar -zxvf curl-7.59.0.tar.gz$cd curl-7.59.0sudo ./configuresudo make ...原创 2019-12-05 22:05:53 · 199 阅读 · 0 评论 -
[手游项目4]C++封装的排行榜管理
CRankingMgr::Instance()->AutoInit(); //根节点 Json::Value root; //子节点 Json::Value partner; partner["matchid"] = 1; partner["bet"] = 2; root.append(partner); Json::FastWriter writer; CRankin...原创 2019-08-29 15:59:37 · 901 阅读 · 3 评论