| 227 | } |
| 228 | |
| 229 | JSValue ScObjectManager::getAllObjects(JSContext* ctx, JSValue thisVal, int argc, JSValue* argv) |
| 230 | { |
| 231 | JS_UNPACK_STR(typez, ctx, argv[0]); |
| 232 | |
| 233 | auto& objManager = GetContext()->GetObjectManager(); |
| 234 | auto type = objectTypeFromString(typez); |
| 235 | |
| 236 | if (type != ObjectType::none) |
| 237 | { |
| 238 | JSValue result = JS_NewArray(ctx); |
| 239 | size_t count = getObjectEntryGroupCount(type); |
| 240 | int64_t resultIndex = 0; |
| 241 | for (size_t i = 0; i < count; i++) |
| 242 | { |
| 243 | auto obj = objManager.GetLoadedObject(type, i); |
| 244 | if (obj != nullptr) |
| 245 | { |
| 246 | JSValue scObj = CreateScObject(ctx, type, static_cast<int32_t>(i)); |
| 247 | JS_SetPropertyInt64(ctx, result, resultIndex++, scObj); |
| 248 | } |
| 249 | } |
| 250 | return result; |
| 251 | } |
| 252 | return JS_ThrowPlainError(ctx, "Invalid object type."); |
| 253 | } |
| 254 | |
| 255 | void ScObjectManager::MarkAsResearched(const Object* object) |
| 256 | { |
nothing calls this directly
no test coverage detected