[Freeciv-Dev] (PR#40183) wall command sends wrong event type

2008-04-03 Thread Madeline Book

http://bugs.freeciv.org/Ticket/Display.html?id=40183 >

> [book - Thu Apr 03 22:58:49 2008]:
> 
> As per my off-topic comment in PR#40170, the /wall command
> should not be E_LOG_FATAL. A patch will be coming soon...

And here it is. Hopefully I have not missed any trivialities. ;)


-
急がなきゃ。急がなきゃ。急がなきゃ。
>From 3963f1a831b0828418fe5a022620c6d3f4c4f161 Mon Sep 17 00:00:00 2001
From: Madeline Book <[EMAIL PROTECTED]>
Date: Thu, 3 Apr 2008 19:26:39 -0500
Subject: [PATCH] Re-added E_MESSAGE_WALL and fixed /wall command.

---
 common/events.c  |1 +
 common/events.h  |1 +
 server/scripting/api.pkg |1 +
 server/stdinhand.c   |2 +-
 4 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/common/events.c b/common/events.c
index 2830b8a..a7b253a 100644
--- a/common/events.c
+++ b/common/events.c
@@ -172,6 +172,7 @@ static struct {
   GEN_EV(E_REPORT,		E_S_XYZZY,	N_("Report")),
   GEN_EV(E_LOG_FATAL,		E_S_XYZZY,	N_("Server Aborting")),
   GEN_EV(E_LOG_ERROR,		E_S_XYZZY,	N_("Server Problems")),
+  GEN_EV(E_MESSAGE_WALL,	E_S_XYZZY,	N_("Message from server operator")),
   GEN_EV(E_SETTING,		E_S_XYZZY,	N_("Server settings changed")),
   GEN_EV(E_TURN_BELL,		E_S_XYZZY,	N_("Turn Bell")),
   GEN_EV(E_TUTORIAL,		E_S_XYZZY,	N_("Tutorial message")),
diff --git a/common/events.h b/common/events.h
index a45bff7..ca6f65b 100644
--- a/common/events.h
+++ b/common/events.h
@@ -123,6 +123,7 @@ enum event_type {
   E_CONNECTION,			/* Messages about acquired or lost connections */
   E_AI_DEBUG,			/* AI debugging messages */
   E_LOG_ERROR,			/* Warning messages */
+  E_MESSAGE_WALL,		/* Message from server operator */
   E_TECH_GOAL,			/* Changed tech goal */
   /* 
* Note: If you add a new event, make sure you make a similar change
diff --git a/server/scripting/api.pkg b/server/scripting/api.pkg
index 7407cc9..13ef69b 100644
--- a/server/scripting/api.pkg
+++ b/server/scripting/api.pkg
@@ -418,6 +418,7 @@ module E {
 E_GAME_END @ GAME_END,
 E_GAME_START @ GAME_START,
 E_LOG_ERROR @ E_LOG_ERROR,
+E_MESSAGE_WALL @ E_MESSAGE_WALL,
 E_NATION_SELECTED @ NATION_SELECTED,
 E_DESTROYED @ DESTROYED,
 E_REPORT @ REPORT,
diff --git a/server/stdinhand.c b/server/stdinhand.c
index 5d70406..0c24994 100644
--- a/server/stdinhand.c
+++ b/server/stdinhand.c
@@ -1628,7 +1628,7 @@ static bool explain_option(struct connection *caller, char *str, bool check)
 static bool wall(char *str, bool check)
 {
   if (!check) {
-notify_conn(NULL, NULL, E_LOG_FATAL,
+notify_conn(NULL, NULL, E_MESSAGE_WALL,
  		_("Server Operator: %s"), str);
   }
   return TRUE;
-- 
1.5.3.8

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40183) wall command sends wrong event type

2008-04-03 Thread Madeline Book

http://bugs.freeciv.org/Ticket/Display.html?id=40183 >

As per my off-topic comment in PR#40170, the /wall command
should not be E_LOG_FATAL. A patch will be coming soon...


--
ごもんごもん。ちょっと早すぎるよね
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40170) Sending logmessages to clients should be optional

2008-04-03 Thread Madeline Book

http://bugs.freeciv.org/Ticket/Display.html?id=40170 >

> [book - Thu Apr 03 22:43:48 2008]:
> 
> > [EMAIL PROTECTED] - Wed Apr 02 22:39:35 2008]:
> > 
> > On 28/03/2008, Madeline Book  wrote:
> > >
> > > Actually, in the meantime, I thought of a better way: send the
> > >  error messages only to connections with hack access.
> > 
> >  Sounds sensible. Patch wanted.
> 
> Easy enough...

俺のことを忘れないで、あほ!


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40170) Sending logmessages to clients should be optional

2008-04-03 Thread Madeline Book

http://bugs.freeciv.org/Ticket/Display.html?id=40170 >

> [EMAIL PROTECTED] - Wed Apr 02 22:39:35 2008]:
> 
> On 28/03/2008, Madeline Book  wrote:
> >
> > Actually, in the meantime, I thought of a better way: send the
> >  error messages only to connections with hack access.
> 
>  Sounds sensible. Patch wanted.

Easy enough...
>From 49c086599fdc42b7cab767c4aef362dc904c8d32 Mon Sep 17 00:00:00 2001
From: Madeline Book <[EMAIL PROTECTED]>
Date: Thu, 3 Apr 2008 18:39:39 -0500
Subject: [PATCH] Only send E_LOG_ERROR and E_LOG_FATAL messages to connections with hack access.

---
 server/plrhand.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/server/plrhand.c b/server/plrhand.c
index 85ec4a7..15686e6 100644
--- a/server/plrhand.c
+++ b/server/plrhand.c
@@ -670,6 +670,15 @@ void vnotify_conn(struct conn_list *dest, struct tile *ptile,
   genmsg.conn_id = -1;
 
   conn_list_iterate(dest, pconn) {
+
+/* Avoid sending messages that could potentially reveal
+ * internal information about the server machine to
+ * connections that do not already have hack access. */
+if ((event == E_LOG_ERROR || event == E_LOG_FATAL)
+&& pconn->access_level != ALLOW_HACK) {
+  continue;
+}
+
 if (S_S_RUNNING <= server_state()
 	&& ptile /* special case, see above */
 	&& ((NULL == pconn->playing && pconn->observer)
-- 
1.5.3.8

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] 2.1.4

2008-04-03 Thread Daniel Markstedt
Hi all,

I've noticed quite a few crash and other fixes among recent Freeciv spam. =)

So what do you say about a 2.1.4 maintenance release? I can take care
of the details when I get back home from working in Frankfurt, in
about two weeks or so.

Best,
 ~Daniel

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40180) Uninitialized datas in city structure

2008-04-03 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=40180 >

Well, sorry for my ignorance spam.


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40182) Scenario ruleset ignored

2008-04-03 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=40182 >

 S2_1:
 I loaded mongols-modpack to server, but when game started it was
using default rulesets.

 ---

 Just like 2.1 concentrated on visual improvements, 2.2 is supposed to
concentrate on modpack support. Key features of the 2.2 are the editor
and improved scripting; editor more than scripting. Keep that in mind
when testing your patches, even if they are not directly related to
editor or scripting.
 Currently attempt to load scenario or modpack to S2_2 instantly
crashes game. This makes development of those key features impossible
at the moment.
 Our release cycle has taken far too long for several major releases
already. Please take also the release cycle in to consideration in
what you do.


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40181) Manpages outdated regarding commandline options

