void Solution::randomMove() { //pick at random a type of move: 1, 2, or 3 int moveType, e1; moveType = (int)(rg->next()*3) + 1; e1 = (int)(rg->next()*(data->n_of_events)); if(moveType == 1){ // perform move of type 1 int t = (int)(rg->next()*45); Move1( e1, t); //cout<< "event " << e1 << " in timeslot " << t << endl; } else if(moveType == 2){ // perform move of type 2 int e2 = (int)(rg->next()*(data->n_of_events)); while(e2 == e1) // take care of not swapping one event with itself e2 = (int)(rg->next()*(data->n_of_events)); Move2( e1, e2); // cout << "e1 "<< e1 << " e2 " << e2 << endl; } else{ // perform move of type 3 int e2 = (int)(rg->next()*(data->n_of_events)); while(e2 == e1) e2 = (int)(rg->next()*(data->n_of_events)); int e3 = (int)(rg->next()*(data->n_of_events)); while(e3 == e1 || e3 == e2) // take care of having three distinct events e3= (int)(rg->next()*(data->n_of_events)); //cout<<"e1 " << e1 << " e2 " << e2 << " e3 " << e3<< endl; Move3( e1, e2, e3); } }
void ShowPrest(char plr) { char pos = -1, pos2 = -1; int i, j; for (j = 0; j < 2; j++) for (i = 0; i < 28; i++) { TPoints[j] += (int) Data->Prestige[i].Points[j]; } FadeOut(2, display::graphics.palette(), 5, 0, 0); PortPal(plr); display::graphics.screen()->clear(0); ShBox(0, 0, 319, 22); ShBox(0, 24, 319, 199); InBox(4, 27, 315, 196); fill_rectangle(5, 28, 314, 195, 0); //ShBox(6,29,125,101); ShBox(6, 29, 56, 101); InBox(17, 46, 44, 62); InBox(70, 42, 174, 92); ShBox(179, 29, 313, 101); ShBox(58, 29, 313, 101); InBox(70, 42, 174, 92); InBox(185, 42, 304, 92); //ShBox(136,74,163,90); IOBox(243, 3, 316, 19); ShBox(6, 104, 313, 194); InBox(10, 127, 309, 191); fill_rectangle(11, 128, 308, 190, 0); ShBox(297, 129, 307, 158); ShBox(297, 160, 307, 189); // Arrows draw_heading(8, 5, "PRESTIGE SUMMARY", 0, -1); draw_heading(14, 109, "EVENTS", 0, -1); display::graphics.setForegroundColor(11); draw_string(140, 120, "1ST:"); draw_string(175, 120, "2ND:"); draw_string(212, 120, "SUBS:"); draw_string(254, 120, "FAIL:"); display::graphics.setForegroundColor(1); draw_string(257, 13, "CONTINUE"); draw_string(17, 39, "FIRST:"); draw_string(19, 81, "DATE:"); display::graphics.setForegroundColor(11); draw_string(71, 37, "# SPACE FIRSTS:"); draw_string(187, 37, "TOTAL POINTS:"); display::graphics.setForegroundColor(1); display::graphics.setForegroundColor(6); draw_string(210, 99, "USA"); draw_string(90, 99, "USA"); display::graphics.setForegroundColor(9); draw_string(261, 99, "USSR"); draw_string(135, 99, "USSR"); draw_up_arrow(299, 131); draw_down_arrow(299, 162); DPrest(plr, &pos, &pos2); FadeIn(2, display::graphics.palette(), 5, 0, 0); WaitForMouseUp(); while (1) { GetMouse(); // Parse Button actions, note that return is embedded in first pButton if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) { InBox(245, 5, 314, 17); if (key > 0) { delay(300); key = 0; }; WaitForMouseUp(); OutBox(245, 5, 314, 17); key = 0; helpText = "i000"; keyHelpText = "k000"; return; } pButton(297, 129, 307, 158, BackOne(plr, &pos, &pos2), key >> 8, 72); pButton(297, 160, 307, 189, ForOne(plr, &pos, &pos2), key >> 8, 80); Button2(15, 129, 160, 133, Move2(plr, &pos, &pos2, 0), key, 49); Button2(15, 136, 160, 140, Move2(plr, &pos, &pos2, 1), key, 50); Button2(15, 143, 160, 147, Move2(plr, &pos, &pos2, 2), key, 51); Button2(15, 150, 160, 154, Move2(plr, &pos, &pos2, 3), key, 52); Button2(15, 157, 160, 161, Move2(plr, &pos, &pos2, 4), key, 53); Button2(15, 164, 160, 168, Move2(plr, &pos, &pos2, 5), key, 54); Button2(15, 171, 160, 175, Move2(plr, &pos, &pos2, 6), key, 55); Button2(15, 178, 160, 182, Move2(plr, &pos, &pos2, 7), key, 56); Button2(15, 185, 160, 189, Move2(plr, &pos, &pos2, 8), key, 57); key = 0; }; }