Skip to content

Commit

Permalink
Enable Support for GCC(MinGW_w64)
Browse files Browse the repository at this point in the history
  • Loading branch information
w4123 committed Jan 27, 2019
1 parent 930a812 commit 9954197
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 189 deletions.
Binary file modified CQSDK/CQEVE.h
Binary file not shown.
Binary file modified CQSDK/CQEVEBasic.h
Binary file not shown.
2 changes: 1 addition & 1 deletion CQSDK/CQTools.h
@@ -1,5 +1,5 @@
#pragma once
#include <vector>
#include <string>

//base64±àÂë
std::string base64_encode(const std::string& decode_string);
Expand Down
1 change: 1 addition & 0 deletions CQSDK/Unpack.h
@@ -1,5 +1,6 @@
#pragma once
#include <vector>
#include <string>

void show(void* t, int len);

Expand Down
163 changes: 0 additions & 163 deletions CQSDKCPP/CQmsgcode.cpp

This file was deleted.

1 change: 1 addition & 0 deletions CQSDKCPP/Unpack.cpp
Expand Up @@ -3,6 +3,7 @@
#include <iostream>
#include <string>
#include <utility>
#include <cstring>

using namespace std;
//打印内存数据
Expand Down
1 change: 1 addition & 0 deletions Dice/DiceMsgSend.cpp
Expand Up @@ -23,6 +23,7 @@
#include <queue>
#include <mutex>
#include <string>
#include <thread>
#include "CQAPI_EX.h"
#include "DiceMsgSend.h"
#include "GlobalVar.h"
Expand Down
6 changes: 6 additions & 0 deletions Dice/GlobalVar.cpp
Expand Up @@ -40,7 +40,13 @@ const std::string Dice_Ver_Without_Build = "2.3.6";
const std::string DiceRequestHeader = "Dice/" + Dice_Ver_Without_Build;
const std::string Dice_Ver = Dice_Ver_Without_Build + "(" + std::to_string(Dice_Build) + ")";
const std::string Dice_Short_Ver = "Dice! by 溯洄 Version " + Dice_Ver;
#ifdef _MSC_VER
const std::string Dice_Full_Ver = Dice_Short_Ver + " [MSVC " + std::to_string(_MSC_FULL_VER) + " " + __DATE__ + " " + __TIME__ + "]";
#elif defined(__GNUC__)
const std::string Dice_Full_Ver = Dice_Short_Ver + " [GNUC " + std::to_string(__GNUC__) + "." + std::to_string(__GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__) + " " + __DATE__ + " " + __TIME__ + "]";
#else
const std::string Dice_Full_Ver = Dice_Short_Ver + " [UNKNOWN COMPILER]"
#endif

std::map<std::string, std::string> GlobalMsg
{
Expand Down
19 changes: 9 additions & 10 deletions Dice/RD.cpp
Expand Up @@ -23,19 +23,18 @@
#include "CQEVE_ALL.h"
#include "CQTools.h"
#include <cctype>
#include <sstream>
#include "RD.h"
#include "RDConstant.h"
#include "MsgFormat.h"
using namespace std;
using namespace CQ;

inline void init(string& msg)
void init(string& msg)
{
msg_decode(msg);
}

inline void init2(string& msg)
void init2(string& msg)
{
for (int i = 0; i != msg.length(); i++)
{
Expand Down Expand Up @@ -71,7 +70,7 @@ inline void init2(string& msg)
msg[0] = '.';
}

inline void COC7D(string& strMAns)
void COC7D(string& strMAns)
{
RD rd3D6("3D6");
RD rd2D6p6("2D6+6");
Expand Down Expand Up @@ -185,7 +184,7 @@ inline void COC7D(string& strMAns)
strMAns += "\n移动力MOV=" + to_string(MOV);
}

inline void COC6D(string& strMAns)
void COC6D(string& strMAns)
{
RD rd3D6("3D6");
RD rd2D6p6("2D6+6");
Expand Down Expand Up @@ -279,7 +278,7 @@ inline void COC6D(string& strMAns)
strMAns += DB;
}

inline void COC7(string& strMAns, int intNum)
void COC7(string& strMAns, int intNum)
{
strMAns += "的人物作成:";
string strProperty[] = {"力量", "体质", "体型", "敏捷", "外貌", "智力", "意志", "教育", "幸运"};
Expand All @@ -300,7 +299,7 @@ inline void COC7(string& strMAns, int intNum)
}
}

inline void COC6(string& strMAns, int intNum)
void COC6(string& strMAns, int intNum)
{
strMAns += "的人物作成:";
string strProperty[] = {"力量", "体质", "体型", "敏捷", "外貌", "智力", "意志", "教育"};
Expand All @@ -324,7 +323,7 @@ inline void COC6(string& strMAns, int intNum)
}
}

inline void DND(string& strOutput, int intNum)
void DND(string& strOutput, int intNum)
{
strOutput += "的英雄作成:";
RD rdDND("4D6K3");
Expand All @@ -347,7 +346,7 @@ inline void DND(string& strOutput, int intNum)
}
}

inline void TempInsane(string& strAns)
void TempInsane(string& strAns)
{
const int intSymRes = RandomGenerator::Randint(1, 10);
std::string strTI = "1D10=" + to_string(intSymRes) + "\n症状: " + TempInsanity[intSymRes];
Expand All @@ -372,7 +371,7 @@ inline void TempInsane(string& strAns)
strAns += strTI;
}

inline void LongInsane(string& strAns)
void LongInsane(string& strAns)
{
const int intSymRes = RandomGenerator::Randint(1, 10);
std::string strLI = "1D10=" + to_string(intSymRes) + "\n症状: " + LongInsanity[intSymRes];
Expand Down
18 changes: 9 additions & 9 deletions Dice/RD.h
Expand Up @@ -733,13 +733,13 @@ class RD
}
};

extern inline void init(std::string&);
extern inline void init2(std::string&);
extern inline void COC6D(std::string&);
extern inline void COC6(std::string&, int);
extern inline void COC7D(std::string&);
extern inline void COC7(std::string&, int);
extern inline void DND(std::string&, int);
extern inline void LongInsane(std::string&);
extern inline void TempInsane(std::string&);
void init(std::string&);
void init2(std::string&);
void COC6D(std::string&);
void COC6(std::string&, int);
void COC7D(std::string&);
void COC7(std::string&, int);
void DND(std::string&, int);
void LongInsane(std::string&);
void TempInsane(std::string&);
#endif /*DICE_RD*/
3 changes: 0 additions & 3 deletions Dice/RDConstant.h
Expand Up @@ -25,9 +25,6 @@
#define DICE_RD_CONSTANT
#include <string>

#if !defined WIN32
#error 请使用Win32(x86)模式进行编译
#endif
//Error Handle
#define Value_Err (-1)
#define Input_Err (-2)
Expand Down
6 changes: 3 additions & 3 deletions Dice/RandomGenerator.cpp
Expand Up @@ -22,19 +22,19 @@
*/
#include "RandomGenerator.h"
#include <random>
#include <chrono>

namespace RandomGenerator
{
inline unsigned long long GetCycleCount()
{
__asm _emit 0x0F
__asm _emit 0x31
return static_cast<unsigned long long> (std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
}

int Randint(int lowest, int highest)
{
std::mt19937 gen(static_cast<unsigned int>(GetCycleCount()));
const std::uniform_int_distribution<int> dis(lowest, highest);
std::uniform_int_distribution<int> dis(lowest, highest);
return dis(gen);
}
}
Expand Down

0 comments on commit 9954197

Please sign in to comment.