2008-04-03 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=40181 >

 Outdated gamelog documentation noticed in forum thread
http://forum.freeciv.org/viewtopic.php?t=4883

 Comparing manpages to
 ./ser --help
 and
 ./civ --help
 reveals more errors.


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40180) Uninitialized datas in city structure

2008-04-03 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=40180 >

On 03/04/2008, Pepeto _  wrote:
>
>
> > [EMAIL PROTECTED] - Jeu. Avr. 03 00:09:30 2008]:
>  >  Memory for city structure is allocated with fc_calloc(). It takes
>  > care of zero initializations.
>  >
> Ok, thank you. I didn't know about it. Is it also the normal behaviour
>  of standard lib C calloc()?

 Yes, that's part of the standard.


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40171) bug in gtk client - select CMA none

2008-04-03 Thread Freeciv guest user

http://bugs.freeciv.org/Ticket/Display.html?id=40171 >

i noticed that PR#40097 is very similar to this report.

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40171) bug in gtk client - select CMA none

2008-04-03 Thread Freeciv guest user

http://bugs.freeciv.org/Ticket/Display.html?id=40171 >

i noticed that PR#40097 is very similar to this report.

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40176) map_distance_vector() crash

2008-04-03 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=40176 >

On 03/04/2008, Marko Lindqvist  wrote:
>
> On 03/04/2008, Marko Lindqvist  wrote:
>  >   This should be fixable simply by adding ref_count for vision sites.
>
>  Patch attached.

 - Handle reassigning same vision site to tile correctly
 - Some more comments added



 - ML

diff -Nurd -X.diff_ignore freeciv/common/vision.c freeciv/common/vision.c
--- freeciv/common/vision.c	2008-03-08 16:32:49.0 +0200
+++ freeciv/common/vision.c	2008-04-03 03:01:51.0 +0300
@@ -17,6 +17,7 @@
 
 #include 
 
+#include "log.h"
 #include "mem.h"
 #include "shared.h"
 
