[Tux4kids-commits] r607 - tuxmath/trunk/src
cheezmeister-guest at alioth.debian.org
cheezmeister-guest at alioth.debian.org
Mon Aug 11 16:49:01 UTC 2008
Author: cheezmeister-guest
Date: 2008-08-11 16:48:59 +0000 (Mon, 11 Aug 2008)
New Revision: 607
Modified:
tuxmath/trunk/src/Makefile.am
tuxmath/trunk/src/Makefile.in
tuxmath/trunk/src/SDL_extras.c
tuxmath/trunk/src/SDL_extras.h
tuxmath/trunk/src/campaign.c
tuxmath/trunk/src/campaign.h
tuxmath/trunk/src/credits.c
tuxmath/trunk/src/credits.h
tuxmath/trunk/src/fileops.c
tuxmath/trunk/src/fileops.h
tuxmath/trunk/src/game.c
tuxmath/trunk/src/highscore.c
tuxmath/trunk/src/highscore.h
tuxmath/trunk/src/lessons.c
tuxmath/trunk/src/loaders.c
tuxmath/trunk/src/mathcards.c
tuxmath/trunk/src/multiplayer.c
tuxmath/trunk/src/multiplayer.h
tuxmath/trunk/src/titlescreen.c
tuxmath/trunk/src/titlescreen.h
tuxmath/trunk/src/tuxmath.c
tuxmath/trunk/src/tuxmath.h
Log:
Changed code across the board to minimize compiler warnings
Modified: tuxmath/trunk/src/Makefile.am
===================================================================
--- tuxmath/trunk/src/Makefile.am 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/Makefile.am 2008-08-11 16:48:59 UTC (rev 607)
@@ -34,6 +34,7 @@
audio.c \
mathcards.c \
campaign.c \
+ multiplayer.c \
fileops.c \
ConvertUTF.c \
SDL_extras.c \
@@ -55,6 +56,7 @@
setup.h \
titlescreen.h \
campaign.h \
+ multiplayer.h \
tuxmath.h \
ConvertUTF.h \
SDL_extras.h \
Modified: tuxmath/trunk/src/Makefile.in
===================================================================
--- tuxmath/trunk/src/Makefile.in 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/Makefile.in 2008-08-11 16:48:59 UTC (rev 607)
@@ -70,9 +70,9 @@
titlescreen.$(OBJEXT) game.$(OBJEXT) factroids.$(OBJEXT) \
options.$(OBJEXT) credits.$(OBJEXT) highscore.$(OBJEXT) \
loaders.$(OBJEXT) audio.$(OBJEXT) mathcards.$(OBJEXT) \
- campaign.$(OBJEXT) fileops.$(OBJEXT) ConvertUTF.$(OBJEXT) \
- SDL_extras.$(OBJEXT) lessons.$(OBJEXT) scandir.$(OBJEXT) \
- pixels.$(OBJEXT)
+ campaign.$(OBJEXT) multiplayer.$(OBJEXT) fileops.$(OBJEXT) \
+ ConvertUTF.$(OBJEXT) SDL_extras.$(OBJEXT) lessons.$(OBJEXT) \
+ scandir.$(OBJEXT) pixels.$(OBJEXT)
am_TuxMath_OBJECTS = $(am__objects_1)
TuxMath_OBJECTS = $(am_TuxMath_OBJECTS)
TuxMath_LDADD = $(LDADD)
@@ -81,9 +81,9 @@
titlescreen.$(OBJEXT) game.$(OBJEXT) factroids.$(OBJEXT) \
options.$(OBJEXT) credits.$(OBJEXT) highscore.$(OBJEXT) \
loaders.$(OBJEXT) audio.$(OBJEXT) mathcards.$(OBJEXT) \
- campaign.$(OBJEXT) fileops.$(OBJEXT) ConvertUTF.$(OBJEXT) \
- SDL_extras.$(OBJEXT) lessons.$(OBJEXT) scandir.$(OBJEXT) \
- pixels.$(OBJEXT)
+ campaign.$(OBJEXT) multiplayer.$(OBJEXT) fileops.$(OBJEXT) \
+ ConvertUTF.$(OBJEXT) SDL_extras.$(OBJEXT) lessons.$(OBJEXT) \
+ scandir.$(OBJEXT) pixels.$(OBJEXT)
tuxmath_OBJECTS = $(am_tuxmath_OBJECTS)
tuxmath_LDADD = $(LDADD)
tuxmath_DEPENDENCIES =
@@ -278,6 +278,7 @@
audio.c \
mathcards.c \
campaign.c \
+ multiplayer.c \
fileops.c \
ConvertUTF.c \
SDL_extras.c \
@@ -297,6 +298,7 @@
setup.h \
titlescreen.h \
campaign.h \
+ multiplayer.h \
tuxmath.h \
ConvertUTF.h \
SDL_extras.h \
@@ -393,6 +395,7 @@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lessons.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/loaders.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mathcards.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/multiplayer.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/options.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pixels.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scandir.Po at am__quote@
Modified: tuxmath/trunk/src/SDL_extras.c
===================================================================
--- tuxmath/trunk/src/SDL_extras.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/SDL_extras.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -340,7 +340,7 @@
/* background. The appearance can be tuned by adjusting the number of */
/* background copies and the offset where the foreground text is */
/* finally written (see below). */
-SDL_Surface* BlackOutline(unsigned char *t, TTF_Font *font, SDL_Color *c)
+SDL_Surface* BlackOutline(const char *t, TTF_Font *font, SDL_Color *c)
{
SDL_Surface* out = NULL;
SDL_Surface* black_letters = NULL;
Modified: tuxmath/trunk/src/SDL_extras.h
===================================================================
--- tuxmath/trunk/src/SDL_extras.h 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/SDL_extras.h 2008-08-11 16:48:59 UTC (rev 607)
@@ -31,7 +31,7 @@
void DrawButton(SDL_Rect* target_rect, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
void RoundCorners(SDL_Surface* s, Uint16 radius);
SDL_Surface* Flip(SDL_Surface *in, int x, int y);
-SDL_Surface* BlackOutline(unsigned char *t, TTF_Font* font, SDL_Color* c);
+SDL_Surface* BlackOutline(const char *t, TTF_Font* font, SDL_Color* c);
int inRect(SDL_Rect r, int x, int y);
void DarkenScreen(Uint8 bits);
void SwitchScreenMode(void);
Modified: tuxmath/trunk/src/campaign.c
===================================================================
--- tuxmath/trunk/src/campaign.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/campaign.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -5,7 +5,12 @@
*/
#include "campaign.h"
-
+#include "tuxmath.h"
+#include "credits.h"
+#include "titlescreen.h"
+#include "game.h"
+#include "fileops.h"
+#include "mathcards.h"
void briefPlayer(int stage); //show text introducing the given stage
void readStageSettings(int stage);
Modified: tuxmath/trunk/src/campaign.h
===================================================================
--- tuxmath/trunk/src/campaign.h 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/campaign.h 2008-08-11 16:48:59 UTC (rev 607)
@@ -1,13 +1,8 @@
#ifndef CAMPAIGN_H
#define CAMPAIGN_H
+
+#include "SDL_extras.h"
-#include "tuxmath.h"
-#include "credits.h"
-#include "titlescreen.h"
-#include "SDL_extras.h"
-#include "game.h"
-#include "fileops.h"
-
#define TESTING_CAMPAIGN
#define NUM_STAGES 5
Modified: tuxmath/trunk/src/credits.c
===================================================================
--- tuxmath/trunk/src/credits.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/credits.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -339,7 +339,7 @@
};
-void draw_text(char * str, SDL_Rect dest);
+//void draw_text(char * str, SDL_Rect dest);
int line;
Modified: tuxmath/trunk/src/credits.h
===================================================================
--- tuxmath/trunk/src/credits.h 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/credits.h 2008-08-11 16:48:59 UTC (rev 607)
@@ -22,4 +22,5 @@
int credits(void);
int scroll_text(char* text[], SDL_Rect subscreen, int speed);
+void draw_text(char* str, SDL_Rect dest);
#endif
Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/fileops.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -339,7 +339,7 @@
/* 5. In missions/arcade directory. */
/* 6. In user's own .tuxmath directory */
/* FIXME redundant code - figure out way to iterate through above */
-int read_named_config_file(const unsigned char* fn)
+int read_named_config_file(const char* fn)
{
FILE* fp;
char opt_path[PATH_MAX];
@@ -593,9 +593,9 @@
int parse_lesson_file_directory(void)
{
- unsigned char lesson_path[PATH_MAX]; //Path to lesson directory
+ char lesson_path[PATH_MAX]; //Path to lesson directory
char* fgets_return_val;
- unsigned char name_buf[NAME_BUF_SIZE];
+ char name_buf[NAME_BUF_SIZE];
int nchars;
struct dirent **lesson_list_dirents = NULL;
@@ -634,15 +634,15 @@
}
/* Allocate storage for lesson list */
- lesson_list_titles = (unsigned char**) malloc(num_lessons * sizeof(unsigned char*));
- lesson_list_filenames = (unsigned char**) malloc(num_lessons * sizeof(unsigned char*));
+ lesson_list_titles = (char**) malloc(num_lessons * sizeof(char*));
+ lesson_list_filenames = (char**) malloc(num_lessons * sizeof(char*));
if (lesson_list_titles == NULL || lesson_list_filenames == NULL) {
perror("allocating memory for lesson list");
return 0;
}
for (lessonIterator = 0; lessonIterator < num_lessons; lessonIterator++) {
- lesson_list_titles[lessonIterator] = (unsigned char*) malloc(NAME_BUF_SIZE * sizeof(unsigned char));
- lesson_list_filenames[lessonIterator] = (unsigned char*) malloc(NAME_BUF_SIZE * sizeof(unsigned char));
+ lesson_list_titles[lessonIterator] = (char*) malloc(NAME_BUF_SIZE * sizeof(char));
+ lesson_list_filenames[lessonIterator] = (char*) malloc(NAME_BUF_SIZE * sizeof(char));
if (lesson_list_titles[lessonIterator] == NULL || lesson_list_filenames[lessonIterator] == NULL) {
perror("allocating memory for lesson filenames or titles");
return 0;
@@ -1589,7 +1589,7 @@
"# #\n"
"# The remaining settings further customize Tuxmath's #\n"
"# behavior. Most users will probably not change them. #\n"
- "############################################################\n\n";
+ "############################################################\n\n"
"\n############################################################\n"
"# #\n"
@@ -2524,9 +2524,9 @@
/* returns 1 if default font successfully loaded, 0 otherwise. */
int load_default_font()
{
- default_font = LoadFont((const unsigned char*)DEFAULT_FONT_NAME,
+ default_font = LoadFont( DEFAULT_FONT_NAME,
DEFAULT_MENU_FONT_SIZE);
- help_font = LoadFont((const unsigned char*)DEFAULT_FONT_NAME,
+ help_font = LoadFont( DEFAULT_FONT_NAME,
DEFAULT_HELP_FONT_SIZE);
if (default_font && help_font)
@@ -2539,8 +2539,8 @@
}
else
{
- fprintf(stderr, "LoadFont(): %s NOT loaded successfully.\n",
- DEFAULT_FONT_NAME);
+ fprintf(stderr, "LoadFont(): %s NOT loaded successfully. TTF: %s\n",
+ DEFAULT_FONT_NAME, TTF_GetError() );
return 0;
}
}
Modified: tuxmath/trunk/src/fileops.h
===================================================================
--- tuxmath/trunk/src/fileops.h 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/fileops.h 2008-08-11 16:48:59 UTC (rev 607)
@@ -240,10 +240,10 @@
int read_global_config_file(void);
int read_user_config_file(void);
int parse_lesson_file_directory(void);
-int read_named_config_file(const unsigned char* filename);
+int read_named_config_file(const char* fn);
int write_user_config_file(void);
int read_high_scores(void);
-int append_high_scores(int tableid,int score,char *player_name);
+int append_high_score(int tableid,int score,char *player_name);
void set_high_score_path(void);
void set_user_data_dir(const char* dirname);
int write_goldstars(void);
Modified: tuxmath/trunk/src/game.c
===================================================================
--- tuxmath/trunk/src/game.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/game.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -2175,9 +2175,9 @@
0);
/* Draw other players' scores */
- if (mp_get_param(PLAYERS) && mp_get_param(MODE) == SCORE_SWEEP )
+ if (mp_get_parameter(PLAYERS) && mp_get_parameter(MODE) == SCORE_SWEEP )
{
- for (i = 0; i < mp_get_param(PLAYERS); ++i)
+ for (i = 0; i < mp_get_parameter(PLAYERS); ++i)
{
snprintf(str, 64, "%s: %d", mp_get_player_name(i),mp_get_player_score(i));
SDL_Surface* score = BlackOutline(str, default_font, &white);
Modified: tuxmath/trunk/src/highscore.c
===================================================================
--- tuxmath/trunk/src/highscore.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/highscore.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -22,7 +22,7 @@
typedef struct high_score_entry {
int score;
- unsigned char name[HIGH_SCORE_NAME_LENGTH];
+ char name[HIGH_SCORE_NAME_LENGTH];
} high_score_entry;
@@ -47,7 +47,7 @@
SDL_Surface* score_surfs[HIGH_SCORES_SAVED] = {NULL};
/* 10 spaces should be enough room for place and score on each line: */
- unsigned char score_strings[HIGH_SCORES_SAVED][HIGH_SCORE_NAME_LENGTH + 10] = {{'\0'}};
+ char score_strings[HIGH_SCORES_SAVED][HIGH_SCORE_NAME_LENGTH + 10] = {{'\0'}};
SDL_Rect score_rects[HIGH_SCORES_SAVED];
SDL_Rect leftRect, rightRect, stopRect, TuxRect, table_bg;
@@ -351,19 +351,18 @@
/* The pl_name argument *must* point to a validly allocated string array */
/* at least three times HIGH_SCORE_NAME_LENGTH because UTF-8 is a */
/* multibyte encoding. */
-void HighScoreNameEntry(unsigned char* pl_name)
+void HighScoreNameEntry(char* pl_name)
{
NameEntry(pl_name, "You Are In The Hall of Fame!", "Enter Your Name:");
}
-void NameEntry(unsigned char* pl_name, const char* heading, const char* sub)
+void NameEntry(char* pl_name, const char* heading, const char* sub)
{
- unsigned char UTF8_buf[HIGH_SCORE_NAME_LENGTH * 3] = {'\0'};
+ char UTF8_buf[HIGH_SCORE_NAME_LENGTH * 3] = {'\0'};
SDL_Rect loc;
SDL_Rect redraw_rect;
SDL_Rect TuxRect,
- Titledest,
stopRect;
int redraw = 0;
@@ -827,7 +826,7 @@
/* Return (pointer to) the name associated with a table entry: */
-unsigned char* HS_Name(int diff_level, int place)
+char* HS_Name(int diff_level, int place)
{
/* Make sure diff_level is valid: */
if (diff_level < 0
Modified: tuxmath/trunk/src/highscore.h
===================================================================
--- tuxmath/trunk/src/highscore.h 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/highscore.h 2008-08-11 16:48:59 UTC (rev 607)
@@ -17,8 +17,8 @@
#include "tuxmath.h"
void DisplayHighScores(int level);
-void HighScoreNameEntry(unsigned char* pl_name);
-void NameEntry(unsigned char* pl_name, const char* heading, const char* sub);
+void HighScoreNameEntry(char* pl_name);
+void NameEntry(char* pl_name, const char* heading, const char* sub);
int check_score_place(int diff_level, int new_score);
int insert_score(char* playername, int diff_level, int new_score);
@@ -28,5 +28,5 @@
/* Note: for writing, use append_high_score in fileops.c */
int HS_Score(int diff_level, int place);
-unsigned char* HS_Name(int diff_level, int place);
+char* HS_Name(int diff_level, int place);
#endif
Modified: tuxmath/trunk/src/lessons.c
===================================================================
--- tuxmath/trunk/src/lessons.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/lessons.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -17,7 +17,7 @@
// extern int num_lessons;
/* local function prototypes: */
-static int filename_comp(const unsigned char* s1, const unsigned char* s2);
+static int filename_comp(const char* s1, const char* s2);
/* Reads the file pointed to by the arg and sets */
/* lesson_list_goldstars* accordingly: */
@@ -123,10 +123,10 @@
/* FIXME need to get correct function - basename() wasn't correct */
/* Perform a strcasecmp() on two path strings, stripping away all the */
/* dirs in the path and just comparing the filenames themselves: */
-static int filename_comp(const unsigned char* s1, const unsigned char* s2)
+static int filename_comp(const char* s1, const char* s2)
{
- char* f1 = s1; //basename(s1);
- char* f2 = s2; //basename(s2);
+ const char* f1 = s1; //basename(s1);
+ const char* f2 = s2; //basename(s2);
return strcasecmp(f1, f2);
}
Modified: tuxmath/trunk/src/loaders.c
===================================================================
--- tuxmath/trunk/src/loaders.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/loaders.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -96,7 +96,7 @@
/* FIXME: I think we need to provide a single default font with the program data, */
/* then more flexible code to try to locate or load system fonts. DSB */
/* Returns ptr to loaded font if successful, NULL otherwise. */
-TTF_Font* LoadFont(const unsigned char* font_name, int font_size)
+TTF_Font* LoadFont(const char* font_name, int font_size)
{
TTF_Font* f;
char fontfile[PATH_MAX];
Modified: tuxmath/trunk/src/mathcards.c
===================================================================
--- tuxmath/trunk/src/mathcards.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/mathcards.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -204,7 +204,7 @@
static MC_MathQuestion* generate_list(void);
static void clear_negatives(void);
static int validate_question(int n1, int n2, int n3);
-static MC_MathQuestion* create_node(int n1, int n2, int op, int ans, int f);
+//static MC_MathQuestion* create_node(int n1, int n2, int op, int ans, int f);
static MC_MathQuestion* create_node_from_card(const MC_FlashCard* flashcard);
static MC_MathQuestion* insert_node(MC_MathQuestion* first, MC_MathQuestion* current, MC_MathQuestion* new_node);
static MC_MathQuestion* append_node(MC_MathQuestion* list, MC_MathQuestion* new_node);
@@ -244,7 +244,7 @@
static int compare_card(const MC_FlashCard* a, const MC_FlashCard* b); //test for identical cards
static int find_divisor(int a);
static MC_MathQuestion* add_all_valid(MC_ProblemType pt, MC_MathQuestion* list, MC_MathQuestion* end_of_list);
-static MC_MathQuestion* find_node(const MC_MathQuestion* list, int num);
+static MC_MathQuestion* find_node(MC_MathQuestion* list, int num);
/* MC_Initialize() sets up the struct containing all of */
/* settings regarding math questions. It should be */
@@ -972,6 +972,7 @@
return 1;
}
+#if 0 //this code is probably on the way out...
/* create a new node and return a pointer to it */
MC_MathQuestion* create_node(int n1, int n2, int op, int ans, int f)
{
@@ -998,6 +999,7 @@
/* ptr should now point to a properly constructed node: */
return ptr;
}
+#endif
MC_MathQuestion* create_node_from_card(const MC_FlashCard* flashcard)
{
@@ -2034,7 +2036,7 @@
return list;
}
-MC_MathQuestion* find_node(const MC_MathQuestion* list, int num)
+MC_MathQuestion* find_node(MC_MathQuestion* list, int num)
{
while (--num > 0 && list)
list = list->next;
Modified: tuxmath/trunk/src/multiplayer.c
===================================================================
--- tuxmath/trunk/src/multiplayer.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/multiplayer.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -9,6 +9,7 @@
*/
#include "SDL.h"
+#include "SDL_extras.h"
#include "multiplayer.h"
#include "game.h"
#include "options.h"
@@ -133,14 +134,14 @@
return pnames[playernum];
}
-int mp_get_param(int p)
+int mp_get_parameter(unsigned int param)
{
- if (p < 0 || p > NUM_PARAMS)
+ if (param > NUM_PARAMS)
{
- printf("Invalid mp_param index: %d\n", p);
+ printf("Invalid mp_param index: %d\n", param);
return 0;
}
- return params[p];
+ return params[param];
}
Modified: tuxmath/trunk/src/multiplayer.h
===================================================================
--- tuxmath/trunk/src/multiplayer.h 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/multiplayer.h 2008-08-11 16:48:59 UTC (rev 607)
@@ -27,6 +27,7 @@
} MP_Mode;
void mp_set_parameter(unsigned int param, int value);
+int mp_get_parameter(unsigned int param);
void mp_run_multiplayer();
int mp_get_player_score(int playernum);
const char* mp_get_player_name(int playernum);
Modified: tuxmath/trunk/src/titlescreen.c
===================================================================
--- tuxmath/trunk/src/titlescreen.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/titlescreen.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -62,8 +62,8 @@
} blits[MAX_UPDATES];
// Lessons available for play
-unsigned char **lesson_list_titles = NULL;
-unsigned char **lesson_list_filenames = NULL;
+char **lesson_list_titles = NULL;
+char **lesson_list_filenames = NULL;
int num_lessons = 0;
@@ -92,7 +92,7 @@
SPRITE_ELIMINATION,
N_SPRITES};
-const unsigned char* menu_sprite_files[N_SPRITES] =
+const char* menu_sprite_files[N_SPRITES] =
{
"lesson",
"comet",
@@ -156,13 +156,15 @@
void UpdateScreen(int* frame);
void AddRect(SDL_Rect* src, SDL_Rect* dst);
void InitEngine(void);
-void ShowMessage(char* str1, char* str2, char* str3, char* str4);
+void ShowMessage(const char* str1, const char* str2, const char* str3, const char* str4);
void RecalcTitlePositions();
void RecalcMenuPositions(int*, int, menu_options*, void (*)(menu_options*),
SDL_Rect**, SDL_Rect**, SDL_Rect**,
SDL_Rect**, SDL_Rect**, SDL_Rect**,
SDL_Rect*, SDL_Rect*);
void set_buttons_max_width(SDL_Rect *, SDL_Rect *, int);
+
+int run_login_menu(void);
int run_main_menu(void);
int run_game_menu(void);
int run_multiplay_menu(void);
@@ -475,7 +477,7 @@
void NotImplemented(void)
{
- char *s1, *s2, *s3, *s4;
+ const char *s1, *s2, *s3, *s4;
s1 = _("Work In Progress!");
s2 = _("This feature is not ready yet");
@@ -490,7 +492,7 @@
/* FIXME add some background shading to improve legibility */
-void ShowMessage(char* str1, char* str2, char* str3, char* str4)
+void ShowMessage(const char* str1, const char* str2, const char* str3, const char* str4)
{
SDL_Surface *s1, *s2, *s3, *s4;
SDL_Rect loc;
@@ -650,14 +652,14 @@
mo->ygap = 15;
}
int run_main_menu(void)
-{
- const unsigned char* menu_text[6] =
- {(const unsigned char*)N_("Play Alone"),
- (const unsigned char*)N_("Play With Friends"),
- (const unsigned char*)N_("Other Math Command Activities"),
- (const unsigned char*)N_("Help"),
- (const unsigned char*)N_("More Options"),
- (const unsigned char*)N_("Quit")};
+{
+ const char* menu_text[6] =
+ {N_("Play Alone"),
+ N_("Play With Friends"),
+ N_("Other Math Command Activities"),
+ N_("Help"),
+ N_("More Options"),
+ N_("Quit")};
sprite* sprites[6] =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL};
menu_options menu_opts;
@@ -726,16 +728,16 @@
}
return 0;
}
-
+
#define NUM_GAME_MENU_ITEMS 5
int run_game_menu(void)
{
- const unsigned char* menu_text[NUM_GAME_MENU_ITEMS] =
- {(const unsigned char*)N_("Math Command Training Academy"),
- (const unsigned char*)N_("Math Command Fleet Missions"),
- (const unsigned char*)N_("Play Arcade Game"),
- (const unsigned char*)N_("Play Custom Game"),
- (const unsigned char*)N_("Main menu")};
+ const char* menu_text[NUM_GAME_MENU_ITEMS] =
+ {N_("Math Command Training Academy"),
+ N_("Math Command Fleet Missions"),
+ N_("Play Arcade Game"),
+ N_("Play Custom Game"),
+ N_("Main menu")};
sprite* sprites[NUM_GAME_MENU_ITEMS] = {NULL, NULL, NULL, NULL, NULL};
@@ -778,16 +780,15 @@
*/
int run_multiplay_menu(void)
{
- int i;
int nplayers = 0;
int mode = -1;
int difficulty = -1;
- unsigned char npstr[HIGH_SCORE_NAME_LENGTH * 3];
+ char npstr[HIGH_SCORE_NAME_LENGTH * 3];
- char* menu_text[3] =
+ const char* menu_text[3] =
{"Score Sweep", "Elimination", "Main menu"};
//just leech settings from arcade modes
- char* diff_menu_text[NUM_HIGH_SCORE_LEVELS + 1] =
+ const char* diff_menu_text[NUM_HIGH_SCORE_LEVELS + 1] =
{"Space Cadet", "Scout", "Ranger", "Ace", "Commando", "Main menu"};
@@ -843,14 +844,14 @@
int run_arcade_menu(void)
{
- const unsigned char* menu_text[7] =
- {(const unsigned char*)N_("Space Cadet"),
- (const unsigned char*)N_("Scout"),
- (const unsigned char*)N_("Ranger"),
- (const unsigned char*)N_("Ace"),
- (const unsigned char*)N_("Commando"),
- (const unsigned char*)N_("Hall Of Fame"),
- (const unsigned char*)N_("Main menu")};
+ const char* menu_text[7] =
+ {N_("Space Cadet"),
+ N_("Scout"),
+ N_("Ranger"),
+ N_("Ace"),
+ N_("Commando"),
+ N_("Hall Of Fame"),
+ N_("Main menu")};
const char* arcade_config_files[5] =
{"arcade/space_cadet", "arcade/scout", "arcade/ranger", "arcade/ace",
"arcade/commando"
@@ -896,7 +897,7 @@
hs_table = arcade_high_score_tables[choice];
if (check_score_place(hs_table, Opts_LastScore()) < HIGH_SCORES_SAVED){
- unsigned char player_name[HIGH_SCORE_NAME_LENGTH * 3];
+ char player_name[HIGH_SCORE_NAME_LENGTH * 3];
/* Get name from player: */
HighScoreNameEntry(&player_name[0]);
@@ -936,7 +937,7 @@
int run_custom_menu(void)
{
- char *s1, *s2, *s3, *s4;
+ const char *s1, *s2, *s3, *s4;
s1 = _("Edit 'options' file in your home directory");
s2 = _("to create customized game!");
s3 = _("Press a key or click your mouse to start game.");
@@ -1054,11 +1055,11 @@
sprite* sprites[5] =
{NULL, NULL, NULL, NULL, NULL};
*/
- const unsigned char* menu_text[4] =
- {(const unsigned char*)N_("Demo"),
- (const unsigned char*)N_("Project Info"),
- (const unsigned char*)N_("Credits"),
- (const unsigned char*)N_("Main Menu")};
+ const char* menu_text[4] =
+ {N_("Demo"),
+ N_("Project Info"),
+ N_("Credits"),
+ N_("Main Menu")};
sprite* sprites[4] =
{NULL, NULL, NULL, NULL};
int n_menu_entries = 4;
@@ -1167,7 +1168,7 @@
//This function takes care of all the drawing and receives
//user input:
- chosen_lesson = choose_menu_item((const unsigned char**)lesson_list_titles, star_sprites, num_lessons, NULL, &lessons_scmo);
+ chosen_lesson = choose_menu_item((const char**)lesson_list_titles, star_sprites, num_lessons, NULL, &lessons_scmo);
while (chosen_lesson >= 0)
{
@@ -1208,7 +1209,7 @@
// selection that we ended with
set_default_menu_options(&menu_opts);
menu_opts.starting_entry = chosen_lesson;
- chosen_lesson = choose_menu_item((const unsigned char**)lesson_list_titles, star_sprites, num_lessons, &menu_opts, &lessons_scmo);
+ chosen_lesson = choose_menu_item((const char**)lesson_list_titles, star_sprites, num_lessons, &menu_opts, &lessons_scmo);
}
if (star_sprites)
{
@@ -2427,7 +2428,7 @@
SDL_Rect* left_arrow_rect,
SDL_Rect* right_arrow_rect)
{
- int i, imod;
+ int i;
SDL_Rect* old_mbr = *menu_button_rect;
SDL_Rect* old_msr = *menu_sprite_rect;
SDL_Rect* old_mtr = *menu_text_rect;
Modified: tuxmath/trunk/src/titlescreen.h
===================================================================
--- tuxmath/trunk/src/titlescreen.h 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/titlescreen.h 2008-08-11 16:48:59 UTC (rev 607)
@@ -167,7 +167,7 @@
/* in loaders.c (from tuxtype): */
int checkFile( const char *file );
-TTF_Font* LoadFont(const unsigned char* font_name, int font_size);
+TTF_Font* LoadFont(const char* font_name, int font_size);
Mix_Chunk *LoadSound( char* datafile );
SDL_Surface *LoadImage( char* datafile, int mode );
SDL_Surface* LoadBkgd(char* datafile);
Modified: tuxmath/trunk/src/tuxmath.c
===================================================================
--- tuxmath/trunk/src/tuxmath.c 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/tuxmath.c 2008-08-11 16:48:59 UTC (rev 607)
@@ -35,7 +35,7 @@
int main(int argc, char * argv[])
{
- char *s1, *s2, *s3, *s4;
+ const char *s1, *s2, *s3, *s4;
s1 = setlocale(LC_ALL, "");
s2 = bindtextdomain(PACKAGE, TUXLOCALE);
Modified: tuxmath/trunk/src/tuxmath.h
===================================================================
--- tuxmath/trunk/src/tuxmath.h 2008-08-11 15:48:50 UTC (rev 606)
+++ tuxmath/trunk/src/tuxmath.h 2008-08-11 16:48:59 UTC (rev 607)
@@ -166,8 +166,8 @@
#define NAME_BUF_SIZE 200
/* data for 'Training Academy' lessons: */
-extern unsigned char **lesson_list_titles;
-extern unsigned char **lesson_list_filenames;
+extern char **lesson_list_titles;
+extern char **lesson_list_filenames;
extern int* lesson_list_goldstars;
extern int num_lessons;
More information about the Tux4kids-commits
mailing list