tFixed "Abilities" code to synchronise properly - vaccinewars - be a doctor and… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 301f2895a1c13bd146df427d73cea33b0f90b672 | |
parent c726f79d0a085621f247609620335ba90536bbf9 | |
Author: Ben Webb <[email protected]> | |
Date: Tue, 12 Sep 2000 11:17:28 +0000 | |
Fixed "Abilities" code to synchronise properly | |
Diffstat: | |
M ChangeLog | 2 +- | |
M src/message.c | 9 ++++++++- | |
M src/message.h | 1 + | |
M src/serverside.c | 1 + | |
4 files changed, 11 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/ChangeLog b/ChangeLog | |
t@@ -2,7 +2,7 @@ | |
- Internationalization (i18n) support | |
- Networking revamped - now uses nonblocking sockets to improve server | |
responsiveness and to remove deadlocks (previously, any client could | |
- halt server by sending an unterminated message); Abilities added to | |
+ halt server by sending an unterminated message); "abilities" added to | |
allow backwards-compatible protocol extensions | |
- Longer T>alk and P>age messages allowed in curses client | |
- Minor bug fixes to configure options | |
diff --git a/src/message.c b/src/message.c | |
t@@ -175,6 +175,12 @@ void ReceiveAbilities(Player *Play,gchar *Data) { | |
Length=MIN(strlen(Data),A_NUM); | |
for (i=0;i<Length;i++) { | |
Play->Abil.Remote[i]= (Data[i]=='1' ? TRUE : FALSE); | |
+ } | |
+} | |
+ | |
+void CombineAbilities(Player *Play) { | |
+ int i; | |
+ for (i=0;i<A_NUM;i++) { | |
Play->Abil.Shared[i]= (Play->Abil.Remote[i] && Play->Abil.Local[i]); | |
} | |
} | |
t@@ -712,7 +718,8 @@ gboolean HandleGenericClientMessage(Player *From,char AICo… | |
case C_INIT: | |
ReceiveInitialData(Data); break; | |
case C_ABILITIES: | |
- ReceiveAbilities(To,Data); break; | |
+ ReceiveAbilities(To,Data); CombineAbilities(To); | |
+ break; | |
case C_LEAVE: | |
if (From!=&Noone) FirstClient=RemovePlayer(From,FirstClient); | |
break; | |
diff --git a/src/message.h b/src/message.h | |
t@@ -144,6 +144,7 @@ void ReadMetaServerData(int HttpSock); | |
void InitAbilities(Player *Play); | |
void SendAbilities(Player *Play); | |
void ReceiveAbilities(Player *Play,gchar *Data); | |
+void CombineAbilities(Player *Play); | |
gboolean HaveAbility(Player *Play,gint Type); | |
#endif | |
diff --git a/src/serverside.c b/src/serverside.c | |
t@@ -240,6 +240,7 @@ void HandleServerMessage(gchar *buf,Player *ReallyFrom) { | |
Network) || (!Network && From==&Noone)) && Data[0]) { | |
if (CountPlayers(FirstServer)<MaxClients || !Network) { | |
SendAbilities(ReallyFrom); | |
+ CombineAbilities(ReallyFrom); | |
SendInitialData(ReallyFrom); | |
SendMiscData(ReallyFrom); | |
if (!Network) { |