Skip to content

Commit

Permalink
Rename variables to avoid shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
LegalizeAdulthood committed Feb 18, 2024
1 parent e5ba839 commit 60351b4
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 46 deletions.
8 changes: 4 additions & 4 deletions common/framain2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2815,11 +2815,11 @@ static void restore_history_info(int i)
std::memcpy(g_old_dac_box, last.dac_box, 256*3);
if (g_map_specified)
{
for (int i = 0; i < 256; ++i)
for (int j = 0; j < 256; ++j)
{
g_map_clut[i][0] = last.dac_box[i][0];
g_map_clut[i][1] = last.dac_box[i][1];
g_map_clut[i][2] = last.dac_box[i][2];
g_map_clut[j][0] = last.dac_box[j][0];
g_map_clut[j][1] = last.dac_box[j][1];
g_map_clut[j][2] = last.dac_box[j][2];
}
}
spindac(0, 1);
Expand Down
12 changes: 6 additions & 6 deletions common/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ static std::vector<HIST> hist; // 6*MAX_HIST (96 bytes)

// these items alloc'ed only while help is active...

static std::vector<char> buffer; // MAX_PAGE_SIZE (2048 bytes)
static std::vector<LINK> link_table; // 10*max_links
static std::vector<PAGE> page_table; // 4*max_pages
static std::vector<char> g_buffer; // MAX_PAGE_SIZE (2048 bytes)
static std::vector<LINK> link_table; // 10*max_links
static std::vector<PAGE> page_table; // 4*max_pages

