summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2012-04-14 17:19:02 +0200
committerBertrik Sikken <bertrik@sikken.nl>2012-04-14 17:19:02 +0200
commitcf1e54b21edc9f68e65694249f0b8c61b3e515c1 (patch)
tree0e55b068122f7bb42ec09067878329feb2da6709
parente54ee56a576da0c3140fd6dc566debf8a4ced6c6 (diff)
downloadrockbox-cf1e54b21edc9f68e65694249f0b8c61b3e515c1.tar.gz
rockbox-cf1e54b21edc9f68e65694249f0b8c61b3e515c1.zip
superdom plugin: make functions/variables static where possible
Change-Id: Ibe0d8daacd9b7b9da506b3efe46092b9433d52ef
-rw-r--r--apps/plugins/superdom.c86
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
231void gen_interest(void); 231static void gen_interest(void);
232void init_resources(void); 232static void init_resources(void);
233int select_square(void); 233static int select_square(void);
234void update_score(void); 234static void update_score(void);
235void gen_resources(void); 235static void gen_resources(void);
236void draw_cursor(void); 236static void draw_cursor(void);
237void draw_board(void); 237static void draw_board(void);
238 238
239struct tile{ 239struct 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
262struct settings { 262static 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
272struct resources humanres; 272static struct resources humanres;
273struct resources compres; 273static struct resources compres;
274enum { GS_PROD, GS_MOVE, GS_WAR }; 274enum { GS_PROD, GS_MOVE, GS_WAR };
275int gamestate; 275static int gamestate;
276 276
277struct cursor{ 277static struct cursor{
278 int x; 278 int x;
279 int y; 279 int y;
280} cursor; 280} cursor;
281 281
282struct tile board[12][12]; 282static struct tile board[12][12];
283 283
284void init_board(void) { 284static 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
429int calc_strength(int colour, int x, int y) { 429static 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
529void update_score(void) { 529static 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
542int settings_menu(void) { 542static 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
617int start_menu(void) { 617static 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
649int save_game(void) { 649static 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
700int ingame_menu(void) { 700static 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
732int get_number(char* param, int* value, int max) { 732static 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
889bool tile_has_item(int type, int x, int y) { 889static 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
913int buy_resources(int colour, int type, int x, int y, int nummen) { 913static 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
1025int buy_resources_menu(void) { 1025static 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
1067int move_unit(int colour, int type, int fromx, int fromy, 1067static 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
1155int move_unit_menu(void) { 1155static 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
1179int launch_nuke(int colour, int nukex, int nukey, int targetx, int targety) { 1179static 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
1230int movement_menu(void) { 1230static 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
1331int show_inventory(void) { 1331static 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
1343int production_menu(void) { 1343static 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
1404void init_resources(void) { 1404static 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
1427int select_square(void) { 1427static 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
1530int killmen(int colour) { 1530static 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 */
1560int attack_territory(int colour, int x, int y) { 1560static 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
1616int war_menu(void) { 1616static 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
1655bool place_adjacent(bool tank, int x, int y) { 1655static 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
1675bool has_adjacent(int x, int y) { 1675static 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
1686void find_adjacent(int x, int y, int* adj_x, int* adj_y) { 1686static 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
1711void computer_allocate(void) { 1711static 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
1867int find_adj_target(int x, int y, struct cursor* adj) { 1867static 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
1897void computer_war(void) { 1897static 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
2010void default_settings(void) { 2010static 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
2020int average_strength(int colour) { 2020static 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;