1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829
|
This is an autogenerated patch header for a single-debian-patch file. The
delta against upstream is either kept as a single patch, or maintained
in some VCS, and exported as a single patch instead of more manageable
atomic patches.
--- stax-1.37.orig/commandline.cpp
+++ stax-1.37/commandline.cpp
@@ -21,7 +21,7 @@
#include <iostream>
#include "stax.h"
-void ProcessCommandLine(int argc, char** argv)
+void ProcessCommandLine(int argc, const char** argv)
{
high_score_filename = GetHighScoresFilename(argv[0]);
ReadHighScores(high_score_filename);
--- stax-1.37.orig/configuration.cpp
+++ stax-1.37/configuration.cpp
@@ -23,16 +23,16 @@
#include "stax.h"
static std::vector<RGB*> color_schemes;
-static std::vector<char*> color_scheme_names;
+static std::vector<const char*> color_scheme_names;
-static char *DuplicateString(char *s) throw (std::bad_alloc)
+static char *DuplicateString(const char *s)
{
char *n = new char[strlen(s)+1];
memcpy(n, s, strlen(s)+1);
return n;
}
-void AddColorScheme(char *name, RGB colors[NUM_CONFIGURABLE_COLORS]) throw (std::bad_alloc)
+void AddColorScheme(const char *name, RGB colors[NUM_CONFIGURABLE_COLORS])
{
RGB *scheme = new RGB[NUM_CONFIGURABLE_COLORS];
for (int i = 0; i < NUM_CONFIGURABLE_COLORS; i++) {
@@ -44,7 +44,7 @@ void AddColorScheme(char *name, RGB colo
color_scheme_names.push_back(DuplicateString(name));
}
-void SetColorScheme(char* name) throw (Invalid)
+void SetColorScheme(const char* name)
{
for (unsigned int i = 0; i < color_schemes.size(); i++) {
if (!strcmp(color_scheme_names[i], name)) {
@@ -64,16 +64,16 @@ int GetNumColorSchemes(void)
return color_schemes.size();
}
-char* GetColorSchemeName(unsigned int i) throw (Invalid)
+const char* GetColorSchemeName(unsigned int i)
{
if (i >= color_scheme_names.size())
throw Invalid();
return color_scheme_names[i];
}
-static char *game_type_getter(int n, int *size)
+static const char *game_type_getter(int n, int *size)
{
- char *strings[3] = {
+ const char* strings[3] = {
"Sucker", "SpringShot", "Shifty"
};
@@ -86,9 +86,9 @@ static char *game_type_getter(int n, int
}
}
-static char *num_blocks_getter(int n, int *size)
+static const char *num_blocks_getter(int n, int *size)
{
- char *strings[4] = {
+ const char *strings[4] = {
"2", "3", "4", "5"
};
@@ -101,9 +101,9 @@ static char *num_blocks_getter(int n, in
}
}
-static char *initial_height_getter(int n, int *size)
+static const char *initial_height_getter(int n, int *size)
{
- char *strings[15] = {
+ const char* strings[15] = {
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11",
"12", "13", "14", "15"
};
@@ -120,14 +120,14 @@ static char *initial_height_getter(int n
static void ConfigureGameOptions(void)
{
Widget game_widgets[] = {
- { WIDGET_TEXT, ALIGN_CENTER, 140, 20, 0, 0, "Game Options", 0, 0, 0, 0, NULL, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 60, 0, 0, "Game type:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_CENTER, 140, 20, 0, 0, strdup("Game Options"), 0, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 60, 0, 0, strdup("Game type:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_RIGHT, 275, 60, 0, 0, NULL, 0, 0, 0, 0, (void *)game_type_getter, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 85, 0, 0, "Initial height:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 85, 0, 0, strdup("Initial height:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_RIGHT, 275, 85, 0, 0, NULL, 0, 0, 0, 0, (void *)initial_height_getter, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 110, 0, 0, "Block types:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 110, 0, 0, strdup("Block types:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_RIGHT, 275, 110, 0, 0, NULL, 0, 0, 0, 0, (void *)num_blocks_getter, NULL, NULL, 0 },
- { WIDGET_BUTTON, ALIGN_CENTER, 140, 140, -1, 0, "OK", 6, 7, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_BUTTON, ALIGN_CENTER, 140, 140, -1, 0, strdup("OK"), 6, 7, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_END, }
};
@@ -144,9 +144,9 @@ static void ConfigureGameOptions(void)
configuration.number_of_block_types = game_widgets[6].d1+2;
}
-static char *player1_controls_getter(int n, int *size)
+static const char *player1_controls_getter(int n, int *size)
{
- char *strings[4] = {
+ const char* strings[4] = {
"Arrows & Control", "W, A, S, D & Space", "Joystick 1", "Joystick 2"
};
@@ -159,9 +159,9 @@ static char *player1_controls_getter(int
}
}
-static char *player2_controls_getter(int n, int *size)
+static const char *player2_controls_getter(int n, int *size)
{
- char *strings[5] = {
+ const char* strings[5] = {
"None", "Arrows & Control", "W, A, S, D & Space", "Joystick 1", "Joystick 2"
};
@@ -177,12 +177,12 @@ static char *player2_controls_getter(int
static void ConfigureControls(void)
{
Widget control_widgets[] = {
- { WIDGET_TEXT, ALIGN_CENTER, 143, 20, 0, 0, "Controls", 0, 0, 0, 0, NULL, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 60, 0, 0, "Player 1:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_CENTER, 143, 20, 0, 0, strdup("Controls"), 0, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 60, 0, 0, strdup("Player 1:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_CENTER, 183, 60, 0, 0, NULL, 0, 0, 0, 0, (void *)player1_controls_getter, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 85, 0, 0, "Player 2:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 85, 0, 0, strdup("Player 2:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_CENTER, 183, 85, 0, 0, NULL, 0, 0, 0, 0, (void *)player2_controls_getter, NULL, NULL, 0 },
- { WIDGET_BUTTON, ALIGN_CENTER, 143, 115, -1, 0, "OK", 4, 5, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_BUTTON, ALIGN_CENTER, 143, 115, -1, 0, strdup("OK"), 4, 5, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_END, }
};
@@ -205,9 +205,9 @@ static void ConfigureControls(void)
configuration.input_type_2 = (InputType)(control_widgets[4].d1);
}
-static char *graphics_mode_getter(int n, int *size)
+static const char *graphics_mode_getter(int n, int *size)
{
- char *strings[2] = {
+ const char *strings[2] = {
"Windowed", "Full Screen"
};
@@ -220,9 +220,9 @@ static char *graphics_mode_getter(int n,
}
}
-static char *resolution_getter(int n, int *size)
+static const char *resolution_getter(int n, int *size)
{
- char *strings[3] = {
+ const char *strings[3] = {
"640x480", "800x600", "1024x768"
};
@@ -235,9 +235,9 @@ static char *resolution_getter(int n, in
}
}
-static char *color_depth_getter(int n, int *size)
+static const char *color_depth_getter(int n, int *size)
{
- char *strings[4] = {
+ const char *strings[4] = {
"15", "16", "24", "32"
};
@@ -253,14 +253,14 @@ static char *color_depth_getter(int n, i
static void ConfigureGraphics(void)
{
Widget graphics_widgets[] = {
- { WIDGET_TEXT, ALIGN_CENTER, 158, 20, 0, 0, "Graphics", 0, 0, 0, 0, NULL, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 60, 0, 0, "Graphics mode:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_CENTER, 158, 20, 0, 0, strdup("Graphics"), 0, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 60, 0, 0, strdup("Graphics mode:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_RIGHT,287, 60, 0, 0, NULL, 0, 0, 0, 0, (void *)graphics_mode_getter, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 85, 0, 0, "Resolution:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 85, 0, 0, strdup("Resolution:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_RIGHT, 287, 85, 0, 0, NULL, 0, 0, 0, 0, (void *)resolution_getter, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 110, 0, 0, "Color depth:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 110, 0, 0, strdup("Color depth:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_RIGHT, 287, 110, 0, 0, NULL, 0, 0, 0, 0, (void *)color_depth_getter, NULL, NULL, 0 },
- { WIDGET_BUTTON, ALIGN_CENTER, 158, 140, -1, 0, "OK", 2, 3, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_BUTTON, ALIGN_CENTER, 158, 140, -1, 0, strdup("OK"), 2, 3, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_END, }
};
@@ -361,7 +361,7 @@ static void ConfigureGraphics(void)
struct SoundDriver {
int driver;
- char* name;
+ const char* name;
};
#ifdef __linux__
@@ -399,7 +399,7 @@ static SoundDriver midi_drivers[] = {
};
#endif
-static char *digi_getter(int n, int *size)
+static const char *digi_getter(int n, int *size)
{
if (n < 0) {
*size = num_digi_drivers;
@@ -410,7 +410,7 @@ static char *digi_getter(int n, int *siz
}
}
-static char *midi_getter(int n, int *size)
+static const char *midi_getter(int n, int *size)
{
if (n < 0) {
*size = num_midi_drivers;
@@ -424,16 +424,16 @@ static char *midi_getter(int n, int *siz
static void ConfigureSound(void)
{
Widget sound_widgets[] = {
- { WIDGET_TEXT, ALIGN_CENTER, 213, 20, 0, 0, "Sound", 0, 0, 0, 0, NULL, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 60, 0, 0, "Audio Device:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_CENTER, 213, 20, 0, 0, strdup("Sound"), 0, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 60, 0, 0, strdup("Audio Device:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_LEFT, 119, 60, 0, 0, NULL, 0, 0, 0, 0, (void *)digi_getter, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 85, 0, 0, "Music Device:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 85, 0, 0, strdup("Music Device:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_OPTION, ALIGN_LEFT, 119, 85, 0, 0, NULL, 0, 0, 0, 0, (void *)midi_getter, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 110, 0, 0, "Audio volume:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 110, 0, 0, strdup("Audio volume:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_SLIDER, ALIGN_LEFT, 119, 110, 255, 0, 0, 0, 1, 10, 0, NULL, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_LEFT, 20, 135, 0, 0, "Music volume:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_LEFT, 20, 135, 0, 0, strdup("Music volume:"), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_SLIDER, ALIGN_LEFT, 119, 135, 255, 0, 0, 0, 1, 10, 0, NULL, NULL, NULL, 0 },
- { WIDGET_BUTTON, ALIGN_CENTER, 213, 165, -1, 0, "OK", 8, 9, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_BUTTON, ALIGN_CENTER, 213, 165, -1, 0, strdup("OK"), 8, 9, 0, 0, NULL, NULL, NULL, 0 },
{ WIDGET_END, }
};
@@ -484,12 +484,12 @@ void Configure(void)
clear(buffer);
Widget configure_widgets[] = {
- { WIDGET_TEXT, ALIGN_CENTER, 95, 20, 0, 0, "Configuration", 0, -1, -1, -1, NULL, NULL, NULL, 0 },
- { WIDGET_TEXTBUTTON, ALIGN_CENTER, 95, 60, 0, 0, "Game Options", -1, -1, -1, -1, NULL, NULL, NULL, 0 },
- { WIDGET_TEXTBUTTON, ALIGN_CENTER, 95, 80, 0, 0, "Controls", -1, -1, -1, -1, NULL, NULL, NULL, 0 },
- { WIDGET_TEXTBUTTON, ALIGN_CENTER, 95, 100, 0, 0, "Graphics", -1, -1, -1, -1, NULL, NULL, NULL, 0 },
- { WIDGET_TEXTBUTTON, ALIGN_CENTER, 95, 120, 0, 0, "Sound", -1, -1, -1, -1, NULL, NULL, NULL, 0 },
- { WIDGET_BUTTON, ALIGN_CENTER, 95, 160, -1, 0, "OK", -1, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_CENTER, 95, 20, 0, 0, strdup("Configuration"), 0, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXTBUTTON, ALIGN_CENTER, 95, 60, 0, 0, strdup("Game Options"), -1, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXTBUTTON, ALIGN_CENTER, 95, 80, 0, 0, strdup("Controls"), -1, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXTBUTTON, ALIGN_CENTER, 95, 100, 0, 0, strdup("Graphics"), -1, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXTBUTTON, ALIGN_CENTER, 95, 120, 0, 0, strdup("Sound"), -1, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_BUTTON, ALIGN_CENTER, 95, 160, -1, 0, strdup("OK"), -1, -1, -1, -1, NULL, NULL, NULL, 0 },
{ WIDGET_END, }
};
@@ -508,7 +508,7 @@ void Configure(void)
}
}
-void ReadConfiguration(char* argv0)
+void ReadConfiguration(const char* argv0)
{
char buf[512];
char keyword[512], value[512];
@@ -601,7 +601,7 @@ void ReadConfiguration(char* argv0)
fclose(f);
}
-void WriteConfiguration(char* argv0)
+void WriteConfiguration(const char* argv0)
{
FILE *f;
char filename[512];
--- stax-1.37.orig/data.cpp
+++ stax-1.37/data.cpp
@@ -20,9 +20,9 @@
#include "stax.h"
-void LoadData(void) throw (BadLoad)
+void LoadData(void)
{
- datafile = load_datafile("#");
+ datafile = load_datafile("/usr/share/games/stax/stax.dat");
if (!datafile)
throw BadLoad();
--- stax-1.37.orig/graphics.cpp
+++ stax-1.37/graphics.cpp
@@ -23,7 +23,7 @@
#include "stax.h"
-void SetGraphicsMode(void) throw (BadGraphicsMode)
+void SetGraphicsMode(void)
{
set_color_depth(configuration.color_depth);
if (set_gfx_mode(configuration.graphics_driver, configuration.screen_width, configuration.screen_height, 0, 0) < 0)
@@ -31,7 +31,7 @@ void SetGraphicsMode(void) throw (BadGra
configuration.graphics_mode_set = true;
}
-void CreateBuffer(void) throw (std::bad_alloc)
+void CreateBuffer(void)
{
buffer = create_bitmap(BUFFER_WIDTH, BUFFER_HEIGHT);
if (!buffer)
@@ -119,7 +119,7 @@ bool IsSupportedColorDepth(int color_dep
return true;
}
-void DrawText(int x, int y, bool center, char* format, ...)
+void DrawText(int x, int y, bool center, const char* format, ...)
{
char text[1000];
--- stax-1.37.orig/gui.cpp
+++ stax-1.37/gui.cpp
@@ -76,7 +76,7 @@ static int *inner_border_colors;
static int char_width;
-static void StripColorCodes(char *dest, char *src)
+static void StripColorCodes(char *dest, const char *src)
{
int i, j = 0;
@@ -105,7 +105,7 @@ static void StripColorCodes(char *dest,
* use two of them. For example to write a string "FOO BAR" with "BAR"
* appearing red, pass "FOO |255000000BAR" as the "s" parameter.
*/
-void textout_color(BITMAP *b, FONT *f, char *s, int x, int y, int color, int bg)
+void textout_color(BITMAP *b, FONT *f, const char *s, int x, int y, int color, int bg)
{
int i, j, k, a[3];
char ch[2];
@@ -139,7 +139,7 @@ void textout_color(BITMAP *b, FONT *f, c
}
}
-void textout_outline(BITMAP *b, FONT *f, char *s, int x, int y, int color, int outline_color, int bg)
+void textout_outline(BITMAP *b, FONT *f, const char *s, int x, int y, int color, int outline_color, int bg)
{
int i;
@@ -158,7 +158,7 @@ void textout_outline(BITMAP *b, FONT *f,
textout_color(b, f, s, x, y, color, bg);
}
-static int text_length_color(FONT *f, char *s)
+static int text_length_color(FONT *f, const char *s)
{
char tmp[MAX_STRING+1];
StripColorCodes(tmp, s);
@@ -277,7 +277,7 @@ typedef struct {
float inc_multiplier;
} ListData;
-static int GUI_GetMinButtonWidth(char *s)
+static int GUI_GetMinButtonWidth(const char *s)
{
return (GUI_BUTTON_RADIUS * 2) + (GUI_INNER_BORDER_WIDTH * 2) + (GUI_BUTTON_PADDING * 2) + text_length_color(font, s);
}
@@ -286,7 +286,7 @@ static int GUI_GetMinButtonWidth(char *s
/*
* Pass -1 width to let this function figure out the minimum width
*/
-static BITMAP *GUI_CreateButton(int w, char *s, WidgetState state) throw (std::bad_alloc)
+static BITMAP *GUI_CreateButton(int w, const char *s, WidgetState state)
{
bool selected = state == WIDGET_STATE_SELECTED || state == WIDGET_STATE_DEPRESSED;
@@ -364,7 +364,7 @@ static BITMAP *GUI_CreateButton(int w, c
}
// Create a circular button just big enough to fit one character
-static BITMAP *GUI_CreateCharButton(int ch, WidgetState state) throw (std::bad_alloc)
+static BITMAP *GUI_CreateCharButton(int ch, WidgetState state)
{
const int r = 11;
const int w = 30, h = 30;
@@ -1247,7 +1247,7 @@ static void GUI_SetColors(void)
GUI_BASE_COLOR = GUI_GetGradientColor(50, 50, 50);
}
-int GUI_Go(int x, int y, int w, int h, Widget *widgets, int selected, void (*callback)(bool)) throw (std::bad_alloc)
+int GUI_Go(int x, int y, int w, int h, Widget *widgets, int selected, void (*callback)(bool))
{
if (!GUI_IsSelectable(&widgets[selected])) {
GUI_WaitMessage("|255000000*Error*\n|255255000GUI_Go:\nCannot select an unselectable widget");
@@ -1989,7 +1989,7 @@ end:
return selected;
}
-void GUI_Message(char *s1, char *s2, char *s3) throw (std::bad_alloc)
+void GUI_Message(char *s1, char *s2, char *s3)
{
if (!s1) {
GUI_WaitMessage("|255000000*Error*\n|255255000GUI_Message:\nMust pass at least 1 string");
@@ -2057,7 +2057,7 @@ void GUI_Message(char *s1, char *s2, cha
destroy_bitmap(window);
}
-void GUI_WaitMessage(char *s, ...) throw (std::bad_alloc)
+void GUI_WaitMessage(const char *s, ...)
{
va_list list;
int i, bi = 0, line = 0, lines;
@@ -2133,7 +2133,7 @@ void GUI_WaitMessage(char *s, ...) throw
strcat(full, stripped);
strcat(full, "\n");
}
- allegro_message(full);
+ allegro_message(full, 0);
return;
}
@@ -2166,7 +2166,7 @@ void GUI_WaitMessage(char *s, ...) throw
w[i].x = width/2;
w[i].y = (lines * text_height(font)) + (GUI_SPACING * 2);
w[i].w = -1;
- w[i].s = "OK";
+ w[i].s = strdup("OK");
w[i].d1 = w[i].d2 = w[i].d3 = w[i].d4 = -1;
i++;
@@ -2182,7 +2182,7 @@ void GUI_WaitMessage(char *s, ...) throw
all.clear();
}
-bool GUI_Prompt(char *message, char *b1, char *b2) throw (std::bad_alloc)
+bool GUI_Prompt(const char *message, const char *b1, const char *b2)
{
Widget widgets[4];
@@ -2199,7 +2199,7 @@ bool GUI_Prompt(char *message, char *b1,
widgets[0].d1 = -1;
widgets[0].x = w / 2;
widgets[0].y = GUI_SPACING;
- widgets[0].s = message;
+ widgets[0].s = strdup(message);
widgets[1].type = widgets[2].type = WIDGET_BUTTON;
widgets[1].align = widgets[2].align = ALIGN_LEFT;
widgets[1].d1 = widgets[2].d1 = -1;
@@ -2209,9 +2209,9 @@ bool GUI_Prompt(char *message, char *b1,
widgets[1].x = (w/2) - (bw/2);
widgets[1].y = widgets[2].y = (GUI_SPACING * 2) + text_height(font);
widgets[1].w = widgets[2].w = -1;
- widgets[1].s = b1;
+ widgets[1].s = strdup(b1);
widgets[2].x = widgets[1].x + GUI_GetMinButtonWidth(b1) + GUI_SPACING;
- widgets[2].s = b2;
+ widgets[2].s = strdup(b2);
widgets[3].type = WIDGET_END;
int ret = GUI_Go((BUFFER_WIDTH/2)-(w/2), (BUFFER_HEIGHT/2)-(h/2), w, h, widgets, 1, NULL);
@@ -2219,7 +2219,7 @@ bool GUI_Prompt(char *message, char *b1,
return ret == 1 ? true : false;
}
-void GUI_Initialize(void) throw (std::bad_alloc)
+void GUI_Initialize(void)
{
GUI_SetColors();
--- stax-1.37.orig/highscores.cpp
+++ stax-1.37/highscores.cpp
@@ -22,7 +22,7 @@
// FIXME: Some of these should throw exceptions
-char* GetHighScoresFilename(char* argv0)
+const char* GetHighScoresFilename(const char* argv0)
{
static char filename[1000];
char *env = getenv("STAX_HIGH_SCORES");
@@ -36,8 +36,8 @@ char* GetHighScoresFilename(char* argv0)
if (env) {
strncpy(filename, env, sizeof(filename));
if (filename[strlen(filename)-1] != '/')
- strncat(filename, "/", sizeof(filename));
- strncat(filename, ".staxhs", sizeof(filename));
+ strncat(filename, "/", sizeof(filename)-1);
+ strncat(filename, ".staxhs", sizeof(filename)-1);
}
else {
replace_filename(filename, argv0, "stax.hs", sizeof(filename));
@@ -103,7 +103,7 @@ static int WriteName(char *name, FILE *f
return 0;
}
-int ReadHighScores(char *filename)
+int ReadHighScores(const char *filename)
{
int i, j;
FILE *f = fopen(filename, "r");
@@ -120,7 +120,7 @@ int ReadHighScores(char *filename)
return 0;
}
-int WriteHighScores(char *filename)
+int WriteHighScores(const char *filename)
{
int i, j;
FILE *f = fopen(filename, "w");
@@ -169,8 +169,8 @@ void CheckHighScores(int pops)
high_scores[game_type][i].blocks = configuration.number_of_block_types;
Widget widgets[23] = {
- { WIDGET_TEXT, ALIGN_CENTER, 178, 20, 0, 0, "You made the High Score list!", makecol(255, 255, 0), 0, 0, 0, NULL, NULL, NULL, 0 },
- { WIDGET_TEXT, ALIGN_CENTER, 178, 40, 0, 0, "Enter your name:", makecol(255, 255, 0), 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_CENTER, 178, 20, 0, 0, strdup("You made the High Score list!"), makecol(255, 255, 0), 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_CENTER, 178, 40, 0, 0, strdup("Enter your name:"), makecol(255, 255, 0), 0, 0, 0, NULL, NULL, NULL, 0 },
};
widgets[22].type = WIDGET_END;
@@ -236,11 +236,11 @@ void CheckHighScores(int pops)
void ViewHighScores(void)
{
int game_type = 0;
- char* game_text[] = { "Sucker High Scores", "SpringShot High Scores",
+ const char* game_text[] = { "Sucker High Scores", "SpringShot High Scores",
"Shifty High Scores" };
Widget widgets[25] = {
- { WIDGET_TEXT, ALIGN_CENTER, 178, 20, 0, 0, game_text[0], -1, 0, 0, 0, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXT, ALIGN_CENTER, 178, 20, 0, 0, strdup(game_text[0]), -1, 0, 0, 0, NULL, NULL, NULL, 0 },
};
widgets[24].type = WIDGET_END;
@@ -250,7 +250,7 @@ void ViewHighScores(void)
widgets[21].x = 52;
widgets[21].y = y;
widgets[21].w = -1;
- widgets[21].s = "<";
+ widgets[21].s = strdup("<");
widgets[21].d1 = 21;
widgets[21].d2 = 22;
widgets[22].type = WIDGET_BUTTON;
@@ -258,7 +258,7 @@ void ViewHighScores(void)
widgets[22].x = 134;
widgets[22].y = y;
widgets[22].w = -1;
- widgets[22].s = "Exit";
+ widgets[22].s = strdup("Exit");
widgets[22].d1 = 21;
widgets[22].d2 = 23;
widgets[23].type = WIDGET_BUTTON;
@@ -266,7 +266,7 @@ void ViewHighScores(void)
widgets[23].x = 232;
widgets[23].y = y;
widgets[23].w = -1;
- widgets[23].s = ">";
+ widgets[23].s = strdup(">");
widgets[23].d1 = 22;
widgets[23].d2 = 23;
@@ -318,6 +318,6 @@ void ViewHighScores(void)
}
else
break;
- widgets[0].s = game_text[game_type];
+ widgets[0].s = strdup(game_text[game_type]);
}
}
--- stax-1.37.orig/panel.cpp
+++ stax-1.37/panel.cpp
@@ -445,7 +445,7 @@ int Panel::GetScore(void)
return score;
}
-bool Panel::MoveBlocks(int step) throw (std::bad_alloc)
+bool Panel::MoveBlocks(int step)
{
current_increment += rise_increment * step;
--- stax-1.37.orig/shifty.cpp
+++ stax-1.37/shifty.cpp
@@ -176,7 +176,7 @@ end:
if (!esc_pressed) {
if (input2 && winner >= 1) {
- char *note;
+ const char *note;
if (panel1->GetScore() > panel2->GetScore()) {
if (winner == 1)
note = "|255255000Player 1 scored higher\n|255255000AND lasted longer!";
--- stax-1.37.orig/sound.cpp
+++ stax-1.37/sound.cpp
@@ -20,7 +20,7 @@
#include "stax.h"
-void InstallSound(void) throw (BadInstall)
+void InstallSound(void)
{
if (install_sound(configuration.sound_driver, configuration.midi_driver, NULL) == -1)
throw BadInstall();
--- stax-1.37.orig/springshot.cpp
+++ stax-1.37/springshot.cpp
@@ -249,7 +249,7 @@ end:
if (!esc_pressed) {
if (input2 && winner >= 1) {
- char *note;
+ const char *note;
if (panel1->GetScore() > panel2->GetScore()) {
if (winner == 1)
note = "|255255000Player 1 scored higher\n|255255000AND lasted longer!";
--- stax-1.37.orig/stax.cpp
+++ stax-1.37/stax.cpp
@@ -123,7 +123,7 @@ HighScore high_scores[NUMBER_OF_GAME_TYP
}
};
-char* high_score_filename = 0;
+const char* high_score_filename = 0;
static const int NUM_DEFAULT_COLOR_SCHEMES = 1;
@@ -145,7 +145,7 @@ static RGB default_color_schemes[NUM_DEF
int falling_block_frame;
-static char* default_color_scheme_names[NUM_DEFAULT_COLOR_SCHEMES] = {
+static const char* default_color_scheme_names[NUM_DEFAULT_COLOR_SCHEMES] = {
"Default"
};
@@ -160,7 +160,7 @@ const int logo_h = 5;
static void DrawLogo(void)
{
- char *data[] = {
+ const char *data[] = {
"111022203330404",
"100002003030404",
"111002003330040",
@@ -244,10 +244,10 @@ int StartMenu(void)
clear(buffer);
Widget start_menu_widgets[] = {
- { WIDGET_TEXTBUTTON, ALIGN_CENTER, 70, 20, 0, 0, "Start Game", -1, -1, -1, -1, NULL, NULL, NULL, 0 },
- { WIDGET_TEXTBUTTON, ALIGN_CENTER, 70, 40, 0, 0, "High Scores", -1, -1, -1, -1, NULL, NULL, NULL, 0 },
- { WIDGET_TEXTBUTTON, ALIGN_CENTER, 70, 60, 0, 0, "Configure", -1, -1, -1, -1, NULL, NULL, NULL, 0 },
- { WIDGET_TEXTBUTTON, ALIGN_CENTER, 70, 80, 0, 0, "Exit", -1, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXTBUTTON, ALIGN_CENTER, 70, 20, 0, 0, strdup("Start Game"), -1, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXTBUTTON, ALIGN_CENTER, 70, 40, 0, 0, strdup("High Scores"), -1, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXTBUTTON, ALIGN_CENTER, 70, 60, 0, 0, strdup("Configure"), -1, -1, -1, -1, NULL, NULL, NULL, 0 },
+ { WIDGET_TEXTBUTTON, ALIGN_CENTER, 70, 80, 0, 0, strdup("Exit"), -1, -1, -1, -1, NULL, NULL, NULL, 0 },
{ WIDGET_END, }
};
@@ -261,7 +261,7 @@ int StartMenu(void)
}
}
-int main(int argc, char** argv)
+int main(int argc, const char** argv)
{
ProcessCommandLine(argc, argv);
--- stax-1.37.orig/stax.h
+++ stax-1.37/stax.h
@@ -25,6 +25,7 @@
#include <vector>
#include <list>
#include <new>
+#include <cstdio>
const int POP_FLASH_TIME = 250;
const int POP_TIME = 3000;
@@ -94,7 +95,7 @@ public:
void FreeTopLandedBlock(int column);
bool AddFallingBlock(int column, Block* block, bool force = false);
int GetScore(void);
- bool MoveBlocks(int step) throw (std::bad_alloc); // Returns true when the blocks reach the top of the panel
+ bool MoveBlocks(int step);
void Draw(void);
Panel(int xx, int yy, int initial_height, float initial_increment);
~Panel();
@@ -228,7 +229,7 @@ struct Configuration {
bool sound_enabled;
int sound_volume;
int music_volume;
- char* color_scheme;
+ const char* color_scheme;
RGB colors[NUM_CONFIGURABLE_COLORS];
bool mouse_installed;
bool joystick_installed;
@@ -281,7 +282,7 @@ typedef struct {
int state;
} Widget;
-typedef char *(*OptionGetter)(int, int *);
+typedef const char *(*OptionGetter)(int, int *);
typedef struct {
int x, y;
@@ -339,7 +340,7 @@ extern BITMAP* slider_tab, *slider_tab_s
extern bool in_gui;
extern BITMAP* background_bitmap;
extern HighScore high_scores[NUMBER_OF_GAME_TYPES][NUM_HIGH_SCORES];
-extern char* high_score_filename;
+extern const char* high_score_filename;
extern int falling_block_frame;
// Game loops
@@ -347,40 +348,40 @@ extern bool Sucker(void);
extern bool SpringShot(void);
extern bool Shifty(void);
-extern void ProcessCommandLine(int argc, char** argv);
+extern void ProcessCommandLine(int argc, const char** argv);
-extern void AddColorScheme(char* name, RGB colors[NUM_CONFIGURABLE_COLORS]) throw (std::bad_alloc);
-extern void SetColorScheme(char* name) throw (Invalid);
+extern void AddColorScheme(const char* name, RGB colors[NUM_CONFIGURABLE_COLORS]);
+extern void SetColorScheme(const char* name);
extern int GetNumColorSchemes(void);
-extern char* GetColorSchemeName(unsigned int i) throw (Invalid);
+extern const char* GetColorSchemeName(unsigned int i);
extern void Configure(void);
-extern void ReadConfiguration(char* argv0);
-extern void WriteConfiguration(char* argv0);
+extern void ReadConfiguration(const char* argv0);
+extern void WriteConfiguration(const char* argv0);
-extern void LoadData(void) throw (BadLoad);
+extern void LoadData(void);
extern void DestroyData(void);
-extern void SetGraphicsMode(void) throw (BadGraphicsMode);
-extern void CreateBuffer(void) throw (std::bad_alloc);
+extern void SetGraphicsMode(void);
+extern void CreateBuffer(void);
extern void DestroyBuffer(void);
extern void DrawBlock(int x, int y, Block* block, bool falling);
extern void FillRectangle(int x1, int y1, int x2, int y2);
extern void DrawSunkenRectangle(int x1, int y1, int x2, int y2);
extern void BlitToScreen(void);
extern bool IsSupportedColorDepth(int color_depth);
-extern void DrawText(int x, int y, bool center, char* format, ...);
+extern void DrawText(int x, int y, bool center, const char* format, ...);
extern void ChangeColor(BITMAP *b, int from, int to);
extern void DrawBackgroundBitmap(void);
extern void SaveScreenshot(void);
-void textout_outline(BITMAP *b, FONT *f, char *s, int x, int y, int color, int outline_color, int bg);
+void textout_outline(BITMAP *b, FONT *f, const char *s, int x, int y, int color, int outline_color, int bg);
extern int GUI_GetGradientColor(float percent, int top_color, int bottom_color);
-extern void GUI_Message(char* s1, char* s2, char* s3) throw (std::bad_alloc);
-extern void GUI_WaitMessage(char *s, ...) throw (std::bad_alloc);
-extern bool GUI_Prompt(char *message, char *b1, char *b2) throw (std::bad_alloc);
-extern int GUI_Go(int x, int y, int w, int h, Widget *widgets, int selected, void (*callback)(bool)) throw (std::bad_alloc);
-extern void GUI_GetName(char *caption, char *buf, int maxlen) throw (std::bad_alloc);
-extern void GUI_Initialize(void) throw (std::bad_alloc);
+extern void GUI_Message(const char* s1, const char* s2, const char* s3);
+extern void GUI_WaitMessage(const char *s, ...);
+extern bool GUI_Prompt(const char *message, const char *b1, const char *b2);
+extern int GUI_Go(int x, int y, int w, int h, Widget *widgets, int selected, void (*callback)(bool));
+extern void GUI_GetName(const char *caption, const char *buf, int maxlen);
+extern void GUI_Initialize(void);
extern void GUI_ShutDown(void);
extern int GUI_TOP_COLOR;
extern int GUI_BOTTOM_COLOR;
@@ -395,9 +396,9 @@ extern int GUI_DEPRESSED_TEXT_COLOR;
extern int GUI_BASE_COLOR;
extern int GUI_TEXT_OUTLINE_COLOR;
-extern char* GetHighScoresFilename(char* argv0);
-extern int ReadHighScores(char* filename);
-extern int WriteHighScores(char* filename);
+extern const char* GetHighScoresFilename(const char* argv0);
+extern int ReadHighScores(const char* filename);
+extern int WriteHighScores(const char* filename);
extern void ViewHighScores(void);
extern void CheckHighScores(int pops);
@@ -411,14 +412,14 @@ extern Input* CreateInput(int player);
extern int GetRandomBlock(void);
-extern void InstallSound(void) throw (BadInstall);
+extern void InstallSound(void);
extern void RemoveSound(void);
extern void StopMusic(void);
extern void PlayIntroMusic(void);
extern void PlayGameMusic(void);
/*
-extern void InstallTimer(void) throw (BadInstall);
+extern void InstallTimer(void);
extern void RemoveTimer(void);
*/
extern void UpdateFallingBlocks(int step);
--- stax-1.37.orig/sucker.cpp
+++ stax-1.37/sucker.cpp
@@ -197,7 +197,7 @@ end:
if (!esc_pressed) {
if (input2 && winner >= 1) {
- char *note;
+ const char *note;
if (panel1->GetScore() > panel2->GetScore()) {
if (winner == 1)
note = "|255255000Player 1 scored higher\n|255255000AND lasted longer!";
|