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 #851551 ยป 0023-sdl2-Add-Cultivate-Plant-buttons.patch

Marko Lindqvist, 2019-12-08 11:49 AM

View differences:

client/gui-sdl2/gui_id.h
/**********************************************************************
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
ID_UNIT_ORDER_ROAD,
ID_UNIT_ORDER_TRADE_ROUTE,
ID_UNIT_ORDER_IRRIGATE,
ID_UNIT_ORDER_CULTIVATE,
ID_UNIT_ORDER_MINE,
ID_UNIT_ORDER_PLANT,
ID_UNIT_ORDER_TRANSFORM,
ID_UNIT_ORDER_FORTRESS,
ID_UNIT_ORDER_FORTIFY,
client/gui-sdl2/gui_tilespec.c
load_order_theme_surface(pBuf, OPlantForest_Icon, "theme.order_plant_forest");
load_order_theme_surface(pBuf, OMine_Icon, "theme.order_build_mining");
load_order_theme_surface(pBuf, OIrrigation_Icon, "theme.order_irrigation");
load_order_theme_surface(pBuf, OCultivate_Icon, "theme.order_cutdown_forest");
load_order_theme_surface(pBuf, OPlant_Icon, "theme.order_plant_forest");
load_order_theme_surface(pBuf, ODone_Icon, "theme.order_done");
load_order_theme_surface(pBuf, ODisband_Icon, "theme.order_disband");
load_order_theme_surface(pBuf, OFortify_Icon, "theme.order_fortify");
client/gui-sdl2/gui_tilespec.h
SDL_Surface *OFortify_Icon;
SDL_Surface *OSentry_Icon;
SDL_Surface *OIrrigation_Icon;
SDL_Surface *OCultivate_Icon;
SDL_Surface *OPlant_Icon;
SDL_Surface *ORoad_Icon;
SDL_Surface *ORailRoad_Icon;
SDL_Surface *OPillage_Icon;
client/gui-sdl2/menu.c
static struct widget *pOrder_Build_AddTo_City_Button;
static struct widget *pOrder_Mine_Button;
static struct widget *pOrder_Irrigation_Button;
static struct widget *pOrder_Cultivate_Button;
static struct widget *pOrder_Plant_Button;
static struct widget *pOrder_Road_Button;
static struct widget *pOrder_Transform_Button;
static struct widget *pOrder_Trade_Button;
......
case ID_UNIT_ORDER_IRRIGATE:
key_unit_irrigate();
break;
case ID_UNIT_ORDER_CULTIVATE:
key_unit_cultivate();
break;
case ID_UNIT_ORDER_MINE:
key_unit_mine();
break;
case ID_UNIT_ORDER_PLANT:
key_unit_plant();
break;
case ID_UNIT_ORDER_TRANSFORM:
key_unit_transform();
break;
......
add_to_gui_list(ID_UNIT_ORDER_MINE, pBuf);
pOrder_Mine_Button = pBuf;
/* --------- */
/* --------- */
/* Build Irrigation */
fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Build Irrigation"), "I");
......
add_to_gui_list(ID_UNIT_ORDER_IRRIGATE, pBuf);
pOrder_Irrigation_Button = pBuf;
/* --------- */
/* --------- */
/* Cultivate */
fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Cultivate"), "Shift+I");
pBuf = create_themeicon(current_theme->OCultivate_Icon, Main.gui,
WF_HIDDEN | WF_RESTORE_BACKGROUND
| WF_WIDGET_HAS_INFO_LABEL);
set_wstate(pBuf, FC_WS_NORMAL);
pBuf->action = unit_order_callback;
pBuf->key = SDLK_i;
pBuf->mod = KMOD_SHIFT;
pBuf->info_label = create_utf8_from_char(cBuf, adj_font(10));
add_to_gui_list(ID_UNIT_ORDER_CULTIVATE, pBuf);
pOrder_Cultivate_Button = pBuf;
/* --------- */
/* Plant */
fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Plant"), "Shift+M");
pBuf = create_themeicon(current_theme->OPlant_Icon, Main.gui,
WF_HIDDEN | WF_RESTORE_BACKGROUND
| WF_WIDGET_HAS_INFO_LABEL);
set_wstate(pBuf, FC_WS_NORMAL);
pBuf->action = unit_order_callback;
pBuf->key = SDLK_m;
pBuf->mod = KMOD_SHIFT;
pBuf->info_label = create_utf8_from_char(cBuf, adj_font(10));
add_to_gui_list(ID_UNIT_ORDER_PLANT, pBuf);
pOrder_Plant_Button = pBuf;
/* --------- */
/* Establish Trade route */
fc_snprintf(cBuf, sizeof(cBuf), "%s (%s)",
......
set_wflag(pOrder_Mine_Button, WF_HIDDEN);
}
if (can_unit_do_activity(pUnit, ACTIVITY_CULTIVATE)) {
time = tile_activity_time(ACTIVITY_CULTIVATE, unit_tile(pUnit), NULL);
fc_snprintf(cBuf, sizeof(cBuf),"%s %s (%s) %d %s",
_("Cultivate to"),
terrain_name_translation(pTerrain->irrigation_result),
"Shift+I", time, PL_("turn", "turns", time));
copy_chars_to_utf8_str(pOrder_Cultivate_Button->info_label, cBuf);
clear_wflag(pOrder_Cultivate_Button, WF_HIDDEN);
} else {
set_wflag(pOrder_Cultivate_Button, WF_HIDDEN);
}
if (can_unit_do_activity(pUnit, ACTIVITY_PLANT)) {
time = tile_activity_time(ACTIVITY_PLANT, unit_tile(pUnit), NULL);
fc_snprintf(cBuf, sizeof(cBuf),"%s %s (%s) %d %s",
_("Plant to"),
terrain_name_translation(pTerrain->mining_result),
"Shift+M", time, PL_("turn", "turns", time));
copy_chars_to_utf8_str(pOrder_Plant_Button->info_label, cBuf);
clear_wflag(pOrder_Plant_Button, WF_HIDDEN);
} else {
set_wflag(pOrder_Plant_Button, WF_HIDDEN);
}
if (can_unit_do_activity(pUnit, ACTIVITY_TRANSFORM)) {
time = tile_activity_time(ACTIVITY_TRANSFORM, unit_tile(pUnit), NULL);
fc_snprintf(cBuf, sizeof(cBuf),"%s %s (%s) %d %s",
    (1-1/1)