t"Armour" rating added for players, bitches, cops and deputies - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 5ebfa83f281e86dc72f327e880ab53979dddd460
 (DIR) parent 43ce87336da1f84fc60b983b800e7590003cd8f0
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Thu,  5 Apr 2001 23:41:16 +0000
       
       "Armour" rating added for players, bitches, cops and deputies
       
       
       Diffstat:
         M src/dopewars.c                      |      20 ++++++++++++++------
         M src/dopewars.h                      |       5 +++--
         M src/gtk_client.c                    |       1 +
         M src/serverside.c                    |      12 +++++++++++-
       
       4 files changed, 29 insertions(+), 9 deletions(-)
       ---
 (DIR) diff --git a/src/dopewars.c b/src/dopewars.c
       t@@ -125,6 +125,8 @@ struct METASERVER DefaultMetaServer = {
        };
        int NumTurns=31;
        
       +int PlayerArmour=100,BitchArmour=60;
       +
        struct GLOBALS Globals[NUMGLOB] = {
           { &Port,NULL,NULL,NULL,"Port",N_("Network port to connect to"),
             NULL,NULL,0,"",NULL,NULL },
       t@@ -233,6 +235,12 @@ struct GLOBALS Globals[NUMGLOB] = {
             N_("Maximum number of drugs at each location"),
             (void **)(&Location),&StaticLocation,
             sizeof(struct LOCATION),"Location",&NumLocation,NULL },
       +   { &PlayerArmour,NULL,NULL,NULL,"PlayerArmour",
       +     N_("% resistance to gunshots of each player"),
       +     NULL,NULL,0,"",NULL,NULL },
       +   { &BitchArmour,NULL,NULL,NULL,"BitchArmour",
       +     N_("% resistance to gunshots of each bitch"),
       +     NULL,NULL,0,"",NULL,NULL },
           { NULL,NULL,&StaticCop.Name,NULL,"Name",
             N_("Name of each cop"),
             (void **)(&Cop),&StaticCop,sizeof(struct COP),"Cop",&NumCop,NULL },
       t@@ -242,11 +250,11 @@ struct GLOBALS Globals[NUMGLOB] = {
           { NULL,NULL,&StaticCop.DeputiesName,NULL,"DeputiesName",
             N_("Name of each cop's deputies"),
             (void **)(&Cop),&StaticCop,sizeof(struct COP),"Cop",&NumCop,NULL },
       -   { &StaticCop.Health,NULL,NULL,NULL,"Health",
       -     N_("Health of each cop"),
       +   { &StaticCop.Armour,NULL,NULL,NULL,"Armour",
       +     N_("% resistance to gunshots of each cop"),
             (void **)(&Cop),&StaticCop,sizeof(struct COP),"Cop",&NumCop,NULL },
       -   { &StaticCop.DeputyHealth,NULL,NULL,NULL,"DeputyHealth",
       -     N_("Health of each cop's deputy"),
       +   { &StaticCop.DeputyArmour,NULL,NULL,NULL,"DeputyArmour",
       +     N_("% resistance to gunshots of each deputy"),
             (void **)(&Cop),&StaticCop,sizeof(struct COP),"Cop",&NumCop,NULL },
           { &StaticCop.AttackPenalty,NULL,NULL,NULL,"AttackPenalty",
             N_("Attack penalty relative to a player"),
       t@@ -1136,8 +1144,8 @@ void CopyCop(struct COP *dest,struct COP *src) {
           AssignName(&dest->Name,_(src->Name));
           AssignName(&dest->DeputyName,_(src->DeputyName));
           AssignName(&dest->DeputiesName,_(src->DeputiesName));
       -   dest->Health=src->Health;
       -   dest->DeputyHealth=src->DeputyHealth;
       +   dest->Armour=src->Armour;
       +   dest->DeputyArmour=src->DeputyArmour;
           dest->AttackPenalty=src->AttackPenalty;
           dest->DefendPenalty=src->DefendPenalty;
           dest->MinDeputies=src->MinDeputies;
 (DIR) diff --git a/src/dopewars.h b/src/dopewars.h
       t@@ -124,6 +124,7 @@ extern price_t StartCash,StartDebt;
        extern struct NAMES Names;
        extern struct METASERVER MetaServer;
        extern int NumTurns;
       +extern int PlayerArmour,BitchArmour;
        
        #define DM_NONE       0
        #define DM_STREET     1
       t@@ -206,7 +207,7 @@ extern int NumTurns;
        
        struct COP {
           gchar *Name,*DeputyName,*DeputiesName;
       -   gint Health,DeputyHealth;
       +   gint Armour,DeputyArmour;
           gint AttackPenalty,DefendPenalty;
           gint MinDeputies,MaxDeputies;
           gint GunIndex;
       t@@ -319,7 +320,7 @@ typedef struct tag_serverdata {
           char *Comment,*Version,*Update,*UpSince;
        } ServerData;
        
       -#define NUMGLOB 84
       +#define NUMGLOB 86
        struct GLOBALS {
           int *IntVal;
           price_t *PriceVal;
 (DIR) diff --git a/src/gtk_client.c b/src/gtk_client.c
       t@@ -651,6 +651,7 @@ static void CreateFightDialog() {
           gchar *buf;
        
           FightDialog=dialog=gtk_window_new(GTK_WINDOW_DIALOG);
       +   gtk_window_set_default_size(GTK_WINDOW(dialog),450,300);
           gtk_signal_connect(GTK_OBJECT(dialog),"delete_event",
                              GTK_SIGNAL_FUNC(DisallowDelete),NULL);
           gtk_window_set_default_size(GTK_WINDOW(dialog),240,130);
 (DIR) diff --git a/src/serverside.c b/src/serverside.c
       t@@ -1449,6 +1449,16 @@ static Player *GetFireTarget(Player *Play) {
           return NULL;
        }
        
       +static int GetArmour(Player *Play) {
       +   if (IsCop(Play)) {
       +      if (Play->Bitches.Carried==0) return Cop[Play->CopIndex-1].Armour;
       +      else return Cop[Play->CopIndex-1].DeputyArmour;
       +   } else {
       +      if (Play->Bitches.Carried==0) return PlayerArmour;
       +      else return BitchArmour;
       +   }
       +}
       +
        void Fire(Player *Play) {
        /* Fires all weapons of player "Play" at an opponent, and resets  */
        /* the fight timeout (the reload time)                            */
       t@@ -1473,7 +1483,7 @@ void Fire(Player *Play) {
                 if (brandom(0,AttackRating)>brandom(0,DefendRating)) {
                    FightPoint=F_HIT;
                    for (i=0;i<NumGun;i++) for (j=0;j<Play->Guns[i].Carried;j++) {
       -               Damage+=brandom(0,Gun[i].Damage);
       +               Damage+=brandom(0,Gun[i].Damage)*100/GetArmour(Play);
                    }
                    if (Damage==0) Damage=1;
                    HandleDamage(Defend,Play,Damage,&BitchesKilled,&Loot);