//.h
std::map<int,MinesSourParam> DigitModlMines,MinesPreStore; //实体
//.cpp
//获取运动模型dll函数
void DigitalMinesNode::InitDLLFunc()
{
std::map<int,MinesSourParam>::iterator it_ = DigitModlMines.begin();
for (;it_ != DigitModlMines.end();++it_)
{
if (it_->second.FuncType == AttackDLL)
{
QString FilePath = QString::fromStdString(it_->second.AttackFilePath);
FilePath = exetopath+"/"+FilePath;
//找到DLL文件
//QLibrary myLib("DigitalMinesDll.dll");
QLibrary myLib(FilePath);
if (myLib.load())
{
//从DLL中找到地雷攻击函数
MinesObjectFun = (MinesFun)myLib.resolve("MinesAttackMoving");
it_->second.AttackMoveFunc = (MinesFun)myLib.resolve("MinesAttackMoving");
if (!MinesObjectFun)
{
qDebug()<<"未找到函数对应";
}
}
else
{
qDebug()<<"未找到DLL文件";
}
MainAttackType = AttackDLL;
}
if (it_->second.FuncType == AttackM)
{
if (pEng == NULL)
{
if (!(pEng = engOpen(NULL)))
{
qDebug()<<"Init Matlab fail";
}
else
{
it_->second.AttackMoveFunc = MatlabAttackMoving;
}
}
MainAttackType = AttackM;
}
}
if (MainAttackType == AttackM)
{
InitMatlabInfo(DigitModlMines);
}
}