tInitial support for new fighting code added to GTK+ client - vaccinewars - be … | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 001a80142b0fb405b15b8353bc9427cffd05228a | |
parent 72b7a1e3f3c0b29e27f2b98445df4ccde9f95913 | |
Author: Ben Webb <[email protected]> | |
Date: Sun, 22 Oct 2000 16:35:29 +0000 | |
Initial support for new fighting code added to GTK+ client | |
Diffstat: | |
M src/curses_client.c | 1 + | |
M src/gtk_client.c | 1 + | |
M src/message.c | 21 +++++++++++++++++++-- | |
M src/message.h | 1 + | |
M src/serverside.c | 2 +- | |
5 files changed, 23 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/src/curses_client.c b/src/curses_client.c | |
t@@ -1421,6 +1421,7 @@ static void Curses_DoGame(Player *Play) { | |
display_message(""); | |
InitAbilities(Play); | |
+ SetAbility(Play,A_NEWFIGHT,FALSE); | |
SendAbilities(Play); | |
SetPlayerName(Play,buf); | |
SendNullClientMessage(Play,C_NONE,C_NAME,NULL,buf); | |
diff --git a/src/gtk_client.c b/src/gtk_client.c | |
t@@ -1200,6 +1200,7 @@ void StartGame() { | |
Play=ClientData.Play=g_new(Player,1); | |
FirstClient=AddPlayer(0,Play,FirstClient); | |
Play->fd=ClientSock; | |
+ InitAbilities(Play); | |
SendAbilities(Play); | |
SetPlayerName(Play,ClientData.PlayerName); | |
SendNullClientMessage(Play,C_NONE,C_NAME,NULL,ClientData.PlayerName); | |
diff --git a/src/message.c b/src/message.c | |
t@@ -209,9 +209,14 @@ void InitAbilities(Player *Play) { | |
Play->Abil.Remote[i]=FALSE; | |
Play->Abil.Shared[i]=FALSE; | |
} | |
-/* Set local abilities */ | |
+/* Set local abilities; abilities that are client-dependent | |
+ (e.g. A_NEWFIGHT) can be overridden by individual clients if required, | |
+ by calling SetAbility, prior to calling SendAbilities */ | |
+ | |
Play->Abil.Local[A_PLAYERID]=TRUE; | |
+ Play->Abil.Local[A_NEWFIGHT]=TRUE; | |
Play->Abil.Local[A_DRUGVALUE]=(DrugValue ? TRUE : FALSE); | |
+ | |
if (!Network) for (i=0;i<A_NUM;i++) { | |
Play->Abil.Remote[i]=Play->Abil.Shared[i]=Play->Abil.Local[i]; | |
} | |
t@@ -252,6 +257,18 @@ void CombineAbilities(Player *Play) { | |
} | |
} | |
+void SetAbility(Player *Play,gint Type,gboolean Set) { | |
+/* Sets ability "Type" of player "Play", and also sets shared abilities if */ | |
+/* networking is not active (the local server should support all abilities */ | |
+/* that the client uses). Call this function prior to calling SendAbilities */ | |
+/* so that the ability is recognised properly when networking _is_ active */ | |
+ if (Type<0 || Type>=A_NUM) return; | |
+ Play->Abil.Local[Type]=Set; | |
+ if (!Network) { | |
+ Play->Abil.Remote[Type]=Play->Abil.Shared[Type]=Play->Abil.Local[Type]; | |
+ } | |
+} | |
+ | |
gboolean HaveAbility(Player *Play,gint Type) { | |
/* Returns TRUE if ability "Type" is one of player "Play"'s shared abilities */ | |
if (Type<0 || Type>=A_NUM) return FALSE; | |
t@@ -769,7 +786,7 @@ int ProcessMessage(char *Msg,Player *Play,Player **Other,c… | |
gchar *pt,*buf; | |
guint ID; | |
- if (!First || !Play) return; | |
+ if (!First || !Play) return -1; | |
*AICode=*Code=C_NONE; | |
*Other=&Noone; | |
diff --git a/src/message.h b/src/message.h | |
t@@ -160,6 +160,7 @@ void InitAbilities(Player *Play); | |
void SendAbilities(Player *Play); | |
void ReceiveAbilities(Player *Play,gchar *Data); | |
void CombineAbilities(Player *Play); | |
+void SetAbility(Player *Play,gint Type,gboolean Set); | |
gboolean HaveAbility(Player *Play,gint Type); | |
void SendFightReload(Player *To); | |
void SendOldCanFireMessage(Player *To,GString *text); | |
diff --git a/src/serverside.c b/src/serverside.c | |
t@@ -664,7 +664,7 @@ gboolean HandleServerCommand(char *string) { | |
g_print(_("Users currently logged on:-\n")); | |
for (list=FirstServer;list;list=g_slist_next(list)) { | |
tmp=(Player *)list->data; | |
- g_print("%s\n",GetPlayerName(tmp)); | |
+ if (!tmp->IsCop) g_print("%s\n",GetPlayerName(tmp)); | |
} | |
} else g_message(_("No users currently logged on!")); | |
} else if (strncasecmp(string,"push ",5)==0) { |