mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +03:00
Fix variables shadowing other variables
In C++, when you have two variables in different scopes with the same name, the inner scope wins. Except you have to be really careful because sometimes they're not (#507). So it's better to just always have unique variable names and make sure to never clash a name with a variable in an outer scope - after all, the C++ compiler and standard might be fine with it, but that doesn't mean humans can't make mistakes reading or writing it. Usually I just renamed the inner variables, but for tx/ty in editor.cpp, I just got rid of the ridiculous overcomplicated modulo calculations and replaced them with actual simple modulo calculations, because the existing ones were just ridiculous. Actually, somebody ought to find every instance of the overcomplicated modulos and replace them with the actual good ones, because it's really stupid, quite frankly...
This commit is contained in:
@@ -100,8 +100,8 @@ void musicclass::init()
|
||||
const std::vector<int> extra = musicReadBlob.getExtra();
|
||||
for (size_t i = 0; i < extra.size(); i++)
|
||||
{
|
||||
const int& index = extra[i];
|
||||
rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index));
|
||||
const int& index_ = extra[i];
|
||||
rw = SDL_RWFromMem(musicReadBlob.getAddress(index_), musicReadBlob.getSize(index_));
|
||||
musicTracks.push_back(MusicTrack( rw ));
|
||||
|
||||
num_mmmmmm_tracks++;
|
||||
@@ -123,8 +123,8 @@ void musicclass::init()
|
||||
const std::vector<int> extra = musicReadBlob.getExtra();
|
||||
for (size_t i = 0; i < extra.size(); i++)
|
||||
{
|
||||
const int& index = extra[i];
|
||||
rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index));
|
||||
const int& index_ = extra[i];
|
||||
rw = SDL_RWFromMem(musicReadBlob.getAddress(index_), musicReadBlob.getSize(index_));
|
||||
musicTracks.push_back(MusicTrack( rw ));
|
||||
|
||||
num_pppppp_tracks++;
|
||||
|
||||
Reference in New Issue
Block a user