File diff r27368:4f131cee1b81 → r27369:d93808e810cd
src/ai/ai_info.cpp
Show inline comments
 
@@ -69,20 +69,20 @@ template <> const char *GetClassName<AII
 
	SQInteger res = ScriptInfo::Constructor(vm, info);
 
	if (res != 0) return res;
 

	
 
	if (info->engine->MethodExists(*info->SQ_instance, "MinVersionToLoad")) {
 
		if (!info->engine->CallIntegerMethod(*info->SQ_instance, "MinVersionToLoad", &info->min_loadable_version, MAX_GET_OPS)) return SQ_ERROR;
 
	if (info->engine->MethodExists(info->SQ_instance, "MinVersionToLoad")) {
 
		if (!info->engine->CallIntegerMethod(info->SQ_instance, "MinVersionToLoad", &info->min_loadable_version, MAX_GET_OPS)) return SQ_ERROR;
 
	} else {
 
		info->min_loadable_version = info->GetVersion();
 
	}
 
	/* When there is an UseAsRandomAI function, call it. */
 
	if (info->engine->MethodExists(*info->SQ_instance, "UseAsRandomAI")) {
 
		if (!info->engine->CallBoolMethod(*info->SQ_instance, "UseAsRandomAI", &info->use_as_random, MAX_GET_OPS)) return SQ_ERROR;
 
	if (info->engine->MethodExists(info->SQ_instance, "UseAsRandomAI")) {
 
		if (!info->engine->CallBoolMethod(info->SQ_instance, "UseAsRandomAI", &info->use_as_random, MAX_GET_OPS)) return SQ_ERROR;
 
	} else {
 
		info->use_as_random = true;
 
	}
 
	/* Try to get the API version the AI is written for. */
 
	if (info->engine->MethodExists(*info->SQ_instance, "GetAPIVersion")) {
 
		if (!info->engine->CallStringMethod(*info->SQ_instance, "GetAPIVersion", &info->api_version, MAX_GET_OPS)) return SQ_ERROR;
 
	if (info->engine->MethodExists(info->SQ_instance, "GetAPIVersion")) {
 
		if (!info->engine->CallStringMethod(info->SQ_instance, "GetAPIVersion", &info->api_version, MAX_GET_OPS)) return SQ_ERROR;
 
		if (!CheckAPIVersion(info->api_version)) {
 
			Debug(script, 1, "Loading info.nut from ({}.{}): GetAPIVersion returned invalid version", info->GetName(), info->GetVersion());
 
			return SQ_ERROR;
 
@@ -149,7 +149,7 @@ bool AIInfo::CanLoadFromVersion(int vers
 
	}
 

	
 
	/* Cache the category */
 
	if (!library->CheckMethod("GetCategory") || !library->engine->CallStringMethod(*library->SQ_instance, "GetCategory", &library->category, MAX_GET_OPS)) {
 
	if (!library->CheckMethod("GetCategory") || !library->engine->CallStringMethod(library->SQ_instance, "GetCategory", &library->category, MAX_GET_OPS)) {
 
		delete library;
 
		return SQ_ERROR;
 
	}