Skip to content

Commit

Permalink
some IntrelliSense warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Aug 25, 2023
1 parent b5b39c3 commit c3c6f8e
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 13 deletions.
5 changes: 2 additions & 3 deletions src/game_api/file_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ std::string hash_path(std::string_view path)
int i = 0;
do
{
uint64_t merge = std::toupper(abs_path_str[i]) * 65536 + std::toupper(abs_path_str[i + 1]);
uint64_t merge = (uint64_t)std::toupper(abs_path_str[i]) * 65536 + (uint64_t)std::toupper(abs_path_str[i + 1]);
res = res * 8191 + merge;
i++;
} while (i < abs_path_str.length());
Expand Down Expand Up @@ -260,13 +260,12 @@ FileInfo* load_file_as_dds_if_image(const char* file_path, AllocFun alloc_fun)
{
fwrite(file_info->Data, sizeof(char), file_info->DataSize, cache_file);
DEBUG("Cached '{}' to '{}'", path, cache_path.string());
fclose(cache_file);
}
else
{
DEBUG("Couldn't cache '{}' to '{}'", path, cache_path.string());
}
fclose(cache_file);

return file_info;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game_api/level_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ std::uint32_t LevelGenData::define_tile_code(std::string tile_code)

std::optional<uint8_t> LevelGenData::get_short_tile_code(ShortTileCodeDef short_tile_code_def)
{
for (auto [i, def] : short_tile_codes)
for (auto& [i, def] : short_tile_codes)
{
if (def == short_tile_code_def)
{
Expand Down
2 changes: 1 addition & 1 deletion src/game_api/render_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ void on_open_journal_chapter(JournalUI* journal_ui, uint8_t chapter, bool instan
}
side ^= 0x1;
}
for (auto p : pages_copy) // free unused screens
for (auto& p : pages_copy) // free unused screens
{
if (p.second)
{
Expand Down
2 changes: 1 addition & 1 deletion src/game_api/script/lua_vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2473,7 +2473,7 @@ end
//, "", ...check__[game_settings.txt]\[game_data/game_settings.txt\]...
//, "CROSSPROGRESS_AUTOSYNC", 47
);
for (auto [setting_name_view, setting_index] : get_settings_names_and_indices())
for (auto& [setting_name_view, setting_index] : get_settings_names_and_indices())
{
std::string setting_name{setting_name_view};
std::transform(setting_name.begin(), setting_name.end(), setting_name.begin(), [](unsigned char c)
Expand Down
2 changes: 1 addition & 1 deletion src/game_api/script/usertypes/entity_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void register_usertypes(sol::state& lua)
auto name = item.name.substr(9, item.name.size());
lua["ENT_TYPE"][name] = item.id;
}
for (auto elm : get_custom_types_map())
for (auto& elm : get_custom_types_map())
{
lua["ENT_TYPE"][elm.second] = elm.first;
}
Expand Down
4 changes: 2 additions & 2 deletions src/game_api/script/usertypes/gui_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void GuiDrawContext::draw_poly(std::vector<Vec2> points, float thickness, uColor
auto draw = [&](ImDrawList* dl)
{
dl->PathClear();
for (auto point : points)
for (auto& point : points)
{
ImVec2 a = screenify_fix({point.x, point.y});
dl->PathLineToMergeDuplicate(a);
Expand All @@ -170,7 +170,7 @@ void GuiDrawContext::draw_poly_filled(std::vector<Vec2> points, uColor color)
auto draw = [&](ImDrawList* dl)
{
dl->PathClear();
for (auto point : points)
for (auto& point : points)
{
ImVec2 a = screenify_fix({point.x, point.y});
dl->PathLineToMergeDuplicate(a);
Expand Down
4 changes: 2 additions & 2 deletions src/game_api/script/usertypes/vanilla_render_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void VanillaRenderContext::draw_screen_poly(std::vector<Vec2> points, float thic
if (!corner.is_null())
draw_screen_poly_filled(convert_ratio(corner, true), std::move(color));
}
for (auto line : draw_list)
for (auto& line : draw_list)
{
draw_screen_poly_filled(convert_ratio(line, true), std::move(color));
}
Expand Down Expand Up @@ -533,7 +533,7 @@ void VanillaRenderContext::draw_world_poly(std::vector<Vec2> points, float thick
if (!corner.is_null())
draw_world_poly_filled(corner, std::move(color));
}
for (auto line : draw_list)
for (auto& line : draw_list)
{
draw_world_poly_filled(line, std::move(color));
}
Expand Down
2 changes: 1 addition & 1 deletion src/game_api/string_hashes.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// THIS FILE IS AUTO-GENERATED
// If you need to make changes it please change strings_get_hashes.py
// If you need to make changes to it, please change "strings_get_hashes.py"

#include <cstdint> // for uint32_t
#include <functional> // for less
Expand Down
2 changes: 1 addition & 1 deletion src/game_api/strings_get_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
print(
"""
// THIS FILE IS AUTO-GENERATED
// If you need to make changes it please change strings_get_hashes.py
// If you need to make changes to it, please change "strings_get_hashes.py"
#include <cstdint> // for uint32_t
#include <functional> // for less
Expand Down

0 comments on commit c3c6f8e

Please sign in to comment.