Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #824074 ยป 0048-Add-ACTIVITY_CULTIVATE-ACTIVITY_PLANT.patch

Marko Lindqvist, 2019-06-29 04:55 AM

View differences:

common/actions.c
return ACTIVITY_TRANSFORM;
} else if (action_has_result(paction, ACTION_CONVERT)) {
return ACTIVITY_CONVERT;
} else if (action_has_result(paction, ACTION_PLANT)
|| action_has_result(paction, ACTION_MINE)) {
} else if (action_has_result(paction, ACTION_PLANT)) {
return ACTIVITY_PLANT;
} else if (action_has_result(paction, ACTION_MINE)) {
return ACTIVITY_MINE;
} else if (action_has_result(paction, ACTION_CULTIVATE)
|| action_has_result(paction, ACTION_IRRIGATE)) {
} else if (action_has_result(paction, ACTION_CULTIVATE)) {
return ACTIVITY_CULTIVATE;
} else if (action_has_result(paction, ACTION_IRRIGATE)) {
return ACTIVITY_IRRIGATE;
} else {
return ACTIVITY_LAST;
......
case ACTIVITY_GEN_ROAD:
case ACTIVITY_IRRIGATE:
case ACTIVITY_MINE:
case ACTIVITY_CULTIVATE:
case ACTIVITY_PLANT:
case ACTIVITY_TRANSFORM:
return tile_activity_time(pactivity, tgt_tile, tgt_extra);
case ACTIVITY_FORTIFYING:
common/fc_types.h
#define SPECENUM_VALUE19NAME "Road"
#define SPECENUM_VALUE20 ACTIVITY_CONVERT
#define SPECENUM_VALUE20NAME "Convert"
#define SPECENUM_VALUE21 ACTIVITY_CULTIVATE
#define SPECENUM_VALUE21NAME "Cultivate"
#define SPECENUM_VALUE22 ACTIVITY_PLANT
#define SPECENUM_VALUE22NAME "Plant"
#define SPECENUM_COUNT ACTIVITY_LAST
#include "specenum_gen.h"
common/tile.c
return terrain_extra_removal_time(pterrain, activity, tgt) * ACTIVITY_FACTOR;
case ACTIVITY_TRANSFORM:
return pterrain->transform_time * ACTIVITY_FACTOR;
case ACTIVITY_CULTIVATE:
return pterrain->irrigation_time * ACTIVITY_FACTOR;
case ACTIVITY_PLANT:
return pterrain->mining_time * ACTIVITY_FACTOR;
case ACTIVITY_IRRIGATE:
case ACTIVITY_MINE:
case ACTIVITY_BASE:
......
}
/************************************************************************//**
Transform (ACTIVITY_TRANSFORM) the tile. This usually changes the tile's
Transform (ACTIVITY_TRANSFORM) the tile. This usually changes the tile's
terrain type.
****************************************************************************/
static void tile_transform(struct tile *ptile)
......
}
}
/************************************************************************//**
Plant (ACTIVITY_PLANT) the tile. This usually changes the tile's
terrain type.
****************************************************************************/
static void tile_plant(struct tile *ptile)
{
struct terrain *pterrain = tile_terrain(ptile);
if (pterrain->mining_result != T_NONE
&& pterrain->mining_result != pterrain) {
tile_change_terrain(ptile, pterrain->mining_result);
}
}
/************************************************************************//**
Cultivate (ACTIVITY_CULTIVATE) the tile. This usually changes the tile's
terrain type.
****************************************************************************/
static void tile_cultivate(struct tile *ptile)
{
struct terrain *pterrain = tile_terrain(ptile);
if (pterrain->irrigation_result != T_NONE
&& pterrain->irrigation_result != pterrain) {
tile_change_terrain(ptile, pterrain->irrigation_result);
}
}
/************************************************************************//**
Apply an activity (Activity_type_id, e.g., ACTIVITY_TRANSFORM) to a tile.
Return false if there was a error or if the activity is not implemented
......
tile_transform(ptile);
return TRUE;
case ACTIVITY_CULTIVATE:
tile_cultivate(ptile);
return TRUE;
case ACTIVITY_PLANT:
tile_plant(ptile);
return TRUE;
case ACTIVITY_OLD_ROAD:
case ACTIVITY_OLD_RAILROAD:
case ACTIVITY_FORTRESS:
common/unit.c
case ACTIVITY_GOTO:
case ACTIVITY_EXPLORE:
case ACTIVITY_TRANSFORM:
case ACTIVITY_CULTIVATE:
case ACTIVITY_PLANT:
case ACTIVITY_FORTIFYING:
case ACTIVITY_CONVERT:
return FALSE;
......
case ACTIVITY_MINE:
/* TRANS: Activity name, verb in English */
return _("Plant");
case ACTIVITY_PLANT:
return _("Plant");
case ACTIVITY_IRRIGATE:
return _("Irrigate");
case ACTIVITY_CULTIVATE:
return _("Cultivate");
case ACTIVITY_FORTIFYING:
return _("Fortifying");
case ACTIVITY_FORTIFIED:
......
return FALSE;
}
case ACTIVITY_PLANT:
if (pterrain->mining_result != pterrain
&& pterrain->mining_result != T_NONE) {
/* The call below doesn't support actor tile speculation. */
fc_assert_msg(unit_tile(punit) == ptile,
"Please use action_speculate_unit_on_tile()");
return is_action_enabled_unit_on_tile(ACTION_PLANT,
punit, ptile, NULL);
} else {
return FALSE;
}
case ACTIVITY_IRRIGATE:
if (pterrain->irrigation_result != pterrain
&& pterrain->irrigation_result != T_NONE) {
......
return FALSE;
}
case ACTIVITY_CULTIVATE:
if (pterrain->irrigation_result != pterrain
&& pterrain->irrigation_result != T_NONE) {
/* The call below doesn't support actor tile speculation. */
fc_assert_msg(unit_tile(punit) == ptile,
"Please use action_speculate_unit_on_tile()");
return is_action_enabled_unit_on_tile(ACTION_CULTIVATE,
punit, ptile, NULL);
} else {
return FALSE;
}
case ACTIVITY_FORTIFYING:
/* The call below doesn't support actor tile speculation. */
fc_assert_msg(unit_tile(punit) == ptile,
......
case ACTIVITY_GOTO:
case ACTIVITY_EXPLORE:
case ACTIVITY_CONVERT:
case ACTIVITY_CULTIVATE:
case ACTIVITY_PLANT:
astr_add_line(astr, "%s", get_activity_text(punit->activity));
return;
case ACTIVITY_MINE:
fc_version
# - No new mandatory capabilities can be added to the release branch; doing
# so would break network capability of supposedly "compatible" releases.
#
NETWORK_CAPSTRING="+Freeciv.Devel-3.1-2019.Jun.28b"
NETWORK_CAPSTRING="+Freeciv.Devel-3.1-2019.Jun.29"
FREECIV_DISTRIBUTOR=""
server/advisors/autosettlers.c
return FALSE;
}
case ACTIVITY_PLANT:
if (pterrain->mining_result != pterrain
&& pterrain->mining_result != T_NONE) {
return action_prob_possible(action_speculate_unit_on_tile(
ACTION_PLANT,
punit, unit_home(punit), ptile,
omniscient_cheat,
ptile, target));
} else {
return FALSE;
}
case ACTIVITY_IRRIGATE:
if (pterrain->irrigation_result != pterrain
&& pterrain->irrigation_result != T_NONE) {
......
return FALSE;
}
case ACTIVITY_CULTIVATE:
if (pterrain->irrigation_result != pterrain
&& pterrain->irrigation_result != T_NONE) {
return action_prob_possible(action_speculate_unit_on_tile(
ACTION_CULTIVATE,
punit, unit_home(punit), ptile,
omniscient_cheat,
ptile, target));
} else {
return FALSE;
}
case ACTIVITY_FORTIFYING:
return action_prob_possible(action_speculate_unit_on_self(
ACTION_FORTIFY,
server/savegame/savegame2.c
return 'c';
case ACTIVITY_UNKNOWN:
case ACTIVITY_PATROL_UNUSED:
case ACTIVITY_CULTIVATE:
case ACTIVITY_PLANT:
return '?';
case ACTIVITY_LAST:
break;
server/savegame/savegame3.c
return 'r';
case ACTIVITY_MINE:
return 'm';
case ACTIVITY_PLANT:
return 'M';
case ACTIVITY_IRRIGATE:
return 'i';
case ACTIVITY_CULTIVATE:
return 'I';
case ACTIVITY_FORTIFIED:
return 'f';
case ACTIVITY_FORTRESS:
......
if (tgt != NULL) {
set_unit_activity_targeted(punit, ACTIVITY_IRRIGATE, tgt);
} else {
/* TODO: Set ACTIVITY_CULTIVATE */
set_unit_activity_targeted(punit, ACTIVITY_IRRIGATE, NULL);
}
} else if (activity == ACTIVITY_MINE) {
......
if (tgt != NULL) {
set_unit_activity_targeted(punit, ACTIVITY_MINE, tgt);
} else {
/* TODO: Set ACTIVITY_PLANT */
set_unit_activity_targeted(punit, ACTIVITY_MINE, NULL);
}
} else {
server/unithand.c
case ACTION_CULTIVATE:
ACTION_STARTED_UNIT_TILE(action_type, actor_unit, target_tile,
unit_activity_handling_targeted(actor_unit,
ACTIVITY_IRRIGATE,
ACTIVITY_CULTIVATE,
&target_extra));
break;
case ACTION_PLANT:
ACTION_STARTED_UNIT_TILE(action_type, actor_unit, target_tile,
unit_activity_handling_targeted(actor_unit,
ACTIVITY_MINE,
ACTIVITY_PLANT,
&target_extra));
break;
case ACTION_PILLAGE:
......
case ACTIVITY_MINE:
case ACTIVITY_IRRIGATE:
case ACTIVITY_TRANSFORM:
case ACTIVITY_CULTIVATE:
case ACTIVITY_PLANT:
case ACTIVITY_CONVERT:
/* Simple activities. */
break;
server/unittools.c
{
const enum unit_activity tile_changing_actions[] =
{ ACTIVITY_PILLAGE, ACTIVITY_GEN_ROAD, ACTIVITY_IRRIGATE, ACTIVITY_MINE,
ACTIVITY_BASE, ACTIVITY_TRANSFORM, ACTIVITY_POLLUTION,
ACTIVITY_FALLOUT, ACTIVITY_LAST };
ACTIVITY_BASE, ACTIVITY_CULTIVATE, ACTIVITY_PLANT, ACTIVITY_TRANSFORM,
ACTIVITY_POLLUTION, ACTIVITY_FALLOUT, ACTIVITY_LAST };
struct player *pplayer = unit_owner(punit);
bool unit_activity_done = FALSE;
......
case ACTIVITY_MINE:
case ACTIVITY_IRRIGATE:
case ACTIVITY_PILLAGE:
case ACTIVITY_CULTIVATE:
case ACTIVITY_PLANT:
case ACTIVITY_TRANSFORM:
case ACTIVITY_FALLOUT:
case ACTIVITY_BASE:
......
case ACTIVITY_IRRIGATE:
case ACTIVITY_MINE:
case ACTIVITY_CULTIVATE:
case ACTIVITY_PLANT:
case ACTIVITY_TRANSFORM:
if (total_activity_done(ptile, activity, punit->activity_target)) {
struct terrain *old = tile_terrain(ptile);
......
update_tile_knowledge(ptile);
if (ACTIVITY_IRRIGATE == activity
|| ACTIVITY_MINE == activity
|| ACTIVITY_CULTIVATE == activity
|| ACTIVITY_PLANT == activity
|| ACTIVITY_TRANSFORM == activity) {
/* FIXME: As we might probably do the activity again, because of the
* terrain change cycles, we need to treat these cases separatly.
......
case ACTIVITY_POLLUTION:
case ACTIVITY_MINE:
case ACTIVITY_IRRIGATE:
case ACTIVITY_CULTIVATE:
case ACTIVITY_PLANT:
case ACTIVITY_FORTIFIED:
case ACTIVITY_FORTRESS:
case ACTIVITY_PILLAGE:
    (1-1/1)