| Date: Tue, 19 Dec 2000 13:32:19 +0000
TString documentation corrected; A_TSTRING ability added to prevent new
ttstring-enabled servers from confusing old clients
Diffstat:
M doc/i18n.html | 4 ++--
M src/dopewars.h | 10 ++++++----
M src/message.c | 42 +++++++++++++++++++++++++------
M src/tstring.c | 8 ++++++++
M src/tstring.h | 2 ++
5 files changed, 52 insertions(+), 14 deletions(-)
--- |
| t@@ -113,8 +113,8 @@ Obviously dopewars cannot guess what your "alternative forms" are; you must
specify them yourself. Essentially, when setting a string in a dopewars
configuration file (or the defaults, which are set in dopewars.c) alternative
forms can be added by alternating two-letter codes and alternative forms after
-the original word, separating them by ^ symbols. For example,
-Names.Bitch = "bitch^no^bitcho^ac^bitche"
+the original word, separating them by _ (underline) symbols. For example,
+Names.Bitch = "bitch_no_bitcho_ac_bitche"
specifies two alternative forms for "bitch", identified by the "no"
and "ac" codes. You can then use "bitcho" anywhere that "bitch" is
normally used by translating the relevant string as "%tno" (and to |
| t@@ -218,6 +218,7 @@ void InitAbilities(Player *Play) {
Play->Abil.Local[A_PLAYERID]=TRUE;
Play->Abil.Local[A_NEWFIGHT]=TRUE;
Play->Abil.Local[A_DRUGVALUE]=(DrugValue ? TRUE : FALSE);
+ Play->Abil.Local[A_TSTRING]=TRUE;
if (!Network) for (i=0;iAbil.Remote[i]=Play->Abil.Shared[i]=Play->Abil.Local[i];
t@@ -506,14 +507,28 @@ void SendSpyReport(Player *To,Player *SpiedOn) {
g_string_free(text,TRUE);
}
+#define NUMNAMES 8
+
void SendInitialData(Player *To) {
+ gchar *LocalNames[NUMNAMES] = { Names.Bitch,Names.Bitches,Names.Gun,
+ Names.Guns,Names.Drug,Names.Drugs,
+ Names.Month,Names.Year };
+ gint i;
GString *text;
+
if (!Network) return;
+ if (!HaveAbility(To,A_TSTRING)) for (i=0;iID);
SendServerMessage(NULL,C_NONE,C_INIT,To,text->str);
g_string_free(text,TRUE);
t@@ -548,30 +563,41 @@ void ReceiveInitialData(Player *Play,char *Data) {
}
void SendMiscData(Player *To) {
- gchar *text,*prstr[2];
+ gchar *text,*prstr[2],*LocalName;
int i;
+ gboolean HaveTString;
if (!Network) return;
+ HaveTString=HaveAbility(To,A_TSTRING);
text=g_strdup_printf("0^%c%s^%s^",DT_PRICES,
(prstr[0]=pricetostr(Prices.Spy)),
(prstr[1]=pricetostr(Prices.Tipoff)));
SendServerMessage(NULL,C_NONE,C_DATA,To,text);
g_free(prstr[0]); g_free(prstr[1]); g_free(text);
for (i=0;i |
| t@@ -42,6 +42,14 @@ typedef struct _FmtData {
char Type;
} FmtData;
+gchar *GetDefaultTString(gchar *tstring) {
+ gchar *dstr,*pt;
+ dstr=g_strdup(tstring);
+ pt=strchr(dstr,'_');
+ if (pt) *pt='\0';
+ return dstr;
+}
+
gchar *GetTranslatedString(gchar *str,gchar *code,gboolean Caps) {
gchar *dstr,*pt,*tstr,*Default,*tcode;
|
| t@@ -35,4 +35,6 @@ gchar *dpg_strdup_printf(gchar *format, ...);
void dpg_string_sprintf(GString *string, gchar *format, ...);
void dpg_string_sprintfa(GString *string, gchar *format, ...);
+gchar *GetDefaultTString(gchar *tstring);
+
#endif /* __TSTRING_H__ */ |