diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/superdom.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c index 135a6ae445..c301367ece 100644 --- a/apps/plugins/superdom.c +++ b/apps/plugins/superdom.c | |||
@@ -228,13 +228,13 @@ enum { | |||
228 | RET_VAL_QUIT_ERR, /* quit or error */ | 228 | RET_VAL_QUIT_ERR, /* quit or error */ |
229 | }; | 229 | }; |
230 | 230 | ||
231 | void gen_interest(void); | 231 | static void gen_interest(void); |
232 | void init_resources(void); | 232 | static void init_resources(void); |
233 | int select_square(void); | 233 | static int select_square(void); |
234 | void update_score(void); | 234 | static void update_score(void); |
235 | void gen_resources(void); | 235 | static void gen_resources(void); |
236 | void draw_cursor(void); | 236 | static void draw_cursor(void); |
237 | void draw_board(void); | 237 | static void draw_board(void); |
238 | 238 | ||
239 | struct tile{ | 239 | struct tile{ |
240 | signed int colour; /* -1 = Unset */ | 240 | signed int colour; /* -1 = Unset */ |
@@ -259,7 +259,7 @@ struct resources { | |||
259 | int moves; | 259 | int moves; |
260 | }; | 260 | }; |
261 | 261 | ||
262 | struct settings { | 262 | static struct settings { |
263 | int compstartfarms; | 263 | int compstartfarms; |
264 | int compstartinds; | 264 | int compstartinds; |
265 | int humanstartfarms; | 265 | int humanstartfarms; |
@@ -269,19 +269,19 @@ struct settings { | |||
269 | int movesperturn; | 269 | int movesperturn; |
270 | } superdom_settings; | 270 | } superdom_settings; |
271 | 271 | ||
272 | struct resources humanres; | 272 | static struct resources humanres; |
273 | struct resources compres; | 273 | static struct resources compres; |
274 | enum { GS_PROD, GS_MOVE, GS_WAR }; | 274 | enum { GS_PROD, GS_MOVE, GS_WAR }; |
275 | int gamestate; | 275 | static int gamestate; |
276 | 276 | ||
277 | struct cursor{ | 277 | static struct cursor{ |
278 | int x; | 278 | int x; |
279 | int y; | 279 | int y; |
280 | } cursor; | 280 | } cursor; |
281 | 281 | ||
282 | struct tile board[12][12]; | 282 | static struct tile board[12][12]; |
283 | 283 | ||
284 | void init_board(void) { | 284 | static void init_board(void) { |
285 | int i,j; | 285 | int i,j; |
286 | rb->srand(*rb->current_tick); | 286 | rb->srand(*rb->current_tick); |
287 | for(i=0;i<12;i++) { /* Hopefully about 50% each colour */ | 287 | for(i=0;i<12;i++) { /* Hopefully about 50% each colour */ |
@@ -426,7 +426,7 @@ void draw_board(void) { | |||
426 | rb->lcd_update(); | 426 | rb->lcd_update(); |
427 | } | 427 | } |
428 | 428 | ||
429 | int calc_strength(int colour, int x, int y) { | 429 | static int calc_strength(int colour, int x, int y) { |
430 | int a, b, score=0; | 430 | int a, b, score=0; |
431 | for (a = -1; a < 2; a++) { | 431 | for (a = -1; a < 2; a++) { |
432 | for (b = -1; b < 2; b++) { | 432 | for (b = -1; b < 2; b++) { |
@@ -526,7 +526,7 @@ void gen_resources(void) { | |||
526 | compres.food += incfood; | 526 | compres.food += incfood; |
527 | } | 527 | } |
528 | 528 | ||
529 | void update_score(void) { | 529 | static void update_score(void) { |
530 | int strength; | 530 | int strength; |
531 | rb->lcd_setfont(FONT_SYSFIXED); | 531 | rb->lcd_setfont(FONT_SYSFIXED); |
532 | rb->lcd_set_drawmode(DRMODE_BG|DRMODE_INVERSEVID); | 532 | rb->lcd_set_drawmode(DRMODE_BG|DRMODE_INVERSEVID); |
@@ -539,7 +539,7 @@ void update_score(void) { | |||
539 | rb->lcd_setfont(FONT_UI); | 539 | rb->lcd_setfont(FONT_UI); |
540 | } | 540 | } |
541 | 541 | ||
542 | int settings_menu(void) { | 542 | static int settings_menu(void) { |
543 | int selection = 0; | 543 | int selection = 0; |
544 | 544 | ||
545 | MENUITEM_STRINGLIST(menu, "Super Domination Settings", NULL, | 545 | MENUITEM_STRINGLIST(menu, "Super Domination Settings", NULL, |
@@ -614,7 +614,7 @@ static int superdom_help(void) { | |||
614 | return RET_VAL_OK; | 614 | return RET_VAL_OK; |
615 | } | 615 | } |
616 | 616 | ||
617 | int start_menu(void) { | 617 | static int start_menu(void) { |
618 | int selection = 0; | 618 | int selection = 0; |
619 | 619 | ||
620 | MENUITEM_STRINGLIST(menu, "Super Domination Menu", NULL, | 620 | MENUITEM_STRINGLIST(menu, "Super Domination Menu", NULL, |
@@ -646,7 +646,7 @@ int start_menu(void) { | |||
646 | return RET_VAL_QUIT_ERR; | 646 | return RET_VAL_QUIT_ERR; |
647 | } | 647 | } |
648 | 648 | ||
649 | int save_game(void) { | 649 | static int save_game(void) { |
650 | int fd; | 650 | int fd; |
651 | char savepath[MAX_PATH]; | 651 | char savepath[MAX_PATH]; |
652 | 652 | ||
@@ -697,7 +697,7 @@ int save_game(void) { | |||
697 | return 0; | 697 | return 0; |
698 | } | 698 | } |
699 | 699 | ||
700 | int ingame_menu(void) { | 700 | static int ingame_menu(void) { |
701 | MENUITEM_STRINGLIST(menu, "Super Domination Menu", NULL, | 701 | MENUITEM_STRINGLIST(menu, "Super Domination Menu", NULL, |
702 | "Return to game", "Save Game", | 702 | "Return to game", "Save Game", |
703 | "Playback Control", "Quit"); | 703 | "Playback Control", "Quit"); |
@@ -729,7 +729,7 @@ int ingame_menu(void) { | |||
729 | return RET_VAL_OK; | 729 | return RET_VAL_OK; |
730 | } | 730 | } |
731 | 731 | ||
732 | int get_number(char* param, int* value, int max) { | 732 | static int get_number(char* param, int* value, int max) { |
733 | static const char *button_labels[4][3] = { | 733 | static const char *button_labels[4][3] = { |
734 | { "1", "2", "3" }, | 734 | { "1", "2", "3" }, |
735 | { "4", "5", "6" }, | 735 | { "4", "5", "6" }, |
@@ -886,7 +886,7 @@ int get_number(char* param, int* value, int max) { | |||
886 | return ret; | 886 | return ret; |
887 | } | 887 | } |
888 | 888 | ||
889 | bool tile_has_item(int type, int x, int y) { | 889 | static bool tile_has_item(int type, int x, int y) { |
890 | switch(type) { | 890 | switch(type) { |
891 | case 0: | 891 | case 0: |
892 | return (board[x][y].men > 0); | 892 | return (board[x][y].men > 0); |
@@ -910,7 +910,7 @@ bool tile_has_item(int type, int x, int y) { | |||
910 | return false; | 910 | return false; |
911 | } | 911 | } |
912 | 912 | ||
913 | int buy_resources(int colour, int type, int x, int y, int nummen) { | 913 | static int buy_resources(int colour, int type, int x, int y, int nummen) { |
914 | const char *itemnames[][6] = { | 914 | const char *itemnames[][6] = { |
915 | { | 915 | { |
916 | "them", | 916 | "them", |
@@ -1022,7 +1022,7 @@ int buy_resources(int colour, int type, int x, int y, int nummen) { | |||
1022 | return RET_VAL_OK; | 1022 | return RET_VAL_OK; |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | int buy_resources_menu(void) { | 1025 | static int buy_resources_menu(void) { |
1026 | int selection = 0,nummen; | 1026 | int selection = 0,nummen; |
1027 | 1027 | ||
1028 | MENUITEM_STRINGLIST(menu, "Buy Resources", NULL, | 1028 | MENUITEM_STRINGLIST(menu, "Buy Resources", NULL, |
@@ -1064,7 +1064,7 @@ int buy_resources_menu(void) { | |||
1064 | return RET_VAL_OK; | 1064 | return RET_VAL_OK; |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | int move_unit(int colour, int type, int fromx, int fromy, | 1067 | static int move_unit(int colour, int type, int fromx, int fromy, |
1068 | int tox, int toy, int nummen) { | 1068 | int tox, int toy, int nummen) { |
1069 | const char *itemnames[][3] = { | 1069 | const char *itemnames[][3] = { |
1070 | { | 1070 | { |
@@ -1152,7 +1152,7 @@ int move_unit(int colour, int type, int fromx, int fromy, | |||
1152 | return RET_VAL_OK; | 1152 | return RET_VAL_OK; |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | int move_unit_menu(void) { | 1155 | static int move_unit_menu(void) { |
1156 | int selection = 0; | 1156 | int selection = 0; |
1157 | 1157 | ||
1158 | MENUITEM_STRINGLIST(menu, "Move unit", NULL, | 1158 | MENUITEM_STRINGLIST(menu, "Move unit", NULL, |
@@ -1176,7 +1176,7 @@ int move_unit_menu(void) { | |||
1176 | return RET_VAL_OK; | 1176 | return RET_VAL_OK; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | int launch_nuke(int colour, int nukex, int nukey, int targetx, int targety) { | 1179 | static int launch_nuke(int colour, int nukex, int nukey, int targetx, int targety) { |
1180 | bool human = (colour == COLOUR_LIGHT); | 1180 | bool human = (colour == COLOUR_LIGHT); |
1181 | int temp; | 1181 | int temp; |
1182 | struct resources *res; | 1182 | struct resources *res; |
@@ -1227,7 +1227,7 @@ int launch_nuke(int colour, int nukex, int nukey, int targetx, int targety) { | |||
1227 | return RET_VAL_OK; | 1227 | return RET_VAL_OK; |
1228 | } | 1228 | } |
1229 | 1229 | ||
1230 | int movement_menu(void) { | 1230 | static int movement_menu(void) { |
1231 | int selection = 0, temp; | 1231 | int selection = 0, temp; |
1232 | 1232 | ||
1233 | MENUITEM_STRINGLIST(menu, "Movement", NULL, | 1233 | MENUITEM_STRINGLIST(menu, "Movement", NULL, |
@@ -1328,7 +1328,7 @@ static const char* inventory_data(int selected_item, void * data, | |||
1328 | return buffer; | 1328 | return buffer; |
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | int show_inventory(void) { | 1331 | static int show_inventory(void) { |
1332 | struct simplelist_info info; | 1332 | struct simplelist_info info; |
1333 | rb->simplelist_info_init(&info, "Inventory", 9, NULL); | 1333 | rb->simplelist_info_init(&info, "Inventory", 9, NULL); |
1334 | info.hide_selection = true; | 1334 | info.hide_selection = true; |
@@ -1340,7 +1340,7 @@ int show_inventory(void) { | |||
1340 | } | 1340 | } |
1341 | } | 1341 | } |
1342 | 1342 | ||
1343 | int production_menu(void) { | 1343 | static int production_menu(void) { |
1344 | int selection = 0, temp; | 1344 | int selection = 0, temp; |
1345 | 1345 | ||
1346 | MENUITEM_STRINGLIST(menu, "Production", NULL, | 1346 | MENUITEM_STRINGLIST(menu, "Production", NULL, |
@@ -1401,7 +1401,7 @@ int production_menu(void) { | |||
1401 | return RET_VAL_OK; | 1401 | return RET_VAL_OK; |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | void init_resources(void) { | 1404 | static void init_resources(void) { |
1405 | humanres.cash = superdom_settings.startcash; | 1405 | humanres.cash = superdom_settings.startcash; |
1406 | humanres.food = superdom_settings.startfood; | 1406 | humanres.food = superdom_settings.startfood; |
1407 | humanres.tanks = 0; | 1407 | humanres.tanks = 0; |
@@ -1424,7 +1424,7 @@ void init_resources(void) { | |||
1424 | compres.moves = 0; | 1424 | compres.moves = 0; |
1425 | } | 1425 | } |
1426 | 1426 | ||
1427 | int select_square(void) { | 1427 | static int select_square(void) { |
1428 | int button = 0; | 1428 | int button = 0; |
1429 | draw_board(); | 1429 | draw_board(); |
1430 | draw_cursor(); | 1430 | draw_cursor(); |
@@ -1527,7 +1527,7 @@ int select_square(void) { | |||
1527 | } | 1527 | } |
1528 | } | 1528 | } |
1529 | 1529 | ||
1530 | int killmen(int colour) { | 1530 | static int killmen(int colour) { |
1531 | bool human = (colour == COLOUR_LIGHT); | 1531 | bool human = (colour == COLOUR_LIGHT); |
1532 | int menkilled,i,j; | 1532 | int menkilled,i,j; |
1533 | int percent; | 1533 | int percent; |
@@ -1557,7 +1557,7 @@ int killmen(int colour) { | |||
1557 | } | 1557 | } |
1558 | 1558 | ||
1559 | /* return -1 if error, 1 if attack is succeeded, 0 otherwise */ | 1559 | /* return -1 if error, 1 if attack is succeeded, 0 otherwise */ |
1560 | int attack_territory(int colour, int x, int y) { | 1560 | static int attack_territory(int colour, int x, int y) { |
1561 | bool human = (colour == COLOUR_LIGHT); | 1561 | bool human = (colour == COLOUR_LIGHT); |
1562 | int str_diff; | 1562 | int str_diff; |
1563 | 1563 | ||
@@ -1613,7 +1613,7 @@ int attack_territory(int colour, int x, int y) { | |||
1613 | return 0; | 1613 | return 0; |
1614 | } | 1614 | } |
1615 | 1615 | ||
1616 | int war_menu(void) { | 1616 | static int war_menu(void) { |
1617 | int selection = 0, temp; | 1617 | int selection = 0, temp; |
1618 | 1618 | ||
1619 | MENUITEM_STRINGLIST(menu, "War!", NULL, | 1619 | MENUITEM_STRINGLIST(menu, "War!", NULL, |
@@ -1652,7 +1652,7 @@ struct threat { | |||
1652 | int str_diff; | 1652 | int str_diff; |
1653 | }; | 1653 | }; |
1654 | 1654 | ||
1655 | bool place_adjacent(bool tank, int x, int y) { | 1655 | static bool place_adjacent(bool tank, int x, int y) { |
1656 | int type = (tank? 1: 2); | 1656 | int type = (tank? 1: 2); |
1657 | if(!buy_resources(COLOUR_DARK, type, x, y, 0)) { | 1657 | if(!buy_resources(COLOUR_DARK, type, x, y, 0)) { |
1658 | return true; | 1658 | return true; |
@@ -1672,7 +1672,7 @@ bool place_adjacent(bool tank, int x, int y) { | |||
1672 | return false; | 1672 | return false; |
1673 | } | 1673 | } |
1674 | 1674 | ||
1675 | bool has_adjacent(int x, int y) { | 1675 | static bool has_adjacent(int x, int y) { |
1676 | if((board[x][y].colour == COLOUR_LIGHT) && | 1676 | if((board[x][y].colour == COLOUR_LIGHT) && |
1677 | ((board[x-1][y].colour == COLOUR_DARK) || | 1677 | ((board[x-1][y].colour == COLOUR_DARK) || |
1678 | (board[x+1][y].colour == COLOUR_DARK) || | 1678 | (board[x+1][y].colour == COLOUR_DARK) || |
@@ -1683,7 +1683,7 @@ bool has_adjacent(int x, int y) { | |||
1683 | return 0; | 1683 | return 0; |
1684 | } | 1684 | } |
1685 | 1685 | ||
1686 | void find_adjacent(int x, int y, int* adj_x, int* adj_y) { | 1686 | static void find_adjacent(int x, int y, int* adj_x, int* adj_y) { |
1687 | /* Finds adjacent squares, returning squares without tanks on them | 1687 | /* Finds adjacent squares, returning squares without tanks on them |
1688 | * in preference to those with them */ | 1688 | * in preference to those with them */ |
1689 | if(board[x-1][y].colour == COLOUR_DARK) { | 1689 | if(board[x-1][y].colour == COLOUR_DARK) { |
@@ -1708,7 +1708,7 @@ void find_adjacent(int x, int y, int* adj_x, int* adj_y) { | |||
1708 | } | 1708 | } |
1709 | } | 1709 | } |
1710 | 1710 | ||
1711 | void computer_allocate(void) { | 1711 | static void computer_allocate(void) { |
1712 | /* Firstly, decide whether to go offensive or defensive. | 1712 | /* Firstly, decide whether to go offensive or defensive. |
1713 | * This is primarily decided by the human player posing a threat to either | 1713 | * This is primarily decided by the human player posing a threat to either |
1714 | * the computer's farms or factories */ | 1714 | * the computer's farms or factories */ |
@@ -1864,7 +1864,7 @@ void computer_allocate(void) { | |||
1864 | compres.cash = 0; | 1864 | compres.cash = 0; |
1865 | } | 1865 | } |
1866 | 1866 | ||
1867 | int find_adj_target(int x, int y, struct cursor* adj) { | 1867 | static int find_adj_target(int x, int y, struct cursor* adj) { |
1868 | /* Find a square next to a computer's farm or factory owned by the player | 1868 | /* Find a square next to a computer's farm or factory owned by the player |
1869 | * that is vulnerable. Return 1 on success, 0 otherwise */ | 1869 | * that is vulnerable. Return 1 on success, 0 otherwise */ |
1870 | if(board[x+1][y].colour == COLOUR_LIGHT && | 1870 | if(board[x+1][y].colour == COLOUR_LIGHT && |
@@ -1894,7 +1894,7 @@ int find_adj_target(int x, int y, struct cursor* adj) { | |||
1894 | return 0; | 1894 | return 0; |
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | void computer_war(void) { | 1897 | static void computer_war(void) { |
1898 | /* Work out where to attack - prioritise the defence of buildings */ | 1898 | /* Work out where to attack - prioritise the defence of buildings */ |
1899 | int i, j; | 1899 | int i, j; |
1900 | bool found_target = true; | 1900 | bool found_target = true; |
@@ -2007,7 +2007,7 @@ static int load_game(const char* file) { | |||
2007 | return 0; | 2007 | return 0; |
2008 | } | 2008 | } |
2009 | 2009 | ||
2010 | void default_settings(void) { | 2010 | static void default_settings(void) { |
2011 | superdom_settings.compstartfarms = 1; | 2011 | superdom_settings.compstartfarms = 1; |
2012 | superdom_settings.compstartinds = 1; | 2012 | superdom_settings.compstartinds = 1; |
2013 | superdom_settings.humanstartfarms = 2; | 2013 | superdom_settings.humanstartfarms = 2; |
@@ -2017,7 +2017,7 @@ void default_settings(void) { | |||
2017 | superdom_settings.movesperturn = 2; | 2017 | superdom_settings.movesperturn = 2; |
2018 | } | 2018 | } |
2019 | 2019 | ||
2020 | int average_strength(int colour) { | 2020 | static int average_strength(int colour) { |
2021 | /* This function calculates the average strength of the given player, | 2021 | /* This function calculates the average strength of the given player, |
2022 | * used to determine when the computer wins or loses. */ | 2022 | * used to determine when the computer wins or loses. */ |
2023 | int i,j; | 2023 | int i,j; |