~ubuntu-branches/debian/sid/freeciv/sid

« back to all changes in this revision

Viewing changes to server/diplomats.c

  • Committer: Bazaar Package Importer
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2009-11-27 23:24:00 UTC
  • mfrom: (7.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091127232400-nmoil1yvvskugn1h
[ Karl Goetz ]
* New upstream release
* Bump standards-version to 3.8.3
* Update watch file
  - Now version 3
  - Switched to gna.org instead of sf.net
* Switch readline dev dependency to libreadline-dev instead of
libreadline5-dev. Closes: #553758
* Changed compat to 5
* Relaxed dependencies on freeciv-server for sdl and gtk clients,
freeciv-server is now a recommends
* Stop d/rules trying to gzip scenarios - upstream does this.
* Remove export of datarootdir in d/rules, upstream seems to handle
this correctly now.
* Deleted 01_configure_ac_localedir.diff from d/patches/ and from series.
* Create per-client .desktop files. Closes: #470978, LP: #190555
* Desktop files mention which client they are (sdl/gtk/xaw3d).
* Add myself to uploaders on Clint's suggestion.

[ Clint Adams ]
* Change watch file to grab bz2 tarballs.
* Switch to 3.0 (quilt) source format.
* Remove quilt code from debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1024
1024
 
1025
1025
/**************************************************************************
1026
1026
  This determines if a diplomat/spy succeeds against some defender,
1027
 
  who is also a diplomat or spy.
 
1027
  who is also a diplomat or spy. Note: a superspy attacker always
 
1028
  succeeds, otherwise a superspy defender always wins.
1028
1029
 
1029
1030
  Return TRUE if the "attacker" succeeds.
1030
1031
**************************************************************************/
1031
 
static bool diplomat_success_vs_defender (struct unit *pattacker, 
1032
 
        struct unit *pdefender, struct tile *pdefender_tile)
 
1032
static bool diplomat_success_vs_defender(struct unit *pattacker,
 
1033
                                         struct unit *pdefender,
 
1034
                                         struct tile *pdefender_tile)
1033
1035
{
1034
1036
  int chance = 50; /* Base 50% chance */
1035
1037
 
 
1038
  if (unit_has_type_flag(pattacker, F_SUPERSPY)) {
 
1039
    return TRUE;
 
1040
  }
1036
1041
  if (unit_has_type_flag(pdefender, F_SUPERSPY)) {
1037
 
    return TRUE;
 
1042
    return FALSE;
1038
1043
  }
1039
1044
  if (unit_has_type_flag(pattacker, F_SPY)) {
1040
1045
    chance += 25;
1051
1056
                                      EFT_SPY_RESISTANT) / 100;
1052
1057
  } else {
1053
1058
    if (tile_has_special(pdefender_tile, S_FORTRESS)
1054
 
       || tile_has_special(pdefender_tile, S_AIRBASE)) {
1055
 
        chance -= chance * 25 / 100; /* 25% penalty */
 
1059
        || tile_has_special(pdefender_tile, S_AIRBASE)) {
 
1060
      chance -= chance * 25 / 100; /* 25% penalty */
1056
1061
    }
1057
1062
  }
1058
1063
  
1059
 
  return myrand(100) > chance;
 
1064
  return myrand(100) < chance;
1060
1065
}
1061
1066
 
1062
1067
/**************************************************************************
1077
1082
  /* We don't need a _safe iterate since no transporters should be
1078
1083
   * destroyed. */
1079
1084
  unit_list_iterate(ptile->units, punit) {
1080
 
    if (unit_has_type_flag(punit, F_DIPLOMAT) || unit_has_type_flag(punit, F_SUPERSPY)) {
1081
 
      /* A F_SUPERSPY unit may not acutally be a spy, but a superboss which 
1082
 
         we cannot allow puny diplomats from getting the better of. Note that 
1083
 
         diplomat_success_vs_defender(punit) is always TRUE if the attacker
1084
 
         is F_SUPERSPY. Hence F_SUPERSPY vs F_SUPERSPY in a diplomatic contest
1085
 
         always kills the attacker. */
 
1085
    if (unit_has_type_flag(punit, F_DIPLOMAT)
 
1086
        || unit_has_type_flag(punit, F_SUPERSPY)) {
 
1087
      /* A F_SUPERSPY unit may not actually be a spy, but a superboss
 
1088
       * which we cannot allow puny diplomats from getting the better
 
1089
       * of. Note that diplomat_success_vs_defender() is always TRUE
 
1090
       * if the attacker is F_SUPERSPY. Hence F_SUPERSPY vs F_SUPERSPY
 
1091
       * in a diplomatic contest always kills the attacker. */
1086
1092
      if (diplomat_success_vs_defender(pdiplomat, punit, ptile) 
1087
1093
          && !unit_has_type_flag(punit, F_SUPERSPY)) {
1088
1094
        /* Defending Spy/Diplomat dies. */