static void help_seek(long pos)
{
Expand Down Expand Up @@ -640,10 +640,10 @@ static int help_topic(HIST *curr, HIST *next, int flags)
if (draw_page)
{
help_seek(where+page_table[page].offset);
freader(&buffer[0], sizeof(char), page_table[page].len, help_file);
freader(&g_buffer[0], sizeof(char), page_table[page].len, help_file);

num_link = 0;
display_page(title, &buffer[0], page_table[page].len, page, num_pages,
display_page(title, &g_buffer[0], page_table[page].len, page, num_pages,
page_table[page].margin, &num_link, &link_table[0]);

if (draw_page == 2)
Expand Down Expand Up @@ -814,7 +814,7 @@ int help(int action)
bool resized = false;
try
{
buffer.resize(MAX_PAGE_SIZE);
g_buffer.resize(MAX_PAGE_SIZE);
link_table.resize(max_links);
page_table.resize(max_pages);
resized = true;
Expand Down
4 changes: 2 additions & 2 deletions common/intro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ void intro()
driver_set_attr(3, 0, C_PRIMARY, 80*(END_MAIN_AUTHOR-3));
driver_set_attr(23, 0, C_TITLE_LOW, 160);

for (int i = 3; i < END_MAIN_AUTHOR; ++i)
for (int k = 3; k < END_MAIN_AUTHOR; ++k)
{
driver_set_attr(i, 21, C_CONTRIB, 58);
driver_set_attr(k, 21, C_CONTRIB, 58);
}
driver_set_attr(toprow, 0, C_CONTRIB, (21-END_MAIN_AUTHOR)*80);
srand((unsigned int)std::clock());
Expand Down
8 changes: 4 additions & 4 deletions common/loadfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ int read_overlay() // read overlay/3D files, if reqr'd

g_show_file = 1; // for any abort exit, pretend done
g_init_mode = -1; // no viewing mode set yet
bool oldfloatflag = g_user_float_flag;
const bool old_float_flag = g_user_float_flag;
g_loaded_3d = false;
if (g_fast_restore)
{
Expand Down Expand Up @@ -488,7 +488,7 @@ int read_overlay() // read overlay/3D files, if reqr'd

if (g_display_3d != display_3d_modes::NONE)
{
g_user_float_flag = oldfloatflag;
g_user_float_flag = old_float_flag;
}

if (g_overlay_3d)
Expand All @@ -504,15 +504,15 @@ int read_overlay() // read overlay/3D files, if reqr'd
else
{
display_3d_modes const old_display_ed = g_display_3d;
bool const oldfloatflag = g_float_flag;
bool const old_float_flag2 = g_float_flag;
g_display_3d = g_loaded_3d ? display_3d_modes::YES : display_3d_modes::NONE; // for <tab> display during next
g_float_flag = g_user_float_flag; // ditto
int i = get_video_mode(&read_info, &blk_3_info);
#if defined(_WIN32)
_ASSERTE(_CrtCheckMemory());
#endif
g_display_3d = old_display_ed;
g_float_flag = oldfloatflag;
g_float_flag = old_float_flag2;
if (i)
{
if (blk_2_info.got_data)
Expand Down
30 changes: 15 additions & 15 deletions common/lorenz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ static double initorbitfp[3];
static char NoQueue[] =
"Not enough memory: switching to random walk.\n";

static int mxhits;
static int run_length;
Major g_major_method;
Minor g_inverse_julia_minor_method;
static affine cvt;
static int mxhits;
static int run_length;
Major g_major_method;
Minor g_inverse_julia_minor_method;
static affine s_cvt;
static l_affine lcvt;

static double Cx;
Expand Down Expand Up @@ -378,15 +378,15 @@ bool orbit3dlongsetup()
}
g_params[2] = mxhits;

setup_convert_to_screen(&cvt);
setup_convert_to_screen(&s_cvt);
// Note: using bitshift of 21 for affine, 24 otherwise

lcvt.a = (long)(cvt.a * (1L << 21));
lcvt.b = (long)(cvt.b * (1L << 21));
lcvt.c = (long)(cvt.c * (1L << 21));
lcvt.d = (long)(cvt.d * (1L << 21));
lcvt.e = (long)(cvt.e * (1L << 21));
lcvt.f = (long)(cvt.f * (1L << 21));
lcvt.a = (long)(s_cvt.a * (1L << 21));
lcvt.b = (long)(s_cvt.b * (1L << 21));
lcvt.c = (long)(s_cvt.c * (1L << 21));
lcvt.d = (long)(s_cvt.d * (1L << 21));
lcvt.e = (long)(s_cvt.e * (1L << 21));
lcvt.f = (long)(s_cvt.f * (1L << 21));

Sqrt = ComplexSqrtLong(g_fudge_factor - 4 * CxLong, -4 * CyLong);

Expand Down Expand Up @@ -588,7 +588,7 @@ bool orbit3dfloatsetup()
}
g_params[2] = mxhits;

setup_convert_to_screen(&cvt);
setup_convert_to_screen(&s_cvt);

// find fixed points: guaranteed to be in the set
Sqrt = ComplexSqrtFloat(1 - 4 * Cx, -4 * Cy);
Expand Down Expand Up @@ -696,8 +696,8 @@ int Minverse_julia_orbit()
/*
* Next, find its pixel position
*/
newcol = (int)(cvt.a * g_new_z.x + cvt.b * g_new_z.y + cvt.e);
newrow = (int)(cvt.c * g_new_z.x + cvt.d * g_new_z.y + cvt.f);
newcol = (int)(s_cvt.a * g_new_z.x + s_cvt.b * g_new_z.y + s_cvt.e);
newrow = (int)(s_cvt.c * g_new_z.x + s_cvt.d * g_new_z.y + s_cvt.f);

/*
* Now find the next point(s), and flip a coin to choose one.
Expand Down
30 changes: 15 additions & 15 deletions common/miscfrac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@ int lyapunov_cycles_in_c(long filter_cycles, double a, double b)

static std::vector<BYTE> cell_array[2];

S16 r, k_1, rule_digits;
static S16 s_r, k_1, rule_digits;
bool lstscreenflag = false;

void abort_cellular(int err, int t)
Expand Down Expand Up @@ -1811,10 +1811,10 @@ int cellular()
return -1;
}

r = (S16)(kr % 10); // Number of nearest neighbors to sum
s_r = (S16)(kr % 10); // Number of nearest neighbors to sum
k = (U16)(kr / 10); // Number of different states, k=3 has states 0,1,2
k_1 = (S16)(k - 1); // Highest state value, k=3 has highest state value of 2
rule_digits = (S16)((r * 2 + 1) * k_1 + 1); // Number of digits in the rule
rule_digits = (S16)((s_r * 2 + 1) * k_1 + 1); // Number of digits in the rule

if (!g_random_seed_flag && randparam == -1)
{
Expand Down Expand Up @@ -1980,7 +1980,7 @@ int cellular()
if (g_random_seed_flag || randparam == 0 || randparam == -1)
{
// Use a random border
for (int i = 0; i <= r; i++)
for (int i = 0; i <= s_r; i++)
{
cell_array[notfilled][i] = (BYTE)(rand()%(int)k);
cell_array[notfilled][g_i_x_stop-i] = (BYTE)(rand()%(int)k);
Expand All @@ -1989,15 +1989,15 @@ int cellular()
else
{
// Use a zero border
for (int i = 0; i <= r; i++)
for (int i = 0; i <= s_r; i++)
{
cell_array[notfilled][i] = 0;
cell_array[notfilled][g_i_x_stop-i] = 0;
}
}

t = 0; // do first cell
twor = (U16)(r+r);
twor = (U16)(s_r+s_r);
for (int i = 0; i <= twor; i++)
{
t = (S16)(t + (S16)cell_array[filled][i]);
Expand All @@ -2008,13 +2008,13 @@ int cellular()
abort_cellular(BAD_T, t);
return -1;
}
cell_array[notfilled][r] = (BYTE)cell_table[t];
cell_array[notfilled][s_r] = (BYTE)cell_table[t];

// use a rolling sum in t
for (g_col = r+1; g_col < g_i_x_stop-r; g_col++)
for (g_col = s_r+1; g_col < g_i_x_stop-s_r; g_col++)
{
// now do the rest
t = (S16)(t + cell_array[filled][g_col+r] - cell_array[filled][g_col-r-1]);
t = (S16)(t + cell_array[filled][g_col+s_r] - cell_array[filled][g_col-s_r-1]);
if (t > rule_digits || t < 0)
{
thinking(0, nullptr);
Expand Down Expand Up @@ -2045,7 +2045,7 @@ int cellular()
if (g_random_seed_flag || randparam == 0 || randparam == -1)
{
// Use a random border
for (int i = 0; i <= r; i++)
for (int i = 0; i <= s_r; i++)
{
cell_array[notfilled][i] = (BYTE)(rand()%(int)k);
cell_array[notfilled][g_i_x_stop-i] = (BYTE)(rand()%(int)k);
Expand All @@ -2054,15 +2054,15 @@ int cellular()
else
{
// Use a zero border
for (int i = 0; i <= r; i++)
for (int i = 0; i <= s_r; i++)
{
cell_array[notfilled][i] = 0;
cell_array[notfilled][g_i_x_stop-i] = 0;
}
}

t = 0; // do first cell
twor = (U16)(r+r);
twor = (U16)(s_r+s_r);
for (int i = 0; i <= twor; i++)
{
t = (S16)(t + (S16)cell_array[filled][i]);
Expand All @@ -2073,13 +2073,13 @@ int cellular()
abort_cellular(BAD_T, t);
return -1;
}
cell_array[notfilled][r] = (BYTE)cell_table[t];
cell_array[notfilled][s_r] = (BYTE)cell_table[t];

// use a rolling sum in t
for (g_col = r+1; g_col < g_i_x_stop-r; g_col++)
for (g_col = s_r+1; g_col < g_i_x_stop-s_r; g_col++)
{
// now do the rest
t = (S16)(t + cell_array[filled][g_col+r] - cell_array[filled][g_col-r-1]);
t = (S16)(t + cell_array[filled][g_col+s_r] - cell_array[filled][g_col-s_r-1]);
if (t > rule_digits || t < 0)
{
thinking(0, nullptr);
Expand Down

0 comments on commit 60351b4

Please sign in to comment.