[Tux4kids-commits] r1542 - in tuxtype/trunk: data/words src
David Bruce
dbruce-guest at alioth.debian.org
Sat Sep 19 21:00:45 UTC 2009
Author: dbruce-guest
Date: 2009-09-19 21:00:43 +0000 (Sat, 19 Sep 2009)
New Revision: 1542
Modified:
tuxtype/trunk/data/words/astronomy.txt
tuxtype/trunk/src/alphabet.c
tuxtype/trunk/src/globals.h
tuxtype/trunk/src/laser.c
tuxtype/trunk/src/playgame.c
Log:
Added support for longer words
Modified: tuxtype/trunk/data/words/astronomy.txt
===================================================================
--- tuxtype/trunk/data/words/astronomy.txt 2009-09-18 12:33:54 UTC (rev 1541)
+++ tuxtype/trunk/data/words/astronomy.txt 2009-09-19 21:00:43 UTC (rev 1542)
@@ -57,6 +57,7 @@
STAR
SUN
SUNSPOT
+SUPERNOVA
TERRESTRIAL
UNIVERSE
URANUS
Modified: tuxtype/trunk/src/alphabet.c
===================================================================
--- tuxtype/trunk/src/alphabet.c 2009-09-18 12:33:54 UTC (rev 1541)
+++ tuxtype/trunk/src/alphabet.c 2009-09-19 21:00:43 UTC (rev 1542)
@@ -558,13 +558,16 @@
continue;
}
- if (length > MAX_WORD_SIZE)
- {
- fprintf(stderr, "Word '%s' not added - exceeds %d characters\n",
- temp_word, MAX_WORD_SIZE);
- continue;
- }
+ //NOTE now the cascade and laser games have their own checks for how long of words
+ //they can actually handle, so we let long words in now - DSB
+// if (length > MAX_WORD_SIZE)
+// {
+// fprintf(stderr, "Word '%s' not added - exceeds %d characters\n",
+// temp_word, MAX_WORD_SIZE);
+// continue;
+// }
+
if (num_words >= MAX_NUM_WORDS)
{
fprintf(stderr, "Word '%s' not added - list has reached max of %d characters\n",
Modified: tuxtype/trunk/src/globals.h
===================================================================
--- tuxtype/trunk/src/globals.h 2009-09-18 12:33:54 UTC (rev 1541)
+++ tuxtype/trunk/src/globals.h 2009-09-19 21:00:43 UTC (rev 1542)
@@ -145,7 +145,7 @@
/* Limits on word list size, word length, and on the number of distinct characters */
/* that can be present within a word list: */
#define MAX_NUM_WORDS 500
-#define MAX_WORD_SIZE 8
+#define MAX_WORD_SIZE 20
#define MAX_UNICODES 1024
#define WAIT_MS 2500
Modified: tuxtype/trunk/src/laser.c
===================================================================
--- tuxtype/trunk/src/laser.c 2009-09-18 12:33:54 UTC (rev 1541)
+++ tuxtype/trunk/src/laser.c 2009-09-19 21:00:43 UTC (rev 1542)
@@ -867,9 +867,11 @@
int i = 0;
comet_type* prev_comet = NULL;
- if(!word || wcslen(word) == 0)
+ if(!word
+ || (wcslen(word) == 0)
+ || (wcslen(word) > NUM_CITIES - 1))
{
- fprintf(stderr, "Error - GetWord() returned NULL or zero-length word\n");
+ fprintf(stderr, "Error - GetWord() returned NULL, zero-length, or too-long word\n");
return;
}
Modified: tuxtype/trunk/src/playgame.c
===================================================================
--- tuxtype/trunk/src/playgame.c 2009-09-18 12:33:54 UTC (rev 1541)
+++ tuxtype/trunk/src/playgame.c 2009-09-19 21:00:43 UTC (rev 1542)
@@ -942,7 +942,7 @@
*****************************/
static void SpawnFishies(int diflevel, int* fishies, int* frame)
{
- int i, spacing;
+ int i, spacing, max_length;
wchar_t* new_word;
LOG("Enter SpawnFishies()\n");
@@ -993,15 +993,24 @@
return;
}
+ /* See how long of a word will fit the length of our screen: */
+ max_length = screen->w / fish_sprite->frame[0]->w;
+
+ do
+ {
+ new_word = GetWord();
+ if (!new_word) break;
+ }
+ while(wcslen(new_word) > max_length);
+
/* See if we get a valid word before we move on: */
- new_word = GetWord();
-
if (!new_word)
{
fprintf(stderr, "SpawnFishies() - could not get word - returning.\n");
return;
}
+
/* If we get to here, it should be OK to actually spawn the fishy: */
fish_object[*fishies].word = new_word;
fish_object[*fishies].len = wcslen(new_word); //using wchar_t[] now
More information about the Tux4kids-commits
mailing list