Re: [Freeciv-Dev] (PR#39829) 2.1.0 assert bad city size

2007-11-03 Thread Per I. Mathisen

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

On 11/3/07, William Allen Simpson <[EMAIL PROTECTED]> wrote:
> Per I. Mathisen wrote:
> > That should not be the problem. These are just two different ways of
> > counting the same citizens. A citizen has two properties - its kind
> > (worker or specialist type) and attitude (happy, unhappy, angry,
> > celebrating, content) - and you need to count both, but separately.
> >
> Maybe it shouldn't be a problem, but it is  The citydlg_common.c
> code counts the attitude numbers, adds the specialists (which apparently
> aren't included in the attitude), and assert(i == pcity->size) fails.

The reason for this is that specialists do not have attitude. I think
this is a design mistake, but that is another question.

  - Per



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


Re: [Freeciv-Dev] (PR#39825) Freeciv 2.1.0 SDL client bug

2007-11-03 Thread Erik Johansson

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

On Nov 3, 2007 3:10 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> http://bugs.freeciv.org/Ticket/Display.html?id=39825 >
>
> Erik Johansson wrote:
> > http://bugs.freeciv.org/Ticket/Display.html?id=39825 >
> >
> > On Nov 2, 2007 12:02 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> >> http://bugs.freeciv.org/Ticket/Display.html?id=39825 >
> >>
> >> game crashes when disbanding a unit and outputs Segmentation fault core
> >> dump
> >>
> >
> > Hi Weston
> >
> > can you tell us what, OS, version of freeciv, you are using. Please
> > tell us when this happens, and if you can reproduce it send us the
> > savegame..
> >
> > I tried on 2.1 SDL and it seems to handle disbands fine.
> >
> > Have fun /Erik
> >
> >
> >
> im sorry i was kinda doing alot of things at once
> Ubuntu 7.10 and 2.1.0 i built it from source
> and if i disband some of the in-city units freeciv crashes

Hi Again

I have the same system and I can't reproduce this on Ubuntu, can you
tell me exactly what you do to get the crash?

I found another bug that I really need someone to confirm for me..

1. open a city window (needs to have units present)
2. move mouse to present units box.
3. hover mouse over unit, notive it gets highlighted
4. move mouse away from unit but keep with in the present units box
5. left click
6. try to hover over the same unit again

expected results:
* the unit gets highlighted, and can be activated

actual results
* the unit isn't highlighted and can't be activated



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


Re: [Freeciv-Dev] (PR#39829) 2.1.0 assert bad city size

2007-11-03 Thread William Allen Simpson

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

Per I. Mathisen wrote:
> The reason for this is that specialists do not have attitude. I think
> this is a design mistake, but that is another question.
> 
In this case, it turned out to be a boon!

The discovered problem was packhand.c handle_city_short_info() setting
the city->size in the "final" citizen feeling entry, but not in the "base".
This was immediately wiped by the city.c generic_city_refresh(), as it
copied base to luxury ... to final.

That's why no server errors from the virtual city code -- it set both
specialist and "final", but the "final" entry was wiped out, so the
duplicate total in the specialist matched the city size.  Seems like
somebody was coding by trial and error.

The solution was to set the default specialist only.  The little people
display as specialists, but that's OK, as the observer doesn't have control
of the city anyway.

Anyway, changing specialists to have attitude in the future will be much
easier, as the code now has defined symbols and a bit less obscurity

Reminder, this only fixes the 2.1.0 city display, not the other bugs
reported in the same ticket.  That was a tedious 15 or so hours of work,
I'll look at the other problems later.

Committed S2_1 revision 13911.
Committed S2_2 revision 13912.
Committed trunk revision 13913.

Final S2_2 changes for posterity (a bit different from S2_1, same as trunk):

Index: server/score.c
===
--- server/score.c  (revision 13911)
+++ server/score.c  (working copy)
@@ -259,10 +259,10 @@
   city_list_iterate(pplayer->cities, pcity) {
 int bonus;
 
-pplayer->score.happy += pcity->ppl_happy[4];
-pplayer->score.content += pcity->ppl_content[4];
-pplayer->score.unhappy += pcity->ppl_unhappy[4];
-pplayer->score.angry += pcity->ppl_angry[4];
+pplayer->score.happy += pcity->feel[CITIZEN_HAPPY][FEELING_FINAL];
+pplayer->score.content += pcity->feel[CITIZEN_CONTENT][FEELING_FINAL];
+pplayer->score.unhappy += pcity->feel[CITIZEN_UNHAPPY][FEELING_FINAL];
+pplayer->score.angry += pcity->feel[CITIZEN_ANGRY][FEELING_FINAL];
 specialist_type_iterate(sp) {
   pplayer->score.specialists[sp] += pcity->specialists[sp];
 } specialist_type_iterate_end;
Index: server/citytools.c
===
--- server/citytools.c  (revision 13911)
+++ server/citytools.c  (working copy)
@@ -1635,13 +1635,13 @@
   sz_strlcpy(packet->name, pcity->name);
 
   packet->size=pcity->size;
-  for (i=0;i<5;i++) {
-packet->ppl_happy[i]=pcity->ppl_happy[i];
-packet->ppl_content[i]=pcity->ppl_content[i];
-packet->ppl_unhappy[i]=pcity->ppl_unhappy[i];
-packet->ppl_angry[i]=pcity->ppl_angry[i];
+  for (i = 0; i < FEELING_LAST; i++) {
+packet->ppl_happy[i] = pcity->feel[CITIZEN_HAPPY][i];
+packet->ppl_content[i] = pcity->feel[CITIZEN_CONTENT][i];
+packet->ppl_unhappy[i] = pcity->feel[CITIZEN_UNHAPPY][i];
+packet->ppl_angry[i] = pcity->feel[CITIZEN_ANGRY][i];
   }
-  /* The number of data in specilists[] array */
+  /* The number of data in specialists[] array */
   packet->specialists_size = specialist_count();
   specialist_type_iterate(sp) {
 packet->specialists[sp] = pcity->specialists[sp];
Index: server/cityturn.c
===
--- server/cityturn.c   (revision 13911)
+++ server/cityturn.c   (working copy)
@@ -1491,9 +1491,9 @@
   }
 
   size = MAX(1, pcity->size
-+ pcity->ppl_happy[4]
-- pcity->ppl_unhappy[4]
-- pcity->ppl_angry[4] * 3);
++ pcity->feel[CITIZEN_HAPPY][FEELING_FINAL]
+- pcity->feel[CITIZEN_UNHAPPY][FEELING_FINAL]
+- pcity->feel[CITIZEN_ANGRY][FEELING_FINAL] * 3);
   cost *= size;
   cost *= game.info.incite_total_factor;
   cost = cost / (dist + 3);
Index: server/savegame.c
===
--- server/savegame.c   (revision 13911)
+++ server/savegame.c   (working copy)
@@ -2185,12 +2185,13 @@
 
   for (i = 0; i < ncities; i++) { /* read the cities */
 struct city *pcity;
+const char *kind;
+const char *name;
+int id, k;
+int citizens = 0;
 int nat_x = secfile_lookup_int(file, "player%d.c%d.x", plrno, i);
 int nat_y = secfile_lookup_int(file, "player%d.c%d.y", plrno, i);
 struct tile *ptile = native_pos_to_tile(nat_x, nat_y);
-const char* kind;
-const char* name;
-int id, k;
 
 pcity = create_city_virtual(plr, ptile,
   secfile_lookup_str(file, "player%d.c%d.name", plrno, i));
@@ -2214,6 +2215,7 @@
 pcity->steal=secfile_lookup_int(file, "player%d.c%d.steal", plrno, i);
 
 specialist_type_iterate(sp) {
+  citizens +=
   pcity->specialists[sp]
= secfile_lookup_int(file, "player%d.c%d.n%s", plrno, i,

Re: [Freeciv-Dev] (PR#39831) Training and combat

2007-11-03 Thread Joan Creus

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

Good suggestion. I like it. Just one point: shouldn't it be "with Barracks"
instead of "with a Barracks"? I'm not a native English speaker, but it
doesn't feel right.

Can anybody improve on Randy's suggestion?

Joan

2007/11/3, Randy Kramer <[EMAIL PROTECTED]>:
>
>
> http://bugs.freeciv.org/Ticket/Display.html?id=39831 >
>
> Joan,
>
> I'm not a developer, really just a lurker, well, and a tweaker--on looking
> at
> the messages you changed (thanks, btw), I wondered if they could be
> improved
> any further--see below.  Maybe you can take them even further.
>
> regards,
> Randy Kramer
>
> On Friday 02 November 2007 06:46 pm, Joan Creus wrote:
> > When I started playing Freeciv, the sentence in the documentation that
> > puzzled me most was "May become veteran through training or combat".
> Combat
> > was clear, but I kept looking for ways to train my units *after* they
> had
> > been built. Laugh at me if you want, but it took me a while to figure
> out
> > that the training was supposed to take place in the Barracks while the
> units
> > were built.
> >
> > So I have written a small modification to helpdata.c to improve this
> > sentence:
> >
> > - for terrestrial units, it will show: "May become veteran through
> combat or
> > training (if built in a city with Barracks or in a civilization with an
> > active Sun Tzu.)"
>
> Hmm, how about "Will be built as a veteran unit in a city with a Barracks
> or
> in a civilization with an active Sun Tzu, or can become a veteran through
> combat."
>
> or, if necessary to shorten it:
>
> "Built as a veteran in a city with a Barracks or in a civilization with an
> active Sun Tzu, or can become a veteran through combat."
>
> "Built as a veteran with a Barracks or an active Sun Tzu, or can become a
> veteran through combat."
>
> > - for maritime units, it will show: "May become veteran through combat
> or
> > training (if built in a city with Port Facility.)"
>
> and so on
>
> > - for planes and helicopters, the message will be: "May become veteran
> > through combat or training (if built in a city with Airport.)"
> >
> > There are three exceptions, though: Triremes can't be built if you have
> Port
> > Facility, because Navigation obsoletes them. However, they may become
> > veteran if they survive in the high seas, so the message could say: "May
> > become veteran through combat or training (if it survives in the high
> > seas.)"; the other exceptions are Diplomats and Spies. They are too
> > high-brow to attend Barracks, but Communist governments make them
> veteran,
> > so the message is: "May become veteran through combat or training (if
> built
> > under a
> > communist government.)"
> >
> > These are the special cases I have thought of. Perhaps rulesets can be
> > twisted to make Port Facilities without Navigation, but I really think
> this
> > new messages would help newbies.
> >
> > I don't especially like the wording. Feel free to change it.
> >
> > As for the online manual, the mentions to Barracks, Sun Tzu and the like
> > could link to the proper pages. I can update it once we have a final
> > version.
> >
> > The diff file is for trunk/client/helpdata.c
> >
> > Cheers,
> >
> > Joan
> > Note: This is an HTML message. For security reasons, only the raw HTML
> code
> is shown. If you trust the sender of this message then you can activate
> formatted HTML display for this message by clicking here.
>
>
>

Good suggestion. I like it. Just one point: shouldn't it be "with Barracks" instead of "with a Barracks"? I'm not a native English speaker, but it doesn't feel right.Can anybody improve on Randy's suggestion?
    Joan2007/11/3, Randy Kramer <[EMAIL PROTECTED]>:
http://bugs.freeciv.org/Ticket/Display.html?id=39831 >Joan,I'm not a developer, really just a lurker, well, and a tweaker--on looking at
the messages you changed (thanks, btw), I wondered if they could be improvedany further--see below.  Maybe you can take them even further.regards,Randy KramerOn Friday 02 November 2007 06:46 pm, Joan Creus wrote:
> When I started playing Freeciv, the sentence in the documentation that> puzzled me most was "May become veteran through training or combat". Combat> was clear, but I kept looking for ways to train my units *after* they had
> been built. Laugh at me if you want, but it took me a while to figure out> that the training was supposed to take place in the Barracks while the units> were built.>> So I have written a small modification to 
helpdata.c to improve this> sentence:>> - for terrestrial units, it will show: "May become veteran through combat or> training (if built in a city with Barracks or in a civilization with an
> active Sun Tzu.)"Hmm, how about "Will be built as a veteran unit in a city with a Barracks orin a civilization with an active Sun Tzu, or can become a veteran throughcombat."
or, if necessary to shorten it:"Built as a veteran in a city with a Barracks or in a 

[Freeciv-Dev] (PR#39832) assertion in server

2007-11-03 Thread

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

civserver: unithand.c:361: real_unit_change_homecity: Assertion 
`!unit_alive || unit_owner(punit) == city_owner(new_pcity)' failed.

We played from the last save game and didn't reproduce it. It happened 
just as I had taken over a city.

I'm sorry I couldn't reproduce it with cores enabled.

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


[Freeciv-Dev] (PR#39832) Re: assertion in server

2007-11-03 Thread

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

> [guest - Sat Nov 03 20:06:41 2007]:
> 
> civserver: unithand.c:361: real_unit_change_homecity: Assertion 
> `!unit_alive || unit_owner(punit) == city_owner(new_pcity)' failed.
> 
> We played from the last save game and didn't reproduce it. It 
happened 
> just as I had taken over a city.
> 
> I'm sorry I couldn't reproduce it with cores enabled.
> 
Oh, this is 2.1.0.

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


[Freeciv-Dev] (PR#39833) Citizen Manager cannot work with Gold deficit of more than 20.

2007-11-03 Thread Pavel N. Krivitsky

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

The CM simply cannot tolerate Gold of less than -20. The cause of this
appears to be that CM configuration tab in the City popup doesn't allow
Minimum Surplus to be set below that.

This leads to problems late in a game, when a city can have many costly
improvements, and Tax Rate can be low with Coinage production to make
up. A particularly absurd outcome of this that I've observed was a CM
that set to Max Food starving a city, because it converted workers to
Taxmen to reduce Gold deficit to less than 20.

I would suggest having the lowest setting in CM configuration tab slider
be that a minimum surplus is not enforced for that output.



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