mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-01 19:04:48 +00:00
refactor: expand AUTO_VAR macro
This commit is contained in:
@@ -231,7 +231,7 @@ std::shared_ptr<Entity> EntityIO::newEntity(const std::wstring& id,
|
||||
Level* level) {
|
||||
std::shared_ptr<Entity> entity;
|
||||
|
||||
AUTO_VAR(it, idCreateMap->find(id));
|
||||
auto it = idCreateMap->find(id);
|
||||
if (it != idCreateMap->end()) {
|
||||
entityCreateFn create = it->second;
|
||||
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
|
||||
@@ -265,7 +265,7 @@ std::shared_ptr<Entity> EntityIO::loadStatic(CompoundTag* tag, Level* level) {
|
||||
tag->remove(L"Type");
|
||||
}
|
||||
|
||||
AUTO_VAR(it, idCreateMap->find(tag->getString(L"id")));
|
||||
auto it = idCreateMap->find(tag->getString(L"id"));
|
||||
if (it != idCreateMap->end()) {
|
||||
entityCreateFn create = it->second;
|
||||
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
|
||||
@@ -289,7 +289,7 @@ std::shared_ptr<Entity> EntityIO::loadStatic(CompoundTag* tag, Level* level) {
|
||||
std::shared_ptr<Entity> EntityIO::newById(int id, Level* level) {
|
||||
std::shared_ptr<Entity> entity;
|
||||
|
||||
AUTO_VAR(it, numCreateMap->find(id));
|
||||
auto it = numCreateMap->find(id);
|
||||
if (it != numCreateMap->end()) {
|
||||
entityCreateFn create = it->second;
|
||||
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
|
||||
@@ -314,7 +314,7 @@ std::shared_ptr<Entity> EntityIO::newByEnumType(eINSTANCEOF eType,
|
||||
eINSTANCEOFKeyEq>::iterator it =
|
||||
classNumMap->find(eType);
|
||||
if (it != classNumMap->end()) {
|
||||
AUTO_VAR(it2, numCreateMap->find(it->second));
|
||||
auto it2 = numCreateMap->find(it->second);
|
||||
if (it2 != numCreateMap->end()) {
|
||||
entityCreateFn create = it2->second;
|
||||
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
|
||||
@@ -346,7 +346,7 @@ std::wstring EntityIO::getEncodeId(std::shared_ptr<Entity> entity) {
|
||||
}
|
||||
|
||||
int EntityIO::getId(const std::wstring& encodeId) {
|
||||
AUTO_VAR(it, idNumMap->find(encodeId));
|
||||
auto it = idNumMap->find(encodeId);
|
||||
if (it == idNumMap->end()) {
|
||||
// defaults to pig...
|
||||
return 90;
|
||||
@@ -361,7 +361,7 @@ std::wstring EntityIO::getEncodeId(int entityIoValue) {
|
||||
// return classIdMap.get(class1);
|
||||
// }
|
||||
|
||||
AUTO_VAR(it, numClassMap->find(entityIoValue));
|
||||
auto it = numClassMap->find(entityIoValue);
|
||||
if (it != numClassMap->end()) {
|
||||
std::unordered_map<eINSTANCEOF, std::wstring, eINSTANCEOFKeyHash,
|
||||
eINSTANCEOFKeyEq>::iterator classIdIt =
|
||||
@@ -378,7 +378,7 @@ std::wstring EntityIO::getEncodeId(int entityIoValue) {
|
||||
int EntityIO::getNameId(int entityIoValue) {
|
||||
int id = -1;
|
||||
|
||||
AUTO_VAR(it, idsSpawnableInCreative.find(entityIoValue));
|
||||
auto it = idsSpawnableInCreative.find(entityIoValue);
|
||||
if (it != idsSpawnableInCreative.end()) {
|
||||
id = it->second->nameId;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ int EntityIO::getNameId(int entityIoValue) {
|
||||
}
|
||||
|
||||
eINSTANCEOF EntityIO::getType(const std::wstring& idString) {
|
||||
AUTO_VAR(it, numClassMap->find(getId(idString)));
|
||||
auto it = numClassMap->find(getId(idString));
|
||||
if (it != numClassMap->end()) {
|
||||
return it->second;
|
||||
}
|
||||
@@ -395,7 +395,7 @@ eINSTANCEOF EntityIO::getType(const std::wstring& idString) {
|
||||
}
|
||||
|
||||
eINSTANCEOF EntityIO::getClass(int id) {
|
||||
AUTO_VAR(it, numClassMap->find(id));
|
||||
auto it = numClassMap->find(id);
|
||||
if (it != numClassMap->end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user