Bug #558 ยป 0002-Don-t-establish-player-contact-via-flagless-units.patch
| server/citytools.c | ||
|---|---|---|
|       return; | ||
|     } | ||
|     maybe_make_contact(utile, to_player); | ||
|     unit_make_contact(punit, utile, to_player); | ||
|   } | ||
|   unit_change_homecity_handling(punit, tocity, rehome); | ||
| } | ||
| server/plrhand.c | ||
|---|---|---|
|       make_contact(pplayer, city_owner(pcity), ptile); | ||
|     } | ||
|     unit_list_iterate_safe(tile1->units, punit) { | ||
|       if (unit_has_type_flag(punit, UTYF_FLAGLESS)) { | ||
|         continue; /* Flagless unit can't make contact */ | ||
|       } | ||
|       make_contact(pplayer, unit_owner(punit), ptile); | ||
|     } unit_list_iterate_safe_end; | ||
|   } square_iterate_end; | ||
| server/unithand.c | ||
|---|---|---|
|        * distant target tile and maybe some contacts. */ | ||
|       map_show_circle(pplayer, tgt_tile, | ||
|                       unit_type_get(act_unit)->vision_radius_sq); | ||
|       maybe_make_contact(tgt_tile, pplayer); | ||
|       unit_make_contact(act_unit, tgt_tile, pplayer); | ||
|     } | ||
|     if (act_unit->hp > 0) { | ||
| server/unittools.c | ||
|---|---|---|
|   unit_list_prepend(pplayer->units, punit); | ||
|   unit_list_prepend(ptile->units, punit); | ||
|   maybe_make_contact(ptile, unit_owner(punit)); | ||
|   unit_make_contact(punit, ptile, nullptr); | ||
|   if (pcity && !unit_has_type_flag(punit, UTYF_NOHOME)) { | ||
|     fc_assert(punit->homecity == pcity->id); | ||
|     fc_assert(city_owner(pcity) == pplayer); | ||
| ... | ... | |
|     char victim_link[MAX_LEN_LINK]; | ||
|     map_show_circle(pplayer, ptile, act_utype->vision_radius_sq); | ||
|     maybe_make_contact(ptile, pplayer); | ||
|     unit_make_contact(punit, ptile, pplayer); | ||
|     notify_player(pplayer, ptile, E_UNIT_LOST_MISC, ftc_server, | ||
|                   _("Your %s was killed by enemy units at the " | ||
|                     "paradrop destination."), | ||
| ... | ... | |
|   if (unit_lives) { | ||
|     wakeup_neighbor_sentries(punit); | ||
|   } | ||
|   maybe_make_contact(pdesttile, pplayer); | ||
|   unit_make_contact(punit, pdesttile, pplayer); | ||
|   if (unit_lives) { | ||
|     /* Special checks for ground units in the ocean. */ | ||
| ... | ... | |
|   game.server.random_move_time = NULL; | ||
| } | ||
| /**********************************************************************//** | ||
|   Make contact between a player and everyone adjacent to a tile via a unit | ||
|   moving to that tile. Tile and player default to the unit's location and | ||
|   owner if nullptr, but they may be different. | ||
| **************************************************************************/ | ||
| void unit_make_contact(const struct unit *punit, | ||
|                        struct tile *ptile, struct player *pplayer) { | ||
|   fc_assert_ret(punit != nullptr); | ||
|   if (unit_has_type_flag(punit, UTYF_FLAGLESS)) { | ||
|     return; /* Flagless unit can't make contact */ | ||
|   } | ||
|   maybe_make_contact(ptile ? ptile : unit_tile(punit), | ||
|                      pplayer ? pplayer : unit_owner(punit)); | ||
| } | ||
| server/unittools.h | ||
|---|---|---|
|                                           enum unit_activity *activity, | ||
|                                           struct extra_type **target); | ||
| void unit_forget_last_activity(struct unit *punit); | ||
| void unit_make_contact(const struct unit *punit, | ||
|                        struct tile *ptile, struct player *pplayer); | ||
| /* creation/deletion/upgrading */ | ||
| void transform_unit(struct unit *punit, const struct unit_type *to_unit, | ||