Oops! This one is in the category, 'i should have documented that'.
I must have gotten this from your code somewhere, no way i wrote all that myself.
Getbound 10, 7, 2, 11 or 3 and bn[bounds] are called.
Can you make something of it?
Else we could make simple test cases and discuss them.
int __fastcall Getalmuten(double lon, char bounds, char sect, char trip, int *res)
{
int alm[7] = {0}, ndx[7], bn[] = {0, 1, 4, 6}, n;
n = Getbound(10, lon, 0); // ruler
alm[n] += 5;
n = Getbound(7, lon, 0); // exaltations
if (n > -1)
alm[n] += 4;
n = Getbound(bn[bounds], lon, sect); // bounds
alm[n] += 2;
if (trip == 2)
{
char fireTrip[3] = { SUN, JUPITER, SATURN }, earthTrip[3] = { VENUS, MOON, MARS },
airTrip[3] = { SATURN, MERCURY, JUPITER }, waterTrip[3] = { VENUS, MARS, MOON },
el = ((int)(lon / 30)) % 4;
for (int i = 0; i < 3; i++)
switch (el)
{
case 0: alm[fireTrip[i]] += 3; break;
case 1: alm[earthTrip[i]] += 3; break;
case 2: alm[airTrip[i]] += 3; break;
case 3: alm[waterTrip[i]] += 3; break;
}
}
else
{
n = Getbound(trip ? 11 : 3, lon, sect);
alm[n] += 3;
}
n = Getbound(2, lon, sect); // face
alm[n] += 1;
intsort(alm, 7, 1, ndx);
n = 0;
for (int i = 0; i < 3; i++)
if (alm[i] == alm[0])
n++;
for (int i = 0; i < n; i++)
res[i] = ndx[i];
return n;
}
//---------------------------------------------------------------------------
int __fastcall Getbound(int mode, int lon, bool sect)
{
int r = lon % 30, n = lon / 30; // 25, 1
switch (mode)
{
case -1: return sect;
case 0:
for (int i = 0; i < 5; i++)
if (r >= egyptval[n][i] && r < egyptval[n][i + 1])
return egyptbounds[n][i];
break;
case 1:
for (int i = 0; i < 5; i++)
if (r >= ptolval[n][i] && r < ptolval[n][i + 1])
return ptolbounds[n][i];
break;
case 2:
return face[(int)lon / 10];
case 3:
return sect ? trip_noct[n] : trip_diur[n];
case 4:
for (int i = 0; i < 5; i++)
if (r >= valChaldeanBounds[i] && r < valChaldeanBounds[i + 1])
{
if (sect) return chaldeanNightBounds[n][i];
else return chaldeanDayBounds[n][i];
}
case 5:
if (sect)
{
for (int i = 0; i < 7; i++)
if (r >= valValensNightBounds[n * 8 + i] && r < valValensNightBounds[n * 8 + i + 1])
return valensNightBounds[n][i];
}
else
{
for (int i = 0; i < 7; i++)
if (r >= valValensDayBounds[n * 8 + i] && r < valValensDayBounds[n * 8 + i + 1])
return valensDayBounds[n][i];
}
break;
case 6:
for (int i = 0; i < 5; i++)
if (r >= valLillyBounds[n][i] && r < valLillyBounds[n][i + 1])
return lillyBoundsVar[n][i];
break;
case 7: return gbexal[n]; //exaltations
case 8: return gbdetr[n]; //detriment
case 9: return gbfall[n]; //fall
case 10: return gbruler[n]; //ruler
case 11: return sect ? trip_noct[n] : lillyDiur[n]; //lilly
case 12: break;
case 13: break;
}
return 0;
}