[Freeciv-Dev] (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea ba
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians) |
From: |
"mateusz stefek" <matusik_s@xxxxx> |
Date: |
Sat, 14 Feb 2004 04:09:46 -0800 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7408 >
On 2004.02.12 21:38, Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7408 >
>
> > [matusik_s@xxxxx - Tue Feb 10 14:53:43 2004]:
> >
> > Load attached game. Take mathew, press [Turn Done]
> > Sea barbarians bug?
>
> More phantom units, it seems. I suppose the server is supposed to tell
> the client to remove these units, but it doesn't. So the client ends up
> knowing about some units on fogged tiles.
>
> >From the client you can see that the server creates a sea barbarian at
> (27,24). This is in sight of Methew's transport. When the transport
> moves out of range the bug kicks in.
>
What is going on?
Mathew has trasport at (27,24). try_summon_barbarians() is creating sea
barbarians at (27,24)
Take a look at the code: (barbarian.c:394)
struct unit *punit, *ptrans;
barbarians = create_barbarian_player(FALSE);
boat = find_a_unit_type(L_BARBARIAN_BOAT,-1);
ptrans = create_unit(barbarians, xu, yu, boat, 0, 0, -1);
cap = get_transporter_capacity(unit_list_get(&map_get_tile(xu, yu)->units,
0));
for (i = 0; i < cap-1; i++) {
unit = find_a_unit_type(L_BARBARIAN_SEA,L_BARBARIAN_SEA_TECH);
punit = create_unit(barbarians, xu, yu, unit, 0, 0, -1);
punit->transported_by = ptrans->id;
freelog(LOG_DEBUG, "Created barbarian unit %s", unit_types[unit].name);
}
punit = create_unit(barbarians, xu, yu,
get_role_unit(L_BARBARIAN_LEADER, 0), 0, 0, -1);
punit->transported_by = ptrans->id;
}
unit_list_iterate(map_get_tile(xu, yu)->units, punit2) {
send_unit_info(NULL, punit2);
} unit_list_iterate_end;
And here is a bug! Mathew is receiving info about all units inside Galeon! This
is wrong because when Galeon moves server will assume that Mathew cannot see it.
I'm not sure how this unit stack should be initialized. Jason?
--
P.S.
I found some stupid bug in try_summon_barbarians()
Patch attached. Unfortunatelly problem is much more complicated. In this case
xu = x and yu = y so the patch doesn't change anything.
mateusz
--- freeorig/server/barbarian.c 2004-01-12 10:01:04.000000000 +0100
+++ freeciv/server/barbarian.c 2004-02-14 10:42:32.000000000 +0100
@@ -372,9 +372,9 @@
}
freelog(LOG_DEBUG, "Barbarians are willing to fight");
- if (map_has_special(x, y, S_HUT)) { /* remove the hut in place of uprising */
- map_clear_special(x,y,S_HUT);
- send_tile_info(NULL, x, y);
+ if (map_has_special(xu, yu, S_HUT)) { /* remove the hut in place of uprising
*/
+ map_clear_special(xu, yu, S_HUT);
+ send_tile_info(NULL, xu, yu);
}
if (!is_ocean(map_get_terrain(xu,yu))) {
@@ -408,7 +408,7 @@
punit->transported_by = ptrans->id;
}
- unit_list_iterate(map_get_tile(x, y)->units, punit2) {
+ unit_list_iterate(map_get_tile(xu, yu)->units, punit2) {
send_unit_info(NULL, punit2);
} unit_list_iterate_end;
- [Freeciv-Dev] (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), mateusz stefek, 2004/02/10
- [Freeciv-Dev] (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), Jason Short, 2004/02/12
- [Freeciv-Dev] (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians),
mateusz stefek <=
- [Freeciv-Dev] (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), Jason Short, 2004/02/14
- [Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), mateusz stefek, 2004/02/16
- [Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), Jason Short, 2004/02/16
- [Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), Gregory Berkolaiko, 2004/02/16
- [Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), Jason Short, 2004/02/16
- [Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), ue80@xxxxxxxxxxxxxxxxxxxxx, 2004/02/16
- [Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), Jason Short, 2004/02/16
- [Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), ue80@xxxxxxxxxxxxxxxxxxxxx, 2004/02/16
- [Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians), Raimar Falke, 2004/02/16
|
|