Completed transition to weapons handler

This commit is contained in:
Pax1601
2023-07-27 19:21:34 +02:00
parent 6d434e48a1
commit 80ed675cbc
6 changed files with 20 additions and 24 deletions

View File

@@ -115,7 +115,7 @@ extern "C" DllExport int coreUnitsData(lua_State * L)
return(0);
}
extern "C" DllExport int coreWeaponssData(lua_State * L)
extern "C" DllExport int coreWeaponsData(lua_State * L)
{
if (!initialized)
return (0);

View File

@@ -72,7 +72,7 @@ void Unit::update(json::value json, double dt)
if (json.has_boolean_field(L"isAlive"))
setAlive(json[L"isAlive"].as_bool());
if (json.has_object_field(L"isHuman"))
if (json.has_boolean_field(L"isHuman"))
setHuman(json[L"isHuman"].as_bool());
if (json.has_number_field(L"fuel")) {
@@ -109,7 +109,7 @@ void Unit::update(json::value json, double dt)
contactItem.ID = contactJson[L"object"][L"id_"].as_number().to_uint32();
string detectionMethod = to_string(contactJson[L"detectionMethod"]);
if (detectionMethod.compare("VISUAL") == 0) contactItem.detectionMethod = 1;
if (detectionMethod.compare("VISUAL") == 0) contactItem.detectionMethod = 1;
else if (detectionMethod.compare("OPTIC") == 0) contactItem.detectionMethod = 2;
else if (detectionMethod.compare("RADAR") == 0) contactItem.detectionMethod = 4;
else if (detectionMethod.compare("IRST") == 0) contactItem.detectionMethod = 8;

View File

@@ -110,10 +110,6 @@ void UnitsManager::update(json::value& json, double dt)
units[ID] = dynamic_cast<Unit*>(new GroundUnit(p.second, ID));
else if (category.compare("NavyUnit") == 0)
units[ID] = dynamic_cast<Unit*>(new NavyUnit(p.second, ID));
else if (category.compare("Missile") == 0)
units[ID] = dynamic_cast<Unit*>(new Missile(p.second, ID));
else if (category.compare("Bomb") == 0)
units[ID] = dynamic_cast<Unit*>(new Bomb(p.second, ID));
/* Initialize the unit if creation was successfull */
if (units.count(ID) != 0) {

View File

@@ -69,21 +69,21 @@ static int onSimulationStart(lua_State* L)
goto error;
}
coreUnitsData = (f_coreFrame)GetProcAddress(hGetProcIDDLL, "coreUnitsData");
coreUnitsData = (f_coreUnitsData)GetProcAddress(hGetProcIDDLL, "coreUnitsData");
if (!coreUnitsData)
{
LogError(L, "Error getting coreUnitsData ProcAddress from DLL");
goto error;
}
coreWeaponsData = (f_coreFrame)GetProcAddress(hGetProcIDDLL, "coreWeaponsData");
coreWeaponsData = (f_coreWeaponsData)GetProcAddress(hGetProcIDDLL, "coreWeaponsData");
if (!coreWeaponsData)
{
LogError(L, "Error getting coreWeaponsData ProcAddress from DLL");
goto error;
}
coreMissionData = (f_coreFrame)GetProcAddress(hGetProcIDDLL, "coreMissionData");
coreMissionData = (f_coreMissionData)GetProcAddress(hGetProcIDDLL, "coreMissionData");
if (!coreMissionData)
{
LogError(L, "Error getting coreMissionData ProcAddress from DLL");