New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Repositories] Add more precise types to repository generator #2391
Conversation
I'd regenerate all repos with these changes and we need to go through testing |
Regenerated all base repos |
Build fail
|
This will have a lot of ramifications for creating more explicit types - the code will need to be worked through to accommodate the more explicit types. Anytime we make changes to the base repository generator we should be regenning all of the base repositories. |
diff --git a/common/shared_tasks.cpp b/common/shared_tasks.cpp
index 894f9c280..d9cb1d4d3 100644
--- a/common/shared_tasks.cpp
+++ b/common/shared_tasks.cpp
@@ -92,8 +92,8 @@ SharedTaskRequest SharedTask::GetRequestCharacters(Database &db, uint32_t reques
request.members.reserve(characters.size());
for (const auto& character: characters)
{
- request.lowest_level = std::min(request.lowest_level, character.level);
- request.highest_level = std::max(request.highest_level, character.level);
+ request.lowest_level = std::min(request.lowest_level, static_cast<int32_t>(character.level));
+ request.highest_level = std::max(request.highest_level, static_cast<int32_t>(character.level));
request.character_ids.emplace_back(character.id); // convenience
SharedTaskMember member = {};
diff --git a/common/tasks.h b/common/tasks.h
index 62f537668..9f8f5684a 100644
--- a/common/tasks.h
+++ b/common/tasks.h
@@ -368,7 +368,7 @@ namespace Tasks {
if (activity_states[i].activity_state != ActivityCompleted)
{
completed_ids[i] = false;
- current_step = std::min(current_step, el.step);
+ current_step = std::min(current_step, static_cast<int>(el.step));
if (!el.optional)
{
result.is_task_complete = false;
diff --git a/world/shared_task_manager.cpp b/world/shared_task_manager.cpp
index 4ea3866a7..e4ef008cf 100644
--- a/world/shared_task_manager.cpp
+++ b/world/shared_task_manager.cpp
@@ -1460,8 +1460,8 @@ bool SharedTaskManager::CanAddPlayer(SharedTask *s, uint32_t character_id, std::
int highest_level = cle->level();
for (const auto &character : characters) {
- lowest_level = std::min(lowest_level, character.level);
- highest_level = std::max(highest_level, character.level);
+ lowest_level = std::min(lowest_level, static_cast<int32_t>(character.level));
+ highest_level = std::max(highest_level, static_cast<int32_t>(character.level));
}
if ((highest_level - lowest_level) > s->GetTaskData().level_spread) { So I figured I would get it compiling cleanly via casts just to see how many issues have appeared. These are the immediate blockers at least. I would think changing Either way, I think @hgtw might want to comment |
I have no issue with either changing I guess for levels it'd be easier to just change the local request variables to uint32_t to match signs in character_data, though realistically int will hold all player levels. I don't really have an issue with either choice |
I'm aware there is still 1 more issue to solve for this, I just haven't gotten around to it. |
ccef6e4
to
e90bc6a
Compare
datatypes This adds support for unsigned and more integer types. It also avoids using parsing functions that require casting (still needed in some cases) Having the data types in the Repository structs better map to the types in the database will allow us to avoid casting when we pull data out of them. And as a benefit, assume something is wrong if we do :) Hopefully clean up some warnings due to casting too.
With default clang warning settings these were rather noisy, so let's use the new script for them already.
We may decide to change this at a later date depending if we change the character table. World usage I think it makes sense for CLE to have uint8_t, but we'll still cast for now
e90bc6a
to
a2d5c49
Compare
* Make utils/scripts/generators/repository-generator.pl aware of more datatypes This adds support for unsigned and more integer types. It also avoids using parsing functions that require casting (still needed in some cases) Having the data types in the Repository structs better map to the types in the database will allow us to avoid casting when we pull data out of them. And as a benefit, assume something is wrong if we do :) Hopefully clean up some warnings due to casting too. Co-authored-by: Akkadius <akkadius1@gmail.com>
…2391) * Make utils/scripts/generators/repository-generator.pl aware of more datatypes This adds support for unsigned and more integer types. It also avoids using parsing functions that require casting (still needed in some cases) Having the data types in the Repository structs better map to the types in the database will allow us to avoid casting when we pull data out of them. And as a benefit, assume something is wrong if we do :) Hopefully clean up some warnings due to casting too. Co-authored-by: Akkadius <akkadius1@gmail.com>
datatypes
This adds support for unsigned and more integer types. It also avoids
using parsing functions that require casting (still needed in some
cases)
Having the data types in the Repository structs better map to the types
in the database will allow us to avoid casting when we pull data out of
them. And as a benefit, assume something is wrong if we do :)
Hopefully clean up some warnings due to casting too.