[Freeciv-Dev] (PR#7095) No Capital, and can't build one..
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7095 >
> [jrincayc - Fri Jan 23 21:23:12 2004]:
> It could instead add a sell message which defaults to nothing.
> Then add the sell message to the buildings.ruleset for palace.
> This has the advantage of allowing any building to have a sell message.
Indeed. I suppose this may be marginally cleaner.
jason
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.345
diff -u -r1.345 packhand.c
--- client/packhand.c 2004/01/20 21:52:07 1.345
+++ client/packhand.c 2004/01/24 03:25:53
@@ -2163,6 +2163,8 @@
b->sabotage = p->sabotage;
b->variant = p->variant; /* FIXME: remove when gen-impr obsoletes */
b->helptext = mystrdup(p->helptext);
+ b->sell_message = ((p->sell_message[0] != '\0')
+ ? mystrdup(p->sell_message) : NULL);
sz_strlcpy(b->soundtag, p->soundtag);
sz_strlcpy(b->soundtag_alt, p->soundtag_alt);
Index: client/gui-gtk-2.0/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/citydlg.c,v
retrieving revision 1.69
diff -u -r1.69 citydlg.c
--- client/gui-gtk-2.0/citydlg.c 2004/01/07 23:16:17 1.69
+++ client/gui-gtk-2.0/citydlg.c 2004/01/24 03:25:53
@@ -2371,8 +2371,10 @@
static void sell_callback(Impr_Type_id id, gpointer data)
{
struct city_dialog *pdialog = (struct city_dialog *) data;
+ struct impr_type *impr = get_improvement_type(id);
GtkWidget *shl;
-
+ char buf[1024];
+
if (pdialog->pcity->did_buy || pdialog->pcity->did_sell ||
pdialog->pcity->owner != game.player_idx) {
return;
@@ -2384,12 +2386,18 @@
pdialog->sell_id = id;
+ my_snprintf(buf, sizeof(buf), _("Sell %s for %d gold?"),
+ get_impr_name_ex(pdialog->pcity, id), improvement_value(id));
+ if (impr->sell_message) {
+ my_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
+ "\n\n%s", impr->sell_message);
+ }
+
shl = gtk_message_dialog_new(GTK_WINDOW(pdialog->shell),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
- _("Sell %s for %d gold?"),
- get_impr_name_ex(pdialog->pcity, id), improvement_value(id));
+ buf);
pdialog->sell_shell = shl;
gtk_window_set_title(GTK_WINDOW(shl), _("Sell It!"));
Index: common/improvement.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/improvement.h,v
retrieving revision 1.21
diff -u -r1.21 improvement.h
--- common/improvement.h 2003/08/10 13:46:14 1.21
+++ common/improvement.h 2004/01/24 03:25:53
@@ -119,6 +119,7 @@
int variant; /* FIXME: remove when gen-impr obsoletes */
struct Sprite *sprite; /* icon of the improvement */
char *helptext;
+ char *sell_message;
char soundtag[MAX_LEN_NAME];
char soundtag_alt[MAX_LEN_NAME];
};
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.7
diff -u -r1.7 packets.def
--- common/packets.def 2004/01/20 21:52:08 1.7
+++ common/packets.def 2004/01/24 03:25:54
@@ -1119,6 +1119,7 @@
STRING soundtag[MAX_LEN_NAME];
STRING soundtag_alt[MAX_LEN_NAME];
STRING helptext[MAX_LEN_PACKET];
+ STRING sell_message[MAX_LEN_PACKET];
UINT8 terr_gate_count;
TERRAIN terr_gate[255:terr_gate_count];
UINT8 spec_gate_count;
Index: common/packets_gen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets_gen.c,v
retrieving revision 1.8
diff -u -r1.8 packets_gen.c
--- common/packets_gen.c 2004/01/20 21:52:08 1.8
+++ common/packets_gen.c 2004/01/24 03:25:55
@@ -22053,7 +22053,7 @@
return 0;
}
-BV_DEFINE(packet_ruleset_building_100_fields, 26);
+BV_DEFINE(packet_ruleset_building_100_fields, 27);
static struct packet_ruleset_building
*receive_packet_ruleset_building_100(struct connection *pc, enum packet_type
type)
{
@@ -22124,9 +22124,12 @@
dio_get_string(&din, real_packet->helptext, sizeof(real_packet->helptext));
}
if (BV_ISSET(fields, 16)) {
- dio_get_uint8(&din, (int *) &real_packet->terr_gate_count);
+ dio_get_string(&din, real_packet->sell_message,
sizeof(real_packet->sell_message));
}
if (BV_ISSET(fields, 17)) {
+ dio_get_uint8(&din, (int *) &real_packet->terr_gate_count);
+ }
+ if (BV_ISSET(fields, 18)) {
{
int i;
@@ -22136,10 +22139,10 @@
}
}
}
- if (BV_ISSET(fields, 18)) {
+ if (BV_ISSET(fields, 19)) {
dio_get_uint8(&din, (int *) &real_packet->spec_gate_count);
}
- if (BV_ISSET(fields, 19)) {
+ if (BV_ISSET(fields, 20)) {
{
int i;
@@ -22149,10 +22152,10 @@
}
}
}
- if (BV_ISSET(fields, 20)) {
+ if (BV_ISSET(fields, 21)) {
dio_get_uint8(&din, (int *) &real_packet->equiv_dupl_count);
}
- if (BV_ISSET(fields, 21)) {
+ if (BV_ISSET(fields, 22)) {
{
int i;
@@ -22162,10 +22165,10 @@
}
}
}
- if (BV_ISSET(fields, 22)) {
+ if (BV_ISSET(fields, 23)) {
dio_get_uint8(&din, (int *) &real_packet->equiv_repl_count);
}
- if (BV_ISSET(fields, 23)) {
+ if (BV_ISSET(fields, 24)) {
{
int i;
@@ -22175,10 +22178,10 @@
}
}
}
- if (BV_ISSET(fields, 24)) {
+ if (BV_ISSET(fields, 25)) {
dio_get_uint8(&din, (int *) &real_packet->effect_count);
}
- if (BV_ISSET(fields, 25)) {
+ if (BV_ISSET(fields, 26)) {
{
int i;
@@ -22286,11 +22289,15 @@
if(differ) {different++;}
if(differ) {BV_SET(fields, 15);}
- differ = (old->terr_gate_count != real_packet->terr_gate_count);
+ differ = (strcmp(old->sell_message, real_packet->sell_message) != 0);
if(differ) {different++;}
if(differ) {BV_SET(fields, 16);}
+ differ = (old->terr_gate_count != real_packet->terr_gate_count);
+ if(differ) {different++;}
+ if(differ) {BV_SET(fields, 17);}
+
{
differ = (old->terr_gate_count != real_packet->terr_gate_count);
if(!differ) {
@@ -22304,11 +22311,11 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 17);}
+ if(differ) {BV_SET(fields, 18);}
differ = (old->spec_gate_count != real_packet->spec_gate_count);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 18);}
+ if(differ) {BV_SET(fields, 19);}
{
@@ -22324,11 +22331,11 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 19);}
+ if(differ) {BV_SET(fields, 20);}
differ = (old->equiv_dupl_count != real_packet->equiv_dupl_count);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 20);}
+ if(differ) {BV_SET(fields, 21);}
{
@@ -22344,11 +22351,11 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 21);}
+ if(differ) {BV_SET(fields, 22);}
differ = (old->equiv_repl_count != real_packet->equiv_repl_count);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 22);}
+ if(differ) {BV_SET(fields, 23);}
{
@@ -22364,11 +22371,11 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 23);}
+ if(differ) {BV_SET(fields, 24);}
differ = (old->effect_count != real_packet->effect_count);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 24);}
+ if(differ) {BV_SET(fields, 25);}
{
@@ -22384,7 +22391,7 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 25);}
+ if(differ) {BV_SET(fields, 26);}
if (different == 0 && !force_send_of_unchanged) {
return 0;
@@ -22439,9 +22446,12 @@
dio_put_string(&dout, real_packet->helptext);
}
if (BV_ISSET(fields, 16)) {
- dio_put_uint8(&dout, real_packet->terr_gate_count);
+ dio_put_string(&dout, real_packet->sell_message);
}
if (BV_ISSET(fields, 17)) {
+ dio_put_uint8(&dout, real_packet->terr_gate_count);
+ }
+ if (BV_ISSET(fields, 18)) {
{
int i;
@@ -22451,10 +22461,10 @@
}
}
}
- if (BV_ISSET(fields, 18)) {
+ if (BV_ISSET(fields, 19)) {
dio_put_uint8(&dout, real_packet->spec_gate_count);
}
- if (BV_ISSET(fields, 19)) {
+ if (BV_ISSET(fields, 20)) {
{
int i;
@@ -22464,10 +22474,10 @@
}
}
}
- if (BV_ISSET(fields, 20)) {
+ if (BV_ISSET(fields, 21)) {
dio_put_uint8(&dout, real_packet->equiv_dupl_count);
}
- if (BV_ISSET(fields, 21)) {
+ if (BV_ISSET(fields, 22)) {
{
int i;
@@ -22477,10 +22487,10 @@
}
}
}
- if (BV_ISSET(fields, 22)) {
+ if (BV_ISSET(fields, 23)) {
dio_put_uint8(&dout, real_packet->equiv_repl_count);
}
- if (BV_ISSET(fields, 23)) {
+ if (BV_ISSET(fields, 24)) {
{
int i;
@@ -22490,10 +22500,10 @@
}
}
}
- if (BV_ISSET(fields, 24)) {
+ if (BV_ISSET(fields, 25)) {
dio_put_uint8(&dout, real_packet->effect_count);
}
- if (BV_ISSET(fields, 25)) {
+ if (BV_ISSET(fields, 26)) {
{
int i;
Index: common/packets_gen.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets_gen.h,v
retrieving revision 1.5
diff -u -r1.5 packets_gen.h
--- common/packets_gen.h 2004/01/20 21:52:08 1.5
+++ common/packets_gen.h 2004/01/24 03:25:55
@@ -882,6 +882,7 @@
char soundtag[MAX_LEN_NAME];
char soundtag_alt[MAX_LEN_NAME];
char helptext[MAX_LEN_PACKET];
+ char sell_message[MAX_LEN_PACKET];
int terr_gate_count;
enum tile_terrain_type terr_gate[255];
int spec_gate_count;
Index: data/civ1/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/buildings.ruleset,v
retrieving revision 1.32
diff -u -r1.32 buildings.ruleset
--- data/civ1/buildings.ruleset 2003/09/30 23:20:09 1.32
+++ data/civ1/buildings.ruleset 2004/01/24 03:25:55
@@ -714,6 +714,7 @@
empire plunging into civil war. Losing your current palace also\
results in losing whatever spaceship you might have.\
")
+sell_message = _("Selling your palace is usally a very bad idea!")
[building_police_station]
name = _("Police Station")
Index: data/civ2/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/buildings.ruleset,v
retrieving revision 1.36
diff -u -r1.36 buildings.ruleset
--- data/civ2/buildings.ruleset 2003/09/30 23:20:10 1.36
+++ data/civ2/buildings.ruleset 2004/01/24 03:25:55
@@ -702,6 +702,7 @@
empire plunging into civil war. Losing your current palace also\
results in losing whatever spaceship you might have.\
")
+sell_message = _("Selling your palace is usally a very bad idea!")
[building_police_station]
name = _("Police Station")
Index: data/default/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/buildings.ruleset,v
retrieving revision 1.42
diff -u -r1.42 buildings.ruleset
--- data/default/buildings.ruleset 2003/09/30 23:20:10 1.42
+++ data/default/buildings.ruleset 2004/01/24 03:25:56
@@ -68,6 +68,8 @@
; supported in client
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
+; sell_message = optional text string; it will be displayed to the player
+; when they try to sell the building
;
; */ <-- avoid gettext warnings
@@ -758,6 +760,7 @@
empire plunging into civil war. Losing your current palace also\
results in losing whatever spaceship you might have.\
")
+sell_message = _("Selling your palace is usally a very bad idea!")
[building_police_station]
name = _("Police Station")
Index: data/history/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/buildings.ruleset,v
retrieving revision 1.7
diff -u -r1.7 buildings.ruleset
--- data/history/buildings.ruleset 2003/09/30 23:20:10 1.7
+++ data/history/buildings.ruleset 2004/01/24 03:25:56
@@ -711,6 +711,7 @@
empire plunging into civil war. Losing your current palace also\
results in losing whatever spaceship you might have.\
")
+sell_message = _("Selling your palace is usally a very bad idea!")
[building_police_station]
name = _("Police Station")
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.160
diff -u -r1.160 ruleset.c
--- server/ruleset.c 2004/01/11 17:45:05 1.160
+++ server/ruleset.c 2004/01/24 03:25:57
@@ -1398,6 +1398,7 @@
secfile_lookup_str_default(file, "-", "%s.sound_alt",
sec[i]));
b->helptext = lookup_helptext(file, sec[i]);
+ b->sell_message = lookup_string(file, sec[i], "sell_message");
}
/* Some more consistency checking: */
@@ -2744,6 +2745,12 @@
sz_strlcpy(packet.helptext, b->helptext);
} else {
packet.helptext[0] = '\0';
+ }
+
+ if (b->sell_message) {
+ sz_strlcpy(packet.sell_message, b->sell_message);
+ } else {
+ packet.sell_message[0] = '\0';
}
#define T(elem,count,last) \
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., (continued)
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., Genevieve Gracian, 2004/01/22
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., imbaczek@xxxxxxxxxxxxxx, 2004/01/22
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., ue80@xxxxxxxxxxxxxxxxxxxxx, 2004/01/22
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., imbaczek@xxxxxxxxxxxxxx, 2004/01/22
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., ue80@xxxxxxxxxxxxxxxxxxxxx, 2004/01/22
- [Freeciv-Dev] (PR#7095) No Capital, and can't build one.., Jason Short, 2004/01/22
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., Josh Cogliati, 2004/01/23
- [Freeciv-Dev] (PR#7095) No Capital, and can't build one.., Jason Short, 2004/01/23
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., Mike Kaufman, 2004/01/23
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., Josh Cogliati, 2004/01/23
- [Freeciv-Dev] (PR#7095) No Capital, and can't build one..,
Jason Short <=
- [Freeciv-Dev] (PR#7095) No Capital, and can't build one.., Jason Short, 2004/01/26
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., Raimar Falke, 2004/01/26
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., Josh Cogliati, 2004/01/26
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., Remi Bonnet, 2004/01/26
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., ue80@xxxxxxxxxxxxxxxxxxxxx, 2004/01/26
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., Josh Cogliati, 2004/01/26
- [Freeciv-Dev] (PR#7095) No Capital, and can't build one.., Jason Short, 2004/01/26
- [Freeciv-Dev] (PR#7095) No Capital, and can't build one.., Jason Short, 2004/01/26
- [Freeciv-Dev] Re: (PR#7095) No Capital, and can't build one.., Raimar Falke, 2004/01/27
|
|