Skip to content

Commit 853d5cf

Browse files
committed
Tiny Misc Cleanups
- Fix some warnings - Do some other random cleanup Shouldn't change any functionality
1 parent 5cf5373 commit 853d5cf

5 files changed

Lines changed: 27 additions & 19 deletions

File tree

asm/patches/make_game_nonlinear.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ skip_setting_pictograph_gallery_flag:
539539
li r3, 3 ; DRC stage ID
540540
bl isStageBossEnemy
541541
; The cloud around DRI normally sets an event bit when it fades away (in the cutscene after warping out of DRC)
542-
; Change this to check for defeating Gohma too
542+
; Change this to check for defeating Gohma instead
543543
.org 0x02387500 ; in daObjRcloud_c::_create
544544
li r3, 3 ; DRC stage ID
545545
bl isStageBossEnemy

gui/desktop/tracker/tracker.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ void MainWindow::initialize_tracker_world(Settings& settings,
6868
trackerInventory.clear();
6969
mappedCharts.clear();
7070

71-
trackerStarted = true;
72-
7371
// Build the world used for the tracker
7472
auto& trackerWorld = trackerWorlds[0];
7573
trackerWorld = World();
@@ -302,8 +300,6 @@ void MainWindow::initialize_tracker_world(Settings& settings,
302300
set_areas_entrances();
303301

304302
// Setup the display of randomized entrances
305-
auto allShuffleableEntrances = trackerWorld.getShuffledEntrances(EntranceType::ALL, false);
306-
307303
int currentPointSize = 12;
308304
for (auto& entrance : shuffledEntrances)
309305
{
@@ -364,6 +360,8 @@ void MainWindow::initialize_tracker_world(Settings& settings,
364360
}
365361
checkBox->blockSignals(false);
366362
}
363+
364+
trackerStarted = true;
367365
}
368366

369367
void MainWindow::on_start_tracker_button_clicked()

logic/LogicTests.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include <vector>
55
#include <filesystem>
66

7-
#include <libs/zlib-ng.hpp>
8-
97
#include <logic/Generate.hpp>
108
#include <seedgen/random.hpp>
119
#include <seedgen/config.hpp>

seedgen/config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ PermalinkError Config::loadPermalink(std::string b64permalink) {
999999
LOG_ERR_AND_RETURN(PermalinkError::INVALID_VERSION);
10001000
}
10011001

1002-
const std::vector<char> bytes(optionsBytes.begin(), optionsBytes.end());
1002+
const std::vector<uint8_t> bytes(optionsBytes.begin(), optionsBytes.end());
10031003
PackedBitsReader bitsReader(bytes);
10041004

10051005
for(const Option& option : PERMALINK_OPTIONS) {
@@ -1048,7 +1048,7 @@ PermalinkError Config::loadPermalink(std::string b64permalink) {
10481048
}
10491049
}
10501050

1051-
if (bitsReader.current_byte_index != bitsReader.bytes.size() - 1) {
1051+
if (!bitsReader.reachedLastByte()) {
10521052
LOG_ERR_AND_RETURN(PermalinkError::INCORRECT_LENGTH);
10531053
}
10541054

@@ -1109,7 +1109,7 @@ std::string Config::getPermalink(const bool& internal /* = false */) const {
11091109

11101110
// Add the packed bits to the permalink
11111111
bitsWriter.flush();
1112-
for (const auto& byte : bitsWriter.bytes) {
1112+
for (const auto& byte : bitsWriter.getBytes()) {
11131113
permalink += byte;
11141114
}
11151115

seedgen/packed_bits.hpp

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
#pragma once
22

3+
#include <cstdint>
4+
#include <vector>
5+
36
// Packed Bits classes copied from the original Wind Waker Randomizer
47
class PackedBitsWriter
58
{
9+
private:
10+
size_t bits_left_in_byte = 8;
11+
uint8_t current_byte = 0;
12+
std::vector<uint8_t> bytes = {};
13+
614
public:
715
PackedBitsWriter() = default;
816
~PackedBitsWriter() = default;
917

10-
uint8_t bits_left_in_byte = 8;
11-
size_t current_byte = 0;
12-
std::vector<char> bytes = {};
13-
1418
template <typename T>
1519
void write(T value, size_t length)
1620
{
@@ -49,17 +53,21 @@ class PackedBitsWriter
4953
bits_left_in_byte = 8;
5054
}
5155

56+
const std::vector<uint8_t>& getBytes() const {
57+
return bytes;
58+
}
5259
};
5360

5461
class PackedBitsReader
5562
{
56-
public:
57-
PackedBitsReader(const std::vector<char>& bytes_) : bytes(bytes_) {}
58-
~PackedBitsReader() = default;
59-
63+
private:
6064
size_t current_bit_index = 0;
6165
size_t current_byte_index = 0;
62-
std::vector<char> bytes = {};
66+
std::vector<uint8_t> bytes = {};
67+
68+
public:
69+
PackedBitsReader(const std::vector<uint8_t>& bytes_) : bytes(bytes_) {}
70+
~PackedBitsReader() = default;
6371

6472
size_t read(size_t length)
6573
{
@@ -103,4 +111,8 @@ class PackedBitsReader
103111

104112
return value;
105113
}
114+
115+
bool reachedLastByte() const {
116+
return current_byte_index == bytes.size() - 1;
117+
}
106118
};

0 commit comments

Comments
 (0)