#include /* * Hey, this is my very first working c++ program! * I mean, it has some actual use! * I decided to have the code commented instead of * posting my results and explaining what I did. * Hopefully it's clearer this way. * * This is a utility explicity written for Serpens * though I dont think he'll stumble upon this file * before I alert him, but hey, who the fuck cares, * I'm literally talking to myself! :P * * no copyright (:=X neuzd 2009 */ int main() { // Stars IDs. These are fixed and saved in Starmap.bin // when a body gets labeled double fenia = 15995.519841678; double bal = -0.03782822278144; double yla = -0.1154363415791; double cama = 5850279.2274598; // these numbers are probably related to the numbers of // decimals in the ID. // I found for Camaidasco it works until 1E2 so, 1E3 has been chosen. double c_fenia = 1E5; double c_bal = 1E6; double c_yla = 1E8; double c_cama = 1E3; // numbers which stars IDs get tested with long test_fenia = 1599551984L; long test_bal = -37828; long test_yla = -11543634L; long test_cama = -2147483648L; // <- Note, I added an L at the end. // test_cama_reveng is test_cama (how I originally calculated it). // Before finding c_cama, I used anyone of the other 3, // the result is always the same (that's why I think // it's related to decimals...) long test_cama_reveng = (long)(cama * c_cama); // Now some test to see if Alex's code really works :P cout << "\n"; cout << "BEGIN TEST\n"; cout << " FENIA check: "; if ((long)(fenia * c_fenia) == test_fenia) cout << "ok\n"; else cout << "KO\n"; cout << " BALASTRACKONASTREYA check: "; if ((long)(bal * c_bal) == test_bal) cout << "ok\n"; else cout << "KO\n"; cout << " YLASTRAVENYA check: "; if ((long)(yla * c_yla) == test_yla) cout << "ok\n"; else cout << "KO\n"; cout << "\n"; cout << "New star test_number: "; cout << test_cama_reveng; cout << "\n"; // Now try the same tests for Camaidasco test_number cout << " CAMAIDASCO check: "; if ((long)(cama * c_cama) == test_cama) cout << " ok\n"; else cout << " KO\n"; cout << "\n"; cout << "the code you're looking for, should be like this:\n"; cout << " if ((long)(nearstar_identity * 1E3) == " ; cout << test_cama; cout << "L) {"; cout << "\n"; }