@@ -259,18 +259,7 @@ int main(int argc, char* argv[]) {
259259 dropcycles = std::max (1 , dropcycles);
260260 dropcycles = std::min (1000000 , dropcycles);
261261
262- int mindropcount = 30 ;
263-
264- if (argc >= 5 ) {
265- mindropcount = atoi (argv[4 ]);
266- }
267-
268- mindropcount = std::max (1 , mindropcount);
269-
270- std::cout << " TC: " << tcname << std::endl;
271- std::cout << " Player mod: " << playermod << std::endl;
272- std::cout << " Drop cycles per set: " << dropcycles << std::endl;
273- std::cout << " Minimum drop count per thread: " << mindropcount << std::endl;
262+ std::cout << tcname << " [" << playermod << " ]" << std::endl;
274263
275264 // Open the treasure class file at: txt/treasureclassex.txt
276265 FILE* tex = fopen ((txtDir + (BASETC ? " base/treasureclassex.txt" : " treasureclassex.txt" )).c_str (), " r" );
@@ -385,9 +374,9 @@ int main(int argc, char* argv[]) {
385374 }
386375
387376 // Get CPU count.
388- int thread_count = std::thread::hardware_concurrency ();
377+ int thread_count = std::thread::hardware_concurrency () * 2 / 3 ; // Use 2/3 of available threads to avoid overloading the system
389378
390- if (thread_count == 0 ) {
379+ if (thread_count < 1 ) {
391380 thread_count = 1 ; // Fallback to 1 if hardware_concurrency cannot determine.
392381 }
393382 else {
@@ -397,8 +386,13 @@ int main(int argc, char* argv[]) {
397386 }
398387 }
399388
400- std::cout << " Using " << thread_count << " threads\n " ;
401- std::cout << " Output files periodically written to: " << simulationsPath << std::endl;
389+ long mindropcount = thread_count;
390+
391+ if (argc >= 5 ) {
392+ mindropcount = atoi (argv[4 ]);
393+ }
394+
395+ mindropcount = std::max (1L , mindropcount);
402396
403397 std::vector<std::thread> threads;
404398
@@ -472,6 +466,7 @@ int main(int argc, char* argv[]) {
472466 for (const auto & drop : totaldrops) {
473467 if (drop.second < mindropcount) {
474468 allAboveMin = false ;
469+ printf (" Thread %d: Item \' %s\' has %ld drops left...\n " , i, drop.first .name .c_str (), mindropcount - drop.second );
475470 break ;
476471 }
477472 }
0 commit comments