Author: sveinung Date: Fri Aug 21 12:25:54 2015 New Revision: 29621 URL: http://svn.gna.org/viewcvs/freeciv?rev=29621&view=rev Log: Remove redundant can't found city explanations
Remove custom explanation for when a unit can't found a city because the unit is unable to found cities and for when city founding is prevented in the scenario. The situations can be explained with code that covers all actions. See patch #6261 Modified: trunk/common/unit.c trunk/common/unit.h trunk/server/cityhand.c trunk/server/unithand.c Modified: trunk/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=29621&r1=29620&r2=29621&view=diff ============================================================================== --- trunk/common/unit.c (original) +++ trunk/common/unit.c Fri Aug 21 12:25:54 2015 @@ -365,6 +365,7 @@ bool unit_can_build_city(const struct unit *punit) { return (unit_can_do_action(punit, ACTION_FOUND_CITY) + && !game.scenario.prevent_new_cities && unit_build_city_test(punit) == UAB_BUILD_OK); } @@ -390,13 +391,9 @@ { struct tile *ptile = unit_tile(punit); struct city *pcity = tile_city(ptile); - bool is_build = unit_is_cityfounder(punit); /* Test if we can build. */ if (NULL == pcity) { - if (!is_build) { - return UAB_NOT_BUILD_UNIT; - } switch (city_build_here_test(ptile, punit)) { case CB_OK: return UAB_BUILD_OK; Modified: trunk/common/unit.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.h?rev=29621&r1=29620&r2=29621&view=diff ============================================================================== --- trunk/common/unit.h (original) +++ trunk/common/unit.h Fri Aug 21 12:25:54 2015 @@ -61,7 +61,6 @@ UAB_BAD_UNIT_TERRAIN, /* Equivalent to 'CB_BAD_UNIT_TERRAIN'. */ UAB_BAD_BORDERS, /* Equivalent to 'CB_BAD_BORDERS'. */ UAB_NO_MIN_DIST, /* Equivalent to 'CB_NO_MIN_DIST'. */ - UAB_NOT_BUILD_UNIT, /* Unit is not one that can build cities. */ UAB_TOO_BIG, /* City is too big to be added to. */ UAB_NO_SPACE /* Adding takes city past limit. */ }; Modified: trunk/server/cityhand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/cityhand.c?rev=29621&r1=29620&r2=29621&view=diff ============================================================================== --- trunk/server/cityhand.c (original) +++ trunk/server/cityhand.c Fri Aug 21 12:25:54 2015 @@ -83,7 +83,6 @@ case UAB_BAD_UNIT_TERRAIN: case UAB_BAD_BORDERS: case UAB_NO_MIN_DIST: - case UAB_NOT_BUILD_UNIT: log_verbose("handle_city_name_suggest_req(unit_pos (%d, %d)): " "cannot build there.", TILE_XY(unit_tile(punit))); city_add_or_build_error(pplayer, punit, res); /* Message. */ Modified: trunk/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=29621&r1=29620&r2=29621&view=diff ============================================================================== --- trunk/server/unithand.c (original) +++ trunk/server/unithand.c Fri Aug 21 12:25:54 2015 @@ -1942,25 +1942,6 @@ _("Can't place a city there because another city is too " "close.")); break; - case UAB_NOT_BUILD_UNIT: - { - struct astring astr = ASTRING_INIT; - - if (game.scenario.prevent_new_cities) { - notify_player(pplayer, ptile, E_BAD_COMMAND, ftc_server, - _("Cities cannot be built on this scenario.")); - } else if (role_units_translations(&astr, - action_get_role(ACTION_FOUND_CITY), TRUE)) { - notify_player(pplayer, ptile, E_BAD_COMMAND, ftc_server, - /* TRANS: %s is list of units separated by "or". */ - _("Only %s can build a city."), astr_str(&astr)); - astr_free(&astr); - } else { - notify_player(pplayer, ptile, E_BAD_COMMAND, ftc_server, - _("Can't build a city.")); - } - } - break; case UAB_TOO_BIG: notify_player(pplayer, ptile, E_BAD_COMMAND, ftc_server, _("%s is too big to add %s."), _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits