Skip to content

Commit

Permalink
localized name edb entry
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnTW committed Nov 8, 2024
1 parent 4768183 commit 5a9316c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion M2TWEOP Code/M2TWEOP library/types/battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ namespace battleHelpers
const DWORD offset = reinterpret_cast<DWORD>(perimeters) + 0x48;
battlePos pos{x,y};
const auto posPtr = &pos;
return GAME_FUNC(int(__thiscall*)(DWORD, battlePos*), getZoneID)(offset, posPtr);
return GAME_FUNC(int(__thiscall*)(DWORD, battlePos*), getZoneID)(offset, posPtr) & 0b111;
}

battlePerimeters* getBattlePerimeters()
Expand Down
2 changes: 2 additions & 0 deletions M2TWEOP Code/M2TWEOP library/types/eopBuildings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ namespace buildingHelpers
Basic edbEntry table.
@tfield int buildingID
@tfield string localizedName
@tfield int classification
@tfield int isCoreBuilding
@tfield int isPort
Expand All @@ -673,6 +674,7 @@ namespace buildingHelpers
types.edbEntry.set("religionID", &edbEntry::religionID);
types.edbEntry.set("isHinterland", &edbEntry::isHinterland);
types.edbEntry.set("isFarm", &edbEntry::isFarm);
types.edbEntry.set("localizedName", sol::property(&edbEntry::getLocalizedName, &edbEntry::setLocalizedName));
types.edbEntry.set("buildingLevelCount", &edbEntry::buildingLevelCount);

/***
Expand Down
12 changes: 11 additions & 1 deletion M2TWEOP Code/M2TWEOP library/types/eopBuildings.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ struct edbEntry { /* SETTLEMENT_CONDITION_SETTLEMENT_FACTION */
int8_t isHinterland; //0x0068
int8_t isFarm; //0x0069
char pad_006A[2]; //0x006A
UNICODE_STRING** localizedName;
UNICODE_STRING*** localizedName;
gameStdVector<stringWithHash> converts;
char* type; /* type of building (core_building,barracks) */
int typeHash;
Expand All @@ -355,6 +355,16 @@ struct edbEntry { /* SETTLEMENT_CONDITION_SETTLEMENT_FACTION */
return nullptr;
return &levels[index];
}
std::string getLocalizedName()
{
return gameStringHelpers::uniStringToStr(*localizedName);
}
void setLocalizedName(const std::string& newName)
{
const auto nameMem = techFuncs::createGameClass<UNICODE_STRING**>();
localizedName = nameMem;
gameStringHelpers::createUniString(*localizedName, newName.c_str());
}
};

struct hiddenResource
Expand Down

0 comments on commit 5a9316c

Please sign in to comment.