[Freeciv-Dev] (PR#12099) Prune unnecessary server messages
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#12099) Prune unnecessary server messages |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Thu, 3 Feb 2005 15:16:00 -0800 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12099 >
This patch does:
+ add message if we tried to buy production and failed
- remove message if we succeeded (unnecessary)
- remove ancient comment in a place where there is no AI code
- remove "You have founded %s"
- remove "Suggest throttling growth in %s to use %s (being built)
more effectively."
- remove "%s may soon grow to size %i"
- remove "%s needs %s (being built) to grow any further."
- remove "Order restored in %s."
- remove "Welcome to the %s Server running at %s port %d."
- remove "Year: %s"
- remove "%s is the %s ruler %s." when autocreating AI players
- remove AI skill level notify when autocreating AI players
+ unified the 3 "can't attack" messages. now it is: "You must declare war
on %s first. Try using players dialog (F3)."
- remove "CMA: You lost control of %s. Detaching from city."
- remove all now unnused events
This should hopefully make the chat/message window(s) more readable.
Q: Why not change the message window defaults?
A1: There are too many message window options as it is. It is almost
completely useless, since most players will just glance at it and go 'oh
holy shit'. Less options will encourage players to actually use this
facility.
A2: Because this is not a good way to make a good game. We should present
for the player the vital information, thoughtfully formatted and
considered by us. If some information is off by default, then there is
probably something wrong with it.
Q: But surely the message window options dialog is still dauting and
user-hostile?
A: I have just started...
- Per
Index: client/options.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.c,v
retrieving revision 1.111
diff -u -r1.111 options.c
--- client/options.c 7 Dec 2004 22:38:59 -0000 1.111
+++ client/options.c 3 Feb 2005 23:06:23 -0000
@@ -283,15 +283,11 @@
GEN_EV(N_("City: Famine"), E_CITY_FAMINE),
GEN_EV(N_("City: Famine Feared"), E_CITY_FAMINE_FEARED),
GEN_EV(N_("City: Growth"), E_CITY_GROWTH),
- GEN_EV(N_("City: May Soon Grow"), E_CITY_MAY_SOON_GROW),
GEN_EV(N_("City: Needs Aqueduct"), E_CITY_AQUEDUCT),
- GEN_EV(N_("City: Needs Aqueduct Being Built"), E_CITY_AQ_BUILDING),
GEN_EV(N_("City: Normal"), E_CITY_NORMAL),
GEN_EV(N_("City: Nuked"), E_CITY_NUKED),
GEN_EV(N_("City: Released from CMA"), E_CITY_CMA_RELEASE),
- GEN_EV(N_("City: Suggest Growth Throttling"), E_CITY_GRAN_THROTTLE),
GEN_EV(N_("City: Transfer"), E_CITY_TRANSFER),
- GEN_EV(N_("City: Was Built"), E_CITY_BUILD),
GEN_EV(N_("City: Worklist Events"), E_WORKLIST),
GEN_EV(N_("Civ: Barbarian Uprising"), E_UPRISING ),
GEN_EV(N_("Civ: Civil War"), E_CIVIL_WAR),
@@ -323,11 +319,9 @@
GEN_EV(N_("Game: Game Ended"), E_GAME_END),
GEN_EV(N_("Game: Game Started"), E_GAME_START),
GEN_EV(N_("Game: Message from Server Operator"), E_MESSAGE_WALL),
- GEN_EV(N_("Game: Nation Selected"), E_NATION_SELECTED),
GEN_EV(N_("Game: Player Destroyed"), E_DESTROYED),
GEN_EV(N_("Game: Report"), E_REPORT),
GEN_EV(N_("Game: Turn Bell"), E_TURN_BELL),
- GEN_EV(N_("Game: Year Advance"), E_NEXT_YEAR),
GEN_EV(N_("Global: Eco-Disaster"), E_GLOBAL_ECO),
GEN_EV(N_("Global: Nuke Detonated"), E_NUKE),
GEN_EV(N_("Hut: Barbarians in a Hut Roused"), E_HUT_BARB),
@@ -338,7 +332,6 @@
GEN_EV(N_("Hut: Settler Found in Hut"), E_HUT_SETTLER),
GEN_EV(N_("Hut: Tech Found in Hut"), E_HUT_TECH),
GEN_EV(N_("Hut: Unit Spared by Barbarians"), E_HUT_BARB_CITY_NEAR),
- GEN_EV(N_("Improvement: Bought"), E_IMP_BUY),
GEN_EV(N_("Improvement: Built"), E_IMP_BUILD),
GEN_EV(N_("Improvement: Forced to Sell"), E_IMP_AUCTIONED),
GEN_EV(N_("Improvement: New Improvement Selected"), E_IMP_AUTO),
@@ -352,7 +345,6 @@
GEN_EV(N_("Treaty: Shared Vision"), E_TREATY_SHARED_VISION),
GEN_EV(N_("Unit: Attack Failed"), E_UNIT_LOST_ATT),
GEN_EV(N_("Unit: Attack Succeeded"), E_UNIT_WIN_ATT),
- GEN_EV(N_("Unit: Bought"), E_UNIT_BUY),
GEN_EV(N_("Unit: Built"), E_UNIT_BUILT),
GEN_EV(N_("Unit: Defender Destroyed"), E_UNIT_LOST),
GEN_EV(N_("Unit: Defender Survived"), E_UNIT_WIN),
@@ -421,9 +413,8 @@
*****************************************************************/
void init_messages_where(void)
{
- int out_only[] = { E_IMP_BUY, E_IMP_SOLD, E_UNIT_BUY,
+ int out_only[] = { E_IMP_SOLD,
E_UNIT_LOST_ATT, E_UNIT_WIN_ATT, E_GAME_START,
- E_NATION_SELECTED, E_CITY_BUILD, E_NEXT_YEAR,
E_TECH_LEARNED, E_CITY_PRODUCTION_CHANGED};
int all[] = { E_MESSAGE_WALL };
int i;
Index: client/agents/cma_core.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/agents/cma_core.c,v
retrieving revision 1.71
diff -u -r1.71 cma_core.c
--- client/agents/cma_core.c 2 Feb 2005 02:46:37 -0000 1.71
+++ client/agents/cma_core.c 3 Feb 2005 23:06:23 -0000
@@ -177,9 +177,6 @@
if (city_owner(pcity) != game.player_ptr) {
cma_release_city(pcity);
- create_event(pcity->tile, E_CITY_CMA_RELEASE,
- _("CMA: You lost control of %s. Detaching from city."),
- pcity->name);
return FALSE;
}
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.218
diff -u -r1.218 capstr.c
--- common/capstr.c 29 Jan 2005 17:58:18 -0000 1.218
+++ common/capstr.c 3 Feb 2005 23:06:23 -0000
@@ -82,7 +82,7 @@
* as long as possible. We want to maintain network compatibility with
* the stable branch for as long as possible.
*/
-#define CAPABILITY "+Freeciv.Devel.2004.Jan.29"
+#define CAPABILITY "+Freeciv.Devel.2005.Feb.4"
void init_our_capability(void)
{
Index: common/events.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/events.h,v
retrieving revision 1.27
diff -u -r1.27 events.h
--- common/events.h 6 Mar 2004 11:13:05 -0000 1.27
+++ common/events.h 3 Feb 2005 23:06:24 -0000
@@ -22,15 +22,11 @@
E_CITY_FAMINE,
E_CITY_FAMINE_FEARED,
E_CITY_GROWTH,
- E_CITY_MAY_SOON_GROW,
E_CITY_AQUEDUCT,
- E_CITY_AQ_BUILDING,
E_CITY_NORMAL,
E_CITY_NUKED,
E_CITY_CMA_RELEASE,
- E_CITY_GRAN_THROTTLE,
E_CITY_TRANSFER,
- E_CITY_BUILD,
E_WORKLIST,
E_UPRISING,
E_CIVIL_WAR,
@@ -62,11 +58,9 @@
E_GAME_END,
E_GAME_START,
E_MESSAGE_WALL,
- E_NATION_SELECTED,
E_DESTROYED,
E_REPORT,
E_TURN_BELL,
- E_NEXT_YEAR,
E_GLOBAL_ECO,
E_NUKE,
E_HUT_BARB,
@@ -77,7 +71,6 @@
E_HUT_SETTLER,
E_HUT_TECH,
E_HUT_BARB_CITY_NEAR,
- E_IMP_BUY,
E_IMP_BUILD,
E_IMP_AUCTIONED,
E_IMP_AUTO,
@@ -91,7 +84,6 @@
E_TREATY_SHARED_VISION,
E_UNIT_LOST_ATT,
E_UNIT_WIN_ATT,
- E_UNIT_BUY,
E_UNIT_BUILT,
E_UNIT_LOST,
E_UNIT_WIN,
Index: server/cityhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v
retrieving revision 1.141
diff -u -r1.141 cityhand.c
--- server/cityhand.c 22 Jan 2005 19:45:44 -0000 1.141
+++ server/cityhand.c 3 Feb 2005 23:06:25 -0000
@@ -246,19 +246,18 @@
total = impr_build_shield_cost(pcity->currently_building);
}
cost = city_buy_cost(pcity);
- if (cost == 0 || cost > pplayer->economic.gold) {
+ if (cost <= 0) {
+ return; /* sanity */
+ }
+ if (cost > pplayer->economic.gold) {
+ /* In case something changed while player tried to buy, or player
+ * tried to cheat! */
+ notify_player_ex(pplayer, pcity->tile, E_NOEVENT,
+ _("%d gold required. You only have %d gold."), cost,
+ pplayer->economic.gold);
return;
}
- /*
- * Need to make this more restrictive. AI is sometimes buying
- * things that force it to sell buildings due to upkeep problems.
- * upkeep expense is only known in ai_manage_taxes().
- * Also, we should sort this list so cheapest things are bought first,
- * and/or take danger into account.
- * AJS, 1999110
- */
-
pplayer->economic.gold-=cost;
if (pcity->shield_stock < total){
/* As we never put penalty on disbanded_shields, we can
@@ -270,10 +269,6 @@
city_refresh(pcity);
conn_list_do_buffer(pplayer->connections);
- notify_player_ex(pplayer, pcity->tile,
- pcity->is_building_unit?E_UNIT_BUY:E_IMP_BUY,
- _("Game: %s bought in %s for %d gold."),
- name, pcity->name, cost);
send_city_info(pplayer, pcity);
send_player_info(pplayer,pplayer);
conn_list_do_unbuffer(pplayer->connections);
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.304
diff -u -r1.304 citytools.c
--- server/citytools.c 29 Jan 2005 08:23:50 -0000 1.304
+++ server/citytools.c 3 Feb 2005 23:06:25 -0000
@@ -1001,8 +1001,6 @@
send_city_info(NULL, pcity);
sync_cities(); /* Will also send pcity. */
- notify_player_ex(pplayer, ptile, E_CITY_BUILD,
- _("Game: You have founded %s"), pcity->name);
maybe_make_contact(ptile, city_owner(pcity));
unit_list_iterate((ptile)->units, punit) {
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.294
diff -u -r1.294 cityturn.c
--- server/cityturn.c 22 Jan 2005 19:45:44 -0000 1.294
+++ server/cityturn.c 3 Feb 2005 23:06:25 -0000
@@ -314,49 +314,11 @@
**************************************************************************/
void send_city_turn_notifications(struct conn_list *dest, struct city *pcity)
{
- int turns_growth, turns_granary;
- bool can_grow;
-
- if (pcity->surplus[O_FOOD] > 0) {
- turns_growth = (city_granary_size(pcity->size) - pcity->food_stock - 1)
- / pcity->surplus[O_FOOD];
-
- if (get_city_bonus(pcity, EFT_GROWTH_FOOD) == 0
- && get_current_construction_bonus(pcity, EFT_GROWTH_FOOD) > 0
- && pcity->surplus[O_SHIELD] > 0) {
- /* From the check above, the surplus must always be positive. */
- turns_granary = (impr_build_shield_cost(pcity->currently_building)
- - pcity->shield_stock) / pcity->surplus[O_SHIELD];
- /* if growth and granary completion occur simultaneously, granary
- preserves food. -AJS */
- if (turns_growth < 5 && turns_granary < 5
- && turns_growth < turns_granary) {
- notify_conn_ex(dest, pcity->tile,
- E_CITY_GRAN_THROTTLE,
- _("Game: Suggest throttling growth in %s to use %s "
- "(being built) more effectively."), pcity->name,
- improvement_types[pcity->currently_building].name);
- }
- }
-
- can_grow = city_can_grow_to(pcity, pcity->size + 1);
-
- if ((turns_growth <= 0) && !city_celebrating(pcity) && can_grow) {
- notify_conn_ex(dest, pcity->tile,
- E_CITY_MAY_SOON_GROW,
- _("Game: %s may soon grow to size %i."),
- pcity->name, pcity->size + 1);
- }
- } else {
- if (pcity->food_stock + pcity->surplus[O_FOOD] <= 0
- && pcity->surplus[O_FOOD] < 0) {
- notify_conn_ex(dest, pcity->tile,
- E_CITY_FAMINE_FEARED,
- _("Game: Warning: Famine feared in %s."),
- pcity->name);
- }
+ if (pcity->food_stock + pcity->surplus[O_FOOD] <= 0
+ && pcity->surplus[O_FOOD] < 0) {
+ notify_conn_ex(dest, pcity->tile, E_CITY_FAMINE_FEARED,
+ _("Game: Warning: Famine feared in %s."), pcity->name);
}
-
}
/**************************************************************************
@@ -465,13 +427,8 @@
bool rapture_grow = city_rapture_grow(pcity); /* check before size increase!
*/
if (!city_can_grow_to(pcity, pcity->size + 1)) { /* need improvement */
- if (get_current_construction_bonus(pcity, EFT_SIZE_ADJ) > 0
- || get_current_construction_bonus(pcity, EFT_SIZE_UNLIMIT) > 0) {
- notify_player_ex(powner, pcity->tile, E_CITY_AQ_BUILDING,
- _("Game: %s needs %s (being built) "
- "to grow any further."), pcity->name,
- improvement_types[pcity->currently_building].name);
- } else {
+ if (get_current_construction_bonus(pcity, EFT_SIZE_ADJ) == 0
+ && get_current_construction_bonus(pcity, EFT_SIZE_UNLIMIT) == 0) {
notify_player_ex(powner, pcity->tile, E_CITY_AQUEDUCT,
_("Game: %s needs an improvement to grow any further."),
pcity->name);
@@ -1355,11 +1312,7 @@
notify_player_ex(pplayer, pcity->tile, E_CITY_DISORDER,
_("Game: CIVIL DISORDER CONTINUES in %s."),
pcity->name);
- }
- else {
- if (pcity->anarchy != 0)
- notify_player_ex(pplayer, pcity->tile, E_CITY_NORMAL,
- _("Game: Order restored in %s."), pcity->name);
+ } else {
pcity->anarchy=0;
}
check_pollution(pcity);
Index: server/connecthand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/connecthand.c,v
retrieving revision 1.38
diff -u -r1.38 connecthand.c
--- server/connecthand.c 22 Jan 2005 19:45:44 -0000 1.38
+++ server/connecthand.c 3 Feb 2005 23:06:25 -0000
@@ -73,7 +73,6 @@
struct conn_list *dest = pconn->self;
struct player *pplayer;
struct packet_server_join_reply packet;
- char hostname[512];
/* zero out the password */
memset(pconn->server.password, 0, sizeof(pconn->server.password));
@@ -90,18 +89,6 @@
/* "establish" the connection */
pconn->established = TRUE;
- /* introduce the server to the connection */
- if (my_gethostname(hostname, sizeof(hostname)) == 0) {
- notify_conn(dest, _("Welcome to the %s Server running at %s port %d."),
- freeciv_name_version(), hostname, srvarg.port);
- } else {
- notify_conn(dest, _("Welcome to the %s Server at port %d."),
- freeciv_name_version(), srvarg.port);
- }
-
- /* FIXME: this (getting messages about others logging on) should be a
- * message option for the client with event */
-
/* notify the console and other established connections that you're here */
freelog(LOG_NORMAL, _("%s has connected from %s."),
pconn->username, pconn->addr);
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.149
diff -u -r1.149 gamehand.c
--- server/gamehand.c 22 Jan 2005 19:45:44 -0000 1.149
+++ server/gamehand.c 3 Feb 2005 23:06:25 -0000
@@ -276,10 +276,6 @@
apacket.year = year;
apacket.turn = game.turn;
lsend_packet_new_year(game.game_connections, &apacket);
-
- /* Hmm, clients could add this themselves based on above packet? */
- notify_conn_ex(game.game_connections, NULL, E_NEXT_YEAR, _("Year: %s"),
- textyear(year));
}
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.221
diff -u -r1.221 srv_main.c
--- server/srv_main.c 22 Jan 2005 19:45:44 -0000 1.221
+++ server/srv_main.c 3 Feb 2005 23:06:26 -0000
@@ -1148,10 +1148,6 @@
name[0] = my_toupper(name[0]);
- notify_conn_ex(game.game_connections, NULL, E_NATION_SELECTED,
- _("Game: %s is the %s ruler %s."), pplayer->username,
- get_nation_name(nation_no), name);
-
/* inform player his choice was ok */
lsend_packet_nation_select_ok(pplayer->connections);
@@ -1422,7 +1418,7 @@
pplayer->is_male = (myrand(2) == 1);
}
announce_ai_player(pplayer);
- set_ai_level_direct(pplayer, pplayer->ai.skill_level);
+ set_ai_level_directer(pplayer, pplayer->ai.skill_level);
}
(void) send_server_info_to_metaserver(META_INFO);
}
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.318
diff -u -r1.318 unithand.c
--- server/unithand.c 22 Jan 2005 19:45:45 -0000 1.318
+++ server/unithand.c 3 Feb 2005 23:06:26 -0000
@@ -64,7 +64,6 @@
enum tile_special_type
new_target);
static bool base_handle_unit_establish_trade(struct player *pplayer, int
unit_id, struct city *pcity_dest);
-static void how_to_declare_war(struct player *pplayer);
static bool unit_bombard(struct unit *punit, struct tile *ptile);
/**************************************************************************
@@ -907,15 +906,6 @@
/**************************************************************************
...
**************************************************************************/
-static void how_to_declare_war(struct player *pplayer)
-{
- notify_player_ex(pplayer, NULL, E_NOEVENT,
- _("Game: Cancel treaty in the players dialog first (F3)."));
-}
-
-/**************************************************************************
-...
-**************************************************************************/
static bool can_unit_move_to_tile_with_notify(struct unit *punit,
struct tile *dest_tile,
bool igzoc)
@@ -1050,27 +1040,15 @@
if (is_non_allied_unit_tile(pdesttile, pplayer)
|| is_non_allied_city_tile(pdesttile, pplayer)) {
- struct unit *victim;
+ struct unit *victim = NULL;
/* We can attack ONLY in enemy cities */
- if (pcity && !pplayers_at_war(city_owner(pcity), pplayer)) {
- notify_player_ex(pplayer, punit->tile, E_NOEVENT,
- _("Game: Can't attack %s "
- "because you are not at war with %s."),
- pcity->name,
- city_owner(pcity)->name);
- how_to_declare_war(pplayer);
- return FALSE;
- }
-
- /* Tile must contain ONLY enemy units. */
- if ((victim = is_non_attack_unit_tile(pdesttile, pplayer))) {
+ if ((pcity && !pplayers_at_war(city_owner(pcity), pplayer))
+ || (victim = is_non_attack_unit_tile(pdesttile, pplayer))) {
notify_player_ex(pplayer, punit->tile, E_NOEVENT,
- _("Game: Can't attack %s's unit "
- "because you are not at war with %s."),
- unit_owner(victim)->name,
- unit_owner(victim)->name);
- how_to_declare_war(pplayer);
+ _("You must declare war on %s first. Try using "
+ "players dialog (F3)."), victim == NULL ?
+ city_owner(pcity)->name : unit_owner(victim)->name);
return FALSE;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12099) Prune unnecessary server messages,
Per I. Mathisen <=
|
|