Fix for issue #1221 (#1230)

* Fix for issue #1221

* Removed object array and implemented GetObjectName method in it's place.

* Fixed indentation issue.

* Fixed white space at end of lines 1571, 1572.
fix-quicksave-sim-speed-crash
Droog71 2020-07-19 04:55:55 -04:00 committed by GitHub
parent 0a3cdd342b
commit d64d78acfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -1565,7 +1565,11 @@ bool CScriptFunctions::rProduce(CBotVar* var, CBotVar* result, int& exception, v
{
power = 1.0f;
}
bool exists = !std::string(GetObjectName(type)).empty(); //The object type exists in object_type.h
if (exists)
{
object = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type, power);
}
if (object == nullptr)
{
result->SetValInt(1); // error