```
class ****** : Container_Base
{
bool CheckFreeLocationTest()
{
array<string> classname_arr = {"AK74", "AKM", "Apple"};
auto inv = this.GetInventory();
if(!inv)
{
return false;
}
auto result = true;
auto arr = new map<EntityAI, InventoryLocation>();
foreach(auto classname: classname_arr)
{
auto tmp_loc = new InventoryLocation();
if(inv.FindFirstFreeLocationForNewEntity(classname, FindInventoryLocationType.CARGO, tmp_loc))
{
result = false;
break;
}
EntityAI tmp_obj = EntityAI.Cast( GetGame().CreateObjectEx(classname, "-1000 0 0", ECE_LOCAL) );
arr.Insert(tmp_obj, tmp_loc);
if(!inv.AddInventoryReservation(tmp_obj, tmp_loc, 10)) // or if(!inv.AddInventoryReservationEx(tmp_obj, tmp_loc, 10))
{
result = false;
break;
}
}
foreach(auto obj, auto loc: arr)
{
//inv.ClearInventoryReservation(obj, loc); //uncomment to fix the timeout bug
obj.Delete();
}
return result;
}
}
```