Okay, so i'm trying (TRYING) to implement RBY. I need to add the RBY (1st gen) to Team Builder. But, since we have this: for (int i = 0; i < NUMBER_GENS; i++) { (and NUMBER_GENS is 5, it wont show B/W (5th gen) since i'm adding another one before it. But if i increase it, i feel like i'll have to touch 3/4 of the code in the moves.cpp and moves1.cpp because of gen() Any idea? Short Explain: NUMBER_GENS = 5 Since we have Stadium, if we include RBY we'll have 6. I need to change NUMBER_GENS, but if i change it i feel like i'll need to touch 3/4 of the moves/1.cpp to fix gen() stuff.
That would be the same as doing RBY, since i don't know which moves are different on Stadium. I would need to look up around 4000 lines of code lol I've also figured it out. x:
Message to Lamperi: I've been trying to get rid of the crash but no success on it: Code (text): std::vector<int> && BattleBase::sortedBySpeed() { std::vector<int> ret; std::vector<std::pair<int, int> > speeds; for (int i =0; i < numberOfSlots(); i++) { if (!koed(i)) { speeds.push_back(std::pair<int, int>(i, getStat(i, Speed))); } } if (speeds.size() == 0) return std::move(ret); std::sort(speeds.begin(), speeds.end(), &comparePair); /* Now for the speed tie */ for (unsigned i = 0; i < speeds.size()-1;) { unsigned j; for (j = i+1; j < speeds.size(); j++) { if (speeds[j].second != speeds[i].second) { break; } } if (j != i +1) { std::random_shuffle(speeds.begin() + i, speeds.begin() + j); } i = j; } /* Now assigning, removing the pairs */ for (unsigned i =0; i < speeds.size(); i++) { ret.push_back(speeds[i].first); } return std::move(ret); } If i add qDebug() << "Test" before returns it just doesn't crash and does this: Crash is caused by doing this: 0 msvcrt!memmove C:\Windows\system32\msvcrt.dll 0 0x7602a160 1 msvcrt!memmove C:\Windows\system32\msvcrt.dll 0 0x7602a0fd 2 std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<int> stl_algobase.h 378 0x585f56 3 std::__copy_move_a<false, int const*, int*> stl_algobase.h 397 0x5a23ab 4 std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int> > >, int*> stl_algobase.h 436 0x5a3029 5 std::copy<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int> > >, int*> stl_algobase.h 468 0x5a5f76 6 std::__uninitialized_copy<true>::uninitialized_copy<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int> > >, int*> stl_uninitialized.h 93 0x59834f 7 std::uninitialized_copy<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int> > >, int*> stl_uninitialized.h 117 0x5a41bf 8 std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int> > >, int*, int> stl_uninitialized.h 257 0x5a505f 9 std::vector<int, std::allocator<int> >::vector stl_vector.h 243 0x59cdbe 10 QForeachContainer<std::vector<int, std::allocator<int> > >::QForeachContainer qglobal.h 2251 0x51080a 11 BattleRBY::analyzeChoices battlerby.cpp 155 0x491341 12 BattleRBY::beginTurn battlerby.cpp 37 0x490d89 13 BattleBase::run battlebase.cpp 219 0x487f64 14 ContextSwitcher::runNewCalleeS contextswitch.cpp 99 0x6b2c7888 15 coro_init coro.c 91 0x6b2c8383 16 ?? 0 0xabababab 17 ?? 0 0xabababab 18 ?? 0 Any idea, Lamperi? =/ Already got mad at this x: Line 155 of battlerby.cpp is this: foreach(int i, playersByOrder) {
Hey Apple! Long time i don't write here. Anyways, for what i've been discussing: "sql.createIfNotExists(table_name, col1, col2, col3, ..) sql.getRows(table_name, where clause) //Returns an array of objects like {col1: val1, col2: val2, ...} sql.removeRows(table_name, where clause) sql.existRow(table_name, where clause) sql.updateRow(table_name, where clause, val1, val2, val3, ..) sql.insertRow(table_name, val1, val2, ...)" Fine, i can look into it, doesn't seems to be pretty hard. But i still think we should (we can discuss it with some other people such as Lamperi before i do it) be able to set a separate Database from the Server's one.
Just use a separate database from the pokemon one for scripts, and make all the script sql commands use that database?
So, instead of using sys. It's a new QObject which contains all the database stuff, right? (Like Actual ScriptEngine but instead calling it SQLEngine) class SQLEngine : public QObject { [...] } sql.foo1() sql.foo2(foo1, foo2, foo3, ...) sql.foo3(foo1, foo2, foo3, foo4, foo5)
just do raw sql, it will be less painful to learn and code. Here's a template for scriptdb: https://github.com/lamperi/pokemon-online/commit/5750cf7f36c5405a2c6281b26b528d9c97a2eefb It allows any sql in any sqlite database.
If you do it in the main thread yes, but there's already background threads to work with the server. Do things in background if possible.
Actually you do it in a qthread only for asynchroneous stuff, otherwise do it in the main thread. (Maybe give the two options to the script user)
One SQL statement is not too slow, but if they grow or returns lots of stuff then it should be better to asynchronize them.