@@ -77,6 +78,11 @@
 /
 void free_vision_site(struct vision_site *psite)
 {
+  if (psite->ref_count > 0) {
+/* Somebody still uses this vision site. Do not free */
+return;
+  }
+  assert(psite->ref_count == 0);
   free(psite);
 }
 
@@ -119,3 +125,25 @@
   psite->size = pcity->size;
   sz_strlcpy(psite->name, city_name(pcity));
 }
+
+/
+  Copy relevant information from one site struct to another.
+  Currently only user expects everything except ref_count to be copied.
+  If other kind of users are added, parameter defining copied information
+  set should be added.
+/
+void copy_vision_site(struct vision_site *dest, struct vision_site *src)
+{
+  /* Copy everything except ref_count. */
+  strcpy(dest->name, src->name);
+  dest->location = src->location;
+  dest->owner = src->owner;
+  dest->identity = src->identity;
+  dest->size = src->size;
+  dest->border_radius_sq = src->border_radius_sq;
+  dest->occupied = src->occupied;
+  dest->walls = src->walls;
+  dest->happy = src->happy;
+  dest->unhappy = src->unhappy;
+  dest->improvements = src->improvements;
+}
diff -Nurd -X.diff_ignore freeciv/common/vision.h freeciv/common/vision.h
--- freeciv/common/vision.h	2008-03-08 16:32:49.0 +0200
+++ freeciv/common/vision.h	2008-04-03 00:05:41.0 +0300
@@ -124,6 +124,8 @@
   bool happy;
   bool unhappy;
 
+  int ref_count;
+
   bv_imprs improvements;
 };
 
@@ -134,6 +136,7 @@
 struct vision_site *create_vision_site_from_city(const struct city *pcity);
 void update_vision_site_from_city(struct vision_site *psite,
   const struct city *pcity);
+void copy_vision_site(struct vision_site *dest, struct vision_site *src);
 
 /* get 'struct site_list' and related functions: */
 #define SPECLIST_TAG site
diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c	2008-03-12 21:58:27.0 +0200
+++ freeciv/server/citytools.c	2008-04-03 03:48:32.0 +0300
@@ -1562,6 +1562,8 @@
   continue;
 }
 whole_map_iterate(ptile) {
+  /* FIXME: map_get_player_base()???
+   * Should be cities only: map_get_player_city() */
   if (!pplayer || NULL != map_get_player_base(ptile, pplayer)) {
 	send_city_info_at_tile(pplayer, pconn->self, NULL, ptile);
   }
@@ -1791,8 +1793,8 @@
   } improvement_iterate_end;
 
   if (NULL == pdcity) {
-map_get_player_tile(pcenter, pplayer)->site =
 pdcity = create_vision_site_from_city(pcity);
+change_playertile_site(map_get_player_tile(pcenter, pplayer), pdcity);
   } else if (pdcity->location != pcenter) {
 freelog(LOG_ERROR, "Trying to update bad city (wrong location)"
 	" at %i,%i for player %s",
@@ -1840,8 +1842,12 @@
   struct player_tile *playtile = map_get_player_tile(ptile, pplayer);
 
   dlsend_packet_city_remove(pplayer->connections, pdcity->identity);
+  assert(playtile->site == pdcity);
   playtile->site = NULL;
-  free(pdcity);
+  pdcity->ref_count--; /* Subtract ref_count before calling
+* free_vision_site() */
+  assert(pdcity->ref_count >= 0);
+  free_vision_site(pdcity);
 }
   }
 }
diff -Nurd -X.diff_ignore freeciv/server/maphand.c freeciv/server/maphand.c
--- freeciv/server/maphand.c	2008-03-12 21:58:27.0 +0200
+++ freeciv/server/maphand.c	2008-04-03 11:06:06.0 +0300
@@ -1073,6 +1073,34 @@
 }
 
 /***
+ Changes site information for player tile.
+***/
+void change_playertile_site(struct player_tile *ptile,
+struct vision_site *new_site)
+{
+  if (ptile->site == new_site) {
+/* Do nothing. Especially: don't decrease ref_count and
+ * free vision site... */
+return;
+  }
+
+  if (ptile->site != NULL) {
+/* Releasing old site from tile */
+ptile->site->ref_count--;
+assert(ptile->site->ref_count >= 0);
+if (ptile->site->ref_count == 0) {
+  /* Free vision site before losing its address completely */
+  free_vision_site(ptile->site);
+}
+  }
+  if (new_site != NUL

[Freeciv-Dev] (PR#40180) Uninitialized datas in city structure

2008-04-03 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=40180 >

> [EMAIL PROTECTED] - Jeu. Avr. 03 00:09:30 2008]:
> 
>  Memory for city structure is allocated with fc_calloc(). It takes
> care of zero initializations.
> 

Ok, thank you. I didn't know about it. Is it also the normal behaviour
of standard lib C calloc()?


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev