[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src nls.cc,NONE,1.1 nls.h,NONE,1.1 Ma
From: |
Kai Sterker <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src nls.cc,NONE,1.1 nls.h,NONE,1.1 Makefile.am,1.81,1.82 dialog.cc,1.23,1.24 lex.prefs.cc,1.5,1.6 main.cc,1.42,1.43 prefs.cc,1.11,1.12 prefs.h,1.11,1.12 prefs.l,1.6,1.7 py_adonthell.i,1.31,1.32 text_bubble.cc,1.4,1.5 |
Date: |
Sat, 13 Apr 2002 07:05:12 -0400 |
Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv18465
Modified Files:
Makefile.am dialog.cc lex.prefs.cc main.cc prefs.cc prefs.h
prefs.l py_adonthell.i text_bubble.cc
Added Files:
nls.cc nls.h
Log Message:
ADDED Language option to adonthellrc
MOVED NLS code into a seperate class
***** Error reading new file: [Errno 2] No such file or directory: 'nls.cc'
***** Error reading new file: [Errno 2] No such file or directory: 'nls.h'
Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Makefile.am,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -r1.81 -r1.82
*** Makefile.am 6 Feb 2002 10:33:19 -0000 1.81
--- Makefile.am 13 Apr 2002 11:05:10 -0000 1.82
***************
*** 24,28 ****
gametime.cc image.cc input.cc landmap.cc lex.prefs.cc \
mapsquare_walkable.cc mapcharacter.cc \
! mapsquare.cc mapobject.cc mapview.cc path.cc pnm.cc prefs.cc \
py_callback.cc python_class.cc py_adonthell_wrap.cc py_object.cc quest.cc \
screen.cc surface.cc storage.cc text_bubble.cc win_background.cc win_base.cc
win_border.cc \
--- 24,28 ----
gametime.cc image.cc input.cc landmap.cc lex.prefs.cc \
mapsquare_walkable.cc mapcharacter.cc \
! mapsquare.cc mapobject.cc mapview.cc nls.cc path.cc pnm.cc prefs.cc \
py_callback.cc python_class.cc py_adonthell_wrap.cc py_object.cc quest.cc \
screen.cc surface.cc storage.cc text_bubble.cc win_background.cc win_base.cc
win_border.cc \
***************
*** 33,37 ****
character_base.h character.h gamedata.h data_screen.h dialog.h
dialog_screen.h \
drawable.h drawing_area.h event.h fileops.h game.h gametime.h image.h input.h
inventory.h \
! item.h landmap.h mapsquare.h mapsquare_walkable.h mapcharacter.h mapobject.h
mapview.h \
path.h pnm.h prefs.h python_class.h py_object.h quest.h screen.h surface.h
storage.h \
types.h text_bubble.h win_background.h win_base.h win_border.h
win_container.h \
--- 33,37 ----
character_base.h character.h gamedata.h data_screen.h dialog.h
dialog_screen.h \
drawable.h drawing_area.h event.h fileops.h game.h gametime.h image.h input.h
inventory.h \
! item.h landmap.h mapsquare.h mapsquare_nls.h walkable.h mapcharacter.h
mapobject.h mapview.h \
path.h pnm.h prefs.h python_class.h py_object.h quest.h screen.h surface.h
storage.h \
types.h text_bubble.h win_background.h win_base.h win_border.h
win_container.h \
Index: dialog.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog.cc,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** dialog.cc 12 Apr 2002 20:51:32 -0000 1.23
--- dialog.cc 13 Apr 2002 11:05:10 -0000 1.24
***************
*** 13,18 ****
*/
-
-
/**
* @file dialog.cc
--- 13,16 ----
***************
*** 23,39 ****
*
*/
!
! #ifdef HAVE_CONFIG_H
! #include <config.h>
! #endif
!
! #include <gettext.h>
#include <iostream>
#include <string>
- #include <algorithm>
- #include "yarg.h"
#include "character.h"
#include "dialog.h"
// Constructor
--- 21,33 ----
*
*/
!
! #include <algorithm>
#include <iostream>
#include <string>
#include "character.h"
#include "dialog.h"
+ #include "nls.h"
+ #include "yarg.h"
// Constructor
***************
*** 188,192 ****
// get the text
answer = PyInt_AsLong (PyList_GetItem (speech, rnd));
! text_.push_back (gettext (scan_string (strings[answer])));
// get the NPC color
--- 182,186 ----
// get the text
answer = PyInt_AsLong (PyList_GetItem (speech, rnd));
! text_.push_back (scan_string (nls::gettext (strings[answer])));
// get the NPC color
***************
*** 216,220 ****
// simply add all text to let the player select an answer
answer = PyInt_AsLong (PyList_GetItem (speech, i));
! text_.push_back (gettext (scan_string (strings[answer])));
answers.push_back (answer);
}
--- 210,214 ----
// simply add all text to let the player select an answer
answer = PyInt_AsLong (PyList_GetItem (speech, i));
! text_.push_back (scan_string (nls::gettext
(strings[answer])));
answers.push_back (answer);
}
***************
*** 325,329 ****
if (result)
if (PyString_Check (result))
! mid = (char*) gettext (PyString_AS_STRING (result));
// Replace existing with new, changed string
--- 319,323 ----
if (result)
if (PyString_Check (result))
! mid = (char*) nls::gettext (PyString_AS_STRING (result));
// Replace existing with new, changed string
Index: lex.prefs.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/lex.prefs.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** lex.prefs.cc 2 Aug 2001 10:59:55 -0000 1.5
--- lex.prefs.cc 13 Apr 2002 11:05:10 -0000 1.6
***************
*** 304,319 ****
yy_c_buf_p = yy_cp;
! #define YY_NUM_RULES 13
! #define YY_END_OF_BUFFER 14
! static yyconst short int yy_accept[72] =
{ 0,
! 0, 0, 0, 0, 14, 12, 11, 11, 1, 10,
! 12, 12, 7, 9, 8, 11, 1, 1, 10, 0,
! 0, 9, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! 0, 0, 0, 0, 2, 0, 0, 0, 6, 0,
! 0, 0, 3, 0, 0, 0, 0, 4, 0, 5,
! 0
} ;
--- 304,319 ----
yy_c_buf_p = yy_cp;
! #define YY_NUM_RULES 14
! #define YY_END_OF_BUFFER 15
! static yyconst short int yy_accept[80] =
{ 0,
! 0, 0, 0, 0, 15, 13, 12, 12, 1, 11,
! 13, 13, 13, 8, 10, 9, 12, 1, 1, 11,
! 0, 0, 0, 10, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! 0, 0, 2, 0, 0, 0, 7, 0, 0, 0,
! 4, 0, 0, 0, 0, 5, 0, 6, 0
} ;
***************
*** 327,336 ****
6, 6, 6, 6, 6, 6, 6, 1, 1, 1,
1, 1, 1, 1, 7, 1, 1, 1, 1, 1,
! 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
! 1, 1, 8, 1, 1, 1, 1, 1, 1, 1,
! 9, 1, 10, 1, 1, 1, 11, 1, 12, 13,
! 14, 1, 1, 15, 16, 1, 1, 17, 18, 19,
! 20, 21, 1, 22, 23, 24, 25, 26, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
--- 327,336 ----
6, 6, 6, 6, 6, 6, 6, 1, 1, 1,
1, 1, 1, 1, 7, 1, 1, 1, 1, 1,
! 1, 1, 1, 1, 1, 8, 1, 1, 1, 1,
! 1, 1, 9, 1, 1, 1, 1, 1, 1, 1,
! 10, 1, 11, 1, 1, 1, 12, 1, 13, 14,
! 15, 1, 16, 17, 18, 1, 1, 19, 20, 21,
! 22, 23, 1, 24, 25, 26, 27, 28, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
***************
*** 350,416 ****
} ;
! static yyconst int yy_meta[27] =
{ 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
! 1, 1, 1, 1, 1, 1
} ;
! static yyconst short int yy_base[76] =
{ 0,
! 0, 8, 76, 75, 84, 87, 16, 18, 80, 76,
! 56, 68, 87, 0, 87, 20, 76, 87, 72, 64,
! 54, 0, 59, 60, 53, 58, 66, 51, 12, 64,
! 53, 53, 55, 45, 46, 52, 39, 43, 43, 39,
! 39, 37, 35, 30, 41, 34, 35, 34, 32, 35,
! 34, 22, 32, 31, 87, 20, 12, 28, 87, 9,
! 15, 8, 87, 9, 17, 8, 2, 87, 11, 87,
! 87, 38, 40, 42, 0
} ;
! static yyconst short int yy_def[76] =
{ 0,
! 72, 72, 73, 73, 71, 71, 71, 71, 74, 71,
! 71, 71, 71, 75, 71, 71, 74, 71, 71, 71,
! 71, 75, 71, 71, 71, 71, 71, 71, 71, 71,
! 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
! 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
! 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
! 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
! 0, 71, 71, 71, 71
} ;
! static yyconst short int yy_nxt[114] =
{ 0,
! 22, 7, 8, 9, 71, 10, 11, 12, 13, 7,
! 8, 9, 71, 10, 11, 12, 13, 16, 16, 16,
! 16, 16, 16, 31, 70, 69, 68, 67, 66, 65,
! 64, 63, 62, 32, 33, 61, 60, 34, 6, 6,
! 14, 14, 17, 17, 59, 58, 57, 56, 55, 54,
53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
! 43, 42, 41, 40, 39, 38, 37, 36, 35, 30,
! 29, 28, 27, 26, 25, 24, 23, 19, 18, 21,
! 20, 19, 18, 71, 15, 15, 5, 71, 71, 71,
! 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
!
! 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
! 71, 71, 71
} ;
! static yyconst short int yy_chk[114] =
{ 0,
! 75, 1, 1, 1, 0, 1, 1, 1, 1, 2,
! 2, 2, 0, 2, 2, 2, 2, 7, 7, 8,
! 8, 16, 16, 29, 69, 67, 66, 65, 64, 62,
! 61, 60, 58, 29, 29, 57, 56, 29, 72, 72,
! 73, 73, 74, 74, 54, 53, 52, 51, 50, 49,
! 48, 47, 46, 45, 44, 43, 42, 41, 40, 39,
! 38, 37, 36, 35, 34, 33, 32, 31, 30, 28,
! 27, 26, 25, 24, 23, 21, 20, 19, 17, 12,
! 11, 10, 9, 5, 4, 3, 71, 71, 71, 71,
! 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
!
! 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
! 71, 71, 71
} ;
--- 350,420 ----
} ;
! static yyconst int yy_meta[29] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
! 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
! 1, 1, 1, 1, 1, 1, 1, 1
} ;
! static yyconst short int yy_base[84] =
{ 0,
! 0, 9, 84, 83, 93, 96, 18, 20, 89, 85,
! 63, 77, 75, 96, 0, 96, 22, 84, 96, 80,
! 71, 63, 59, 0, 64, 65, 65, 57, 51, 62,
! 71, 63, 53, 13, 57, 67, 54, 55, 57, 46,
! 52, 46, 53, 39, 43, 43, 96, 39, 39, 37,
! 35, 30, 42, 34, 35, 34, 32, 36, 35, 22,
! 33, 25, 96, 20, 10, 30, 96, 9, 15, 8,
! 96, 9, 18, 8, 2, 96, 12, 96, 96, 41,
! 43, 45, 0
} ;
! static yyconst short int yy_def[84] =
{ 0,
! 80, 80, 81, 81, 79, 79, 79, 79, 82, 79,
! 79, 79, 79, 79, 83, 79, 79, 82, 79, 79,
! 79, 79, 79, 83, 79, 79, 79, 79, 79, 79,
! 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
! 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
! 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
! 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
! 79, 79, 79, 79, 79, 79, 79, 79, 0, 79,
! 79, 79, 79
} ;
! static yyconst short int yy_nxt[125] =
{ 0,
! 24, 7, 8, 9, 79, 10, 11, 12, 13, 14,
! 7, 8, 9, 79, 10, 11, 12, 13, 14, 17,
! 17, 17, 17, 17, 17, 37, 78, 77, 76, 75,
! 74, 73, 72, 71, 70, 69, 38, 39, 68, 67,
! 40, 6, 6, 15, 15, 18, 18, 66, 65, 64,
! 63, 62, 61, 60, 59, 58, 57, 56, 55, 54,
53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
! 43, 42, 41, 36, 35, 34, 33, 32, 31, 30,
! 29, 28, 27, 26, 25, 20, 19, 23, 22, 21,
! 20, 19, 79, 16, 16, 5, 79, 79, 79, 79,
!
! 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
! 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
! 79, 79, 79, 79
} ;
! static yyconst short int yy_chk[125] =
{ 0,
! 83, 1, 1, 1, 0, 1, 1, 1, 1, 1,
! 2, 2, 2, 0, 2, 2, 2, 2, 2, 7,
! 7, 8, 8, 17, 17, 34, 77, 75, 74, 73,
! 72, 70, 69, 68, 66, 65, 34, 34, 64, 62,
! 34, 80, 80, 81, 81, 82, 82, 61, 60, 59,
! 58, 57, 56, 55, 54, 53, 52, 51, 50, 49,
! 48, 46, 45, 44, 43, 42, 41, 40, 39, 38,
! 37, 36, 35, 33, 32, 31, 30, 29, 28, 27,
! 26, 25, 23, 22, 21, 20, 18, 13, 12, 11,
! 10, 9, 5, 4, 3, 79, 79, 79, 79, 79,
!
! 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
! 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
! 79, 79, 79, 79
} ;
***************
*** 452,456 ****
#define YY_NO_UNPUT 1
#define YY_NEVER_INTERACTIVE 1
! #line 455 "lex.prefs.cc"
/* Macros after this point can all be overridden by user definitions in
--- 456,460 ----
#define YY_NO_UNPUT 1
#define YY_NEVER_INTERACTIVE 1
! #line 459 "lex.prefs.cc"
/* Macros after this point can all be overridden by user definitions in
***************
*** 606,610 ****
! #line 609 "lex.prefs.cc"
if ( yy_init )
--- 610,614 ----
! #line 613 "lex.prefs.cc"
if ( yy_init )
***************
*** 657,661 ****
{
yy_current_state = (int)
yy_def[yy_current_state];
! if ( yy_current_state >= 72 )
yy_c = yy_meta[(unsigned int) yy_c];
}
--- 661,665 ----
{
yy_current_state = (int)
yy_def[yy_current_state];
! if ( yy_current_state >= 80 )
yy_c = yy_meta[(unsigned int) yy_c];
}
***************
*** 663,667 ****
++yy_cp;
}
! while ( yy_base[yy_current_state] != 87 );
yy_find_action:
--- 667,671 ----
++yy_cp;
}
! while ( yy_base[yy_current_state] != 96 );
yy_find_action:
***************
*** 702,758 ****
YY_RULE_SETUP
#line 34 "prefs.l"
! return PREFS_AUDIO_CHANNELS;
YY_BREAK
case 4:
YY_RULE_SETUP
#line 35 "prefs.l"
! return PREFS_AUDIO_RESOLUTION;
YY_BREAK
case 5:
YY_RULE_SETUP
#line 36 "prefs.l"
! return PREFS_AUDIO_SAMPLE_RATE;
YY_BREAK
case 6:
YY_RULE_SETUP
#line 37 "prefs.l"
! return PREFS_AUDIO_VOLUME;
YY_BREAK
case 7:
YY_RULE_SETUP
! #line 39 "prefs.l"
! mytext = ""; BEGIN(text);
YY_BREAK
case 8:
YY_RULE_SETUP
#line 40 "prefs.l"
! BEGIN(INITIAL); return PREFS_STR;
YY_BREAK
case 9:
YY_RULE_SETUP
#line 41 "prefs.l"
! mytext += yytext;
YY_BREAK
case 10:
YY_RULE_SETUP
! #line 43 "prefs.l"
! mynum = atoi (yytext); return PREFS_NUM;
YY_BREAK
case 11:
YY_RULE_SETUP
! #line 45 "prefs.l"
! ;
YY_BREAK
case 12:
YY_RULE_SETUP
#line 46 "prefs.l"
! return PREFS_UNKNOWN;
YY_BREAK
case 13:
YY_RULE_SETUP
#line 47 "prefs.l"
ECHO;
YY_BREAK
! #line 757 "lex.prefs.cc"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(text):
--- 706,767 ----
YY_RULE_SETUP
#line 34 "prefs.l"
! return PREFS_LANGUAGE;
YY_BREAK
case 4:
YY_RULE_SETUP
#line 35 "prefs.l"
! return PREFS_AUDIO_CHANNELS;
YY_BREAK
case 5:
YY_RULE_SETUP
#line 36 "prefs.l"
! return PREFS_AUDIO_RESOLUTION;
YY_BREAK
case 6:
YY_RULE_SETUP
#line 37 "prefs.l"
! return PREFS_AUDIO_SAMPLE_RATE;
YY_BREAK
case 7:
YY_RULE_SETUP
! #line 38 "prefs.l"
! return PREFS_AUDIO_VOLUME;
YY_BREAK
case 8:
YY_RULE_SETUP
#line 40 "prefs.l"
! mytext = ""; BEGIN(text);
YY_BREAK
case 9:
YY_RULE_SETUP
#line 41 "prefs.l"
! BEGIN(INITIAL); return PREFS_STR;
YY_BREAK
case 10:
YY_RULE_SETUP
! #line 42 "prefs.l"
! mytext += yytext;
YY_BREAK
case 11:
YY_RULE_SETUP
! #line 44 "prefs.l"
! mynum = atoi (yytext); return PREFS_NUM;
YY_BREAK
case 12:
YY_RULE_SETUP
#line 46 "prefs.l"
! ;
YY_BREAK
case 13:
YY_RULE_SETUP
#line 47 "prefs.l"
+ return PREFS_UNKNOWN;
+ YY_BREAK
+ case 14:
+ YY_RULE_SETUP
+ #line 48 "prefs.l"
ECHO;
YY_BREAK
! #line 766 "lex.prefs.cc"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(text):
***************
*** 1047,1051 ****
{
yy_current_state = (int) yy_def[yy_current_state];
! if ( yy_current_state >= 72 )
yy_c = yy_meta[(unsigned int) yy_c];
}
--- 1056,1060 ----
{
yy_current_state = (int) yy_def[yy_current_state];
! if ( yy_current_state >= 80 )
yy_c = yy_meta[(unsigned int) yy_c];
}
***************
*** 1082,1090 ****
{
yy_current_state = (int) yy_def[yy_current_state];
! if ( yy_current_state >= 72 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)
yy_c];
! yy_is_jam = (yy_current_state == 71);
return yy_is_jam ? 0 : yy_current_state;
--- 1091,1099 ----
{
yy_current_state = (int) yy_def[yy_current_state];
! if ( yy_current_state >= 80 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)
yy_c];
! yy_is_jam = (yy_current_state == 79);
return yy_is_jam ? 0 : yy_current_state;
***************
*** 1321,1325 ****
#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
! extern int isatty YY_PROTO(( int ));
#endif
#endif
--- 1330,1334 ----
#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
! #include<unistd.h>
#endif
#endif
***************
*** 1641,1643 ****
}
#endif
! #line 47 "prefs.l"
--- 1650,1652 ----
}
#endif
! #line 48 "prefs.l"
Index: main.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/main.cc,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** main.cc 12 Apr 2002 15:35:40 -0000 1.42
--- main.cc 13 Apr 2002 11:05:10 -0000 1.43
***************
*** 23,32 ****
*/
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
-
- #include <locale.h>
- #include "gettext.h"
#include "audio.h"
#include "character.h"
--- 23,26 ----
***************
*** 34,37 ****
--- 28,32 ----
#include "gamedata.h"
#include "input.h"
+ #include "nls.h"
#include "python_class.h"
#include "screen.h"
***************
*** 112,122 ****
game::init (myconfig.gamedir);
! // Init i18n
! setlocale (LC_MESSAGES, "");
- // open the catalogue
- bindtextdomain (myconfig.game_name.c_str (), "/usr/local/share/locale");
- textdomain (myconfig.game_name.c_str ());
-
// init game loading/saving system
gamedata::init (myconfig.get_adonthellrc (), myconfig.gamedir,
myconfig.game_name);
--- 107,113 ----
game::init (myconfig.gamedir);
! // init national language support
! nls::init (myconfig);
// init game loading/saving system
gamedata::init (myconfig.get_adonthellrc (), myconfig.gamedir,
myconfig.game_name);
Index: prefs.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/prefs.cc,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** prefs.cc 7 Apr 2002 09:51:28 -0000 1.11
--- prefs.cc 13 Apr 2002 11:05:10 -0000 1.12
***************
*** 2,6 ****
$Id$
! Copyright (C) 2000 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 2000/2001/2002 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
***************
*** 13,16 ****
--- 13,23 ----
*/
+ /**
+ * @file prefs.cc
+ *
+ * @author Kai Sterker
+ * @brief Adonthell's configuration
+ */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
***************
*** 36,45 ****
{
// set some default values where possible
! datadir = "/usr/local/share/adonthell"; // Directory containing the
gamedata
! screen_mode = 0; // Fullscreen
! audio_channels = 1; // Stereo
! audio_resolution = 1; // 16 bit
! audio_sample_rate = 2; // 11025, 22050 or 44100 Hz
! audio_volume = 100; // 0 - 100%
// set the path to the adonthellrc file:
--- 43,53 ----
{
// set some default values where possible
! datadir = DATA_DIR; // Directory containing the gamedata
! screen_mode = 0; // Fullscreen
! language = "en"; // English
! audio_channels = 1; // Stereo
! audio_resolution = 1; // 16 bit
! audio_sample_rate = 2; // 11025, 22050 or 44100 Hz
! audio_volume = 100; // 0 - 100%
// set the path to the adonthellrc file:
***************
*** 251,254 ****
--- 259,263 ----
<< "# Screen-mode num\n# 0 Windowed mode\n"
<< "# 1 Fullscreen mode\n Screen-mode " << (int) screen_mode <<
"\n\n"
+ << "# Language [country code]\n Language [" << language << "]\n\n"
<< "# Audio-channels num\n# 0 Mono\n# 1 Stereo\n"
<< " Audio-channels " << (int) audio_channels << "\n\n"
***************
*** 263,267 ****
}
! int config::read_adonthellrc ()
{
int n, i = 1;
--- 272,276 ----
}
! bool config::read_adonthellrc ()
{
int n, i = 1;
***************
*** 284,288 ****
// now try again
! if (!(prefsin = fopen (fname.c_str (), "r"))) return 0;
}
--- 293,297 ----
// now try again
! if (!(prefsin = fopen (fname.c_str (), "r"))) return false;
}
***************
*** 331,334 ****
fclose (prefsin);
! return 1;
}
--- 340,343 ----
fclose (prefsin);
! return true;
}
Index: prefs.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/prefs.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** prefs.h 26 Jul 2001 20:27:49 -0000 1.11
--- prefs.h 13 Apr 2002 11:05:10 -0000 1.12
***************
*** 2,6 ****
$Id$
! Copyright (C) 2000 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 2000/2002 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
***************
*** 13,16 ****
--- 13,23 ----
*/
+ /**
+ * @file prefs.h
+ *
+ * @author Kai Sterker
+ * @brief Adonthell's configuration
+ */
+
#ifndef __PREFS_H__
#define __PREFS_H__
***************
*** 19,24 ****
#include <fstream.h>
#include "types.h"
-
-
#ifndef SWIG
--- 26,29 ----
***************
*** 26,67 ****
#endif
!
extern FILE* prefsin;
extern int parse_adonthellrc (int&, string&);
enum
{
PREFS_UNKNOWN = 0,
! PREFS_SCREEN_MODE = 6,
! PREFS_AUDIO_CHANNELS = 8,
! PREFS_AUDIO_RESOLUTION = 9,
! PREFS_AUDIO_SAMPLE_RATE = 10,
! PREFS_AUDIO_VOLUME = 12,
! PREFS_NUM = 13,
! PREFS_STR = 14,
};
! // Contains all the configuration information
class config
{
public:
config ();
void parse_arguments (int argc, char * argv[]);
! void write_adonthellrc (); // Writes a default adonthellrc
! int read_adonthellrc (); // Reads the adonthellrc file
! char *get_adonthellrc (); // Return the user's private adonthell
directory
!
! string game_name; // Name of the game that will be played
! string gamedir; // Directory containing the game that
will be played
! string datadir; // Directory containing the gamedata
! u_int8 screen_mode; // Window or Fullscreen
! u_int8 audio_channels; // Mono or Stereo
! u_int8 audio_resolution; // 8 or 16 bit
! u_int8 audio_sample_rate; // 11025, 22050 or 44100 Hz
! u_int8 audio_volume; // 0 - 100%
!
private:
config & operator = (const config*);
--- 31,158 ----
#endif
! /**
! * The config file opened by the lexical scanner
! */
extern FILE* prefsin;
+
+ /**
+ * Start the lexical scanner to parse the config file,
+ * usually fount at ~/.adonthell/adonthellrc
+ */
extern int parse_adonthellrc (int&, string&);
+ /**
+ * Returncodes of the scanner for the different entries
+ * of the configuration file.
+ */
enum
{
PREFS_UNKNOWN = 0,
! PREFS_SCREEN_MODE = 1,
! PREFS_LANGUAGE = 2,
! PREFS_AUDIO_CHANNELS = 3,
! PREFS_AUDIO_RESOLUTION = 4,
! PREFS_AUDIO_SAMPLE_RATE = 5,
! PREFS_AUDIO_VOLUME = 6,
! PREFS_NUM = 7,
! PREFS_STR = 8,
};
! /**
! * This class contains the engine's configuration read either from the
! * %config file or from the command line.
! */
class config
{
public:
+ /**
+ * Constructor. Initializes all configuration options with default
+ * values.
+ * - Language: English
+ * - Screen mode: Windowed
+ * - Audio: High quality (44.1kHz, 16 bit, stereo)
+ * - Volume: 100%
+ * - Config file: $HOME/.adonthell/adonthellrc
+ */
config ();
+ /**
+ * See whether any options have been specified on the command line.
+ * Possible command line options are
+ * - <b>\-h</b> Print help message
+ * - <b>\-d</b> Print the data directory
+ * - <b>\-v</b> Print the version number
+ * - <b>\-l</b> List games found in the gamedir
+ * - <b>\-g dir</b> Play %game contained in dir
+ * - <b>\-c</b> Byte-compile all Python scripts in the current directory
+ *
+ * @param argc argument count
+ * @param argv argument vector
+ */
void parse_arguments (int argc, char * argv[]);
! /**
! * Writes a default configuration file with the values set in the
! * constructor
! * @sa config::config ()
! */
! void write_adonthellrc ();
! /**
! * Reads the configuration file. If it cannot find the file, it
! * tries to write a default one.
! * @return <b>true</b> on success, <b>false</b> otherwise.
! */
! bool read_adonthellrc ();
! /**
! * Returns the path to the user's private Adonthell directory.
! * Usually this is $HOME/.adonthell/ and will contain his personal
! * configuration as well as all saved games.
! */
! char *get_adonthellrc ();
!
! /**
! * @name Configuration options
! */
! //@{
! /**
! * Language to use if NLS was compiled in.
! */
! string language;
! /**
! * Name of the %game that is running at present.
! */
! string game_name;
! /**
! * Path of the directory that contains the %game running at present.
! */
! string gamedir;
! /**
! * Path to the %data directory.
! */
! string datadir;
! /**
! * Whether the engine shall run in window (0) or fullscreen (1) mode.
! */
! u_int8 screen_mode;
! /**
! * The number of channels: mono (0) or stereo (1).
! */
! u_int8 audio_channels;
! /**
! * The resolution: 8 bit (0) or 16 bit (1)
! */
! u_int8 audio_resolution;
! /**
! * The sample rate: 11025 Hz (0), 22050 Hz (1) or 44100 Hz (2)
! */
! u_int8 audio_sample_rate;
! /**
! * The volume: a value betwen 0 and 100. 0 means that audio
! * is completely off.
! */
! u_int8 audio_volume;
! //@}
!
private:
config & operator = (const config*);
Index: prefs.l
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/prefs.l,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** prefs.l 26 Jul 2001 20:27:49 -0000 1.6
--- prefs.l 13 Apr 2002 11:05:10 -0000 1.7
***************
*** 32,35 ****
--- 32,36 ----
Screen-mode return PREFS_SCREEN_MODE;
+ Language return PREFS_LANGUAGE;
Audio-channels return PREFS_AUDIO_CHANNELS;
Audio-resolution return PREFS_AUDIO_RESOLUTION;
Index: py_adonthell.i
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/py_adonthell.i,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** py_adonthell.i 27 Jan 2002 12:51:14 -0000 1.31
--- py_adonthell.i 13 Apr 2002 11:05:10 -0000 1.32
***************
*** 45,48 ****
--- 45,49 ----
#include "gamedata.h"
#include "game.h"
+ #include "nls.h"
// Workaround for keysym missing in older versions of SDL
***************
*** 158,159 ****
--- 159,161 ----
%include "gamedata.h"
%include "game.h"
+ %include "nls.h"
Index: text_bubble.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/text_bubble.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** text_bubble.cc 19 Sep 2001 18:32:02 -0000 1.4
--- text_bubble.cc 13 Apr 2002 11:05:10 -0000 1.5
***************
*** 2,6 ****
$Id$
! Copyright (C) 2001 Kai Sterker <address@hidden>
Copyright (C) 2001 Alexandre Courbot <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 2001/2002 Kai Sterker <address@hidden>
Copyright (C) 2001 Alexandre Courbot <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
***************
*** 24,28 ****
*
*/
!
#include "text_bubble.h"
#include "win_manager.h"
--- 24,29 ----
*
*/
!
! #include "nls.h"
#include "text_bubble.h"
#include "win_manager.h"
***************
*** 42,46 ****
label::resize (len, 0);
set_form (label::AUTO_HEIGHT);
! set_text (text);
set_visible_border (true);
set_visible_background (true);
--- 43,47 ----
label::resize (len, 0);
set_form (label::AUTO_HEIGHT);
! set_text (nls::gettext (text));
set_visible_border (true);
set_visible_background (true);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src nls.cc,NONE,1.1 nls.h,NONE,1.1 Makefile.am,1.81,1.82 dialog.cc,1.23,1.24 lex.prefs.cc,1.5,1.6 main.cc,1.42,1.43 prefs.cc,1.11,1.12 prefs.h,1.11,1.12 prefs.l,1.6,1.7 py_adonthell.i,1.31,1.32 text_bubble.cc,1.4,1.5,
Kai Sterker <address@hidden> <=