[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-11-14 Thread pepeto

Update of patch #1352 (project freeciv):

  Status:  Ready For Test => Done   
 Open/Closed:Open => Closed 


___

Reply to this item at:

  

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-11-11 Thread pepeto

Update of patch #1352 (project freeciv):

  Status: In Progress => Ready For Test 


___

Reply to this item at:

  

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-11-11 Thread pepeto

Follow-up Comment #9, patch #1352 (project freeciv):

Attached new version:
* Updated against current svn.
* Move the load and save functions in the notify module.
* More registry call with default values.
* Move the send_pending_events at the right place.
* Add _warn_unused_result_ attribute to event_cache_player_add().


(file #7280)
___

Additional Item Attachment:

File name: trunk_S2_2_save_event_cache.diff Size:14 KB


___

Reply to this item at:

  

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-31 Thread Matthias Pfafferodt

Follow-up Comment #8, patch #1352 (project freeciv):

> I would say at the end of srv_ready, in else case after
> init_new_game(). 

This does not help - I put it into start_game() and it is working now.

> The enumerator names are stored in common/events.c as
> enum_name member, but the accessors are missing. Also the list
> is not in the enum order. 

I did use the internal names for all the enumerators (foo_name()).

> It is quite wrong, because S_S_INITIAL state will be
> considered as turn 0. If a game is loaded and someone connects
> before it starts, he will receive wrong messages with strange
> tile info and other links. I think it must be protected by the
> server_state. 

It is back again ...

(file #7189)
___

Additional Item Attachment:

File name: event_cache-20091031-2-0004-save-event-cache-in-savegame.diff
Size:15 KB


___

Reply to this item at:

  

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-31 Thread pepeto

Follow-up Comment #7, patch #1352 (project freeciv):

> I suspected something like this but did not find the right place
> (start_game()?)

I would say at the end of srv_ready, in else case after init_new_game().

> The event enum is defined in event.h. The comment says that it
> is also used within the client. Furthermore, it is a rather big
> enum. I don't know, if it would be possible to use specnum.h for
> this.

The enumerator names are stored in common/events.c as enum_name member, but
the accessors are missing.  Also the list is not in the enum order.

Else, it is always possible to use specenum.h for this, it's just a setting
to change in generate_specenum.py (max_enum_values).

> I removed it as the check in event_cache_match() generated
> only trouble. It prevented the addition of events while
> loading a savegame.

It is quite wrong, because S_S_INITIAL state will be considered as turn 0. 
If a game is loaded and someone connects before it starts, he will receive
wrong messages with strange tile info and other links.  I think it must be
protected by the server_state.


___

Reply to this item at:

  

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-31 Thread Matthias Pfafferodt

Follow-up Comment #6, patch #1352 (project freeciv):

> Yup, you need to add send_pending_event(pconn, TRUE) when
> starting the game if the game is not new. 

I suspected something like this but did not find the right place
(start_game()?)
 
> I still don't like the usage of event as enum values.

The event enum is defined in event.h. The comment says that it is also used
within the client. Furthermore, it is a rather big enum. I don't know, if it
would be possible to use specnum.h for this.

> It looks like the server_state() info is missing... 

I removed it as the check in event_cache_match() generated only trouble. It
prevented the addition of events while loading a savegame.


___

Reply to this item at:

  

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-31 Thread pepeto

Update of patch #1352 (project freeciv):

  Status:None => In Progress


___

Reply to this item at:

  

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-31 Thread pepeto

Follow-up Comment #5, patch #1352 (project freeciv):

Yup, you need to add send_pending_event(pconn, TRUE) when starting the game
if the game is not new.

I still don't like the usage of event as enum values.  It looks like the
server_state() info is missing...


___

Reply to this item at:

  

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-31 Thread Matthias Pfafferodt

Follow-up Comment #4, patch #1352 (project freeciv):

updated version of the patch; changes:

* save all information of one event
* remove server_state from event_cache_data. It was mainly used in
event_cache_match(). For the restoring of the events from a savegame it is
only trouble.

One problem remains: If a player connects before the game is started he does
not get all events. The client does not handle game related events (message
box) at this point. If the game is started before the player connects all
messages are visible as expected.

(file #7183)
___

Additional Item Attachment:

File name: event_cache20091031-0002-save-event-cache-in-savegame.diff Size:14
KB


___

Reply to this item at:

  

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-30 Thread pepeto

Update of patch #1352 (project freeciv):

 Assigned to:None => pepeto 


___

Reply to this item at:

  

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-30 Thread pepeto

Follow-up Comment #3, patch #1352 (project freeciv):

>> "target_type" and "target" could be merged into:
>
> You mean within the savegame?

Yes

>> To learn how use bit vectors, you can look at
>> utility/shared.h.
>
>
> I read the file but your example helps more than me trying to
> understand the different BV_* macros ;-)

BV_CL_ALL(bv) -> set all to 0, (about like FD_ZERO, see man page).
BV_CLR(bv, bit) -> set the bit 'bit' to 0 (See also FD_CLR).
BV_SET(bv, bit) -> set the bit 'bit' to 1 (See also FD_SET).
BV_ISSET(bv, bit) -> returns if the bit 'bit' is set or not (See also
FD_ISSET).


___

Reply to this item at:

  

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-30 Thread Matthias Pfafferodt

Follow-up Comment #2, patch #1352 (project freeciv):

> I don't like saving enum as integers, it makes big
> compatibility problems for save games. They should be saved as
> strings with function accessors. Maybe it's time to apply
> patch #1309 to simplify that? 

Yes, this would help in the conversion enum => string (and back)
 
> "target_type" and "target" could be merged into: 

You mean within the savegame?

> To learn how use bit vectors, you can look at
> utility/shared.h. 

I read the file but your example helps more than me trying to understand the
different BV_* macros ;-)

___

Reply to this item at:

  

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-30 Thread pepeto

Follow-up Comment #1, patch #1352 (project freeciv):

I don't like saving enum as integers, it makes big compatibility problems for
save games.  They should be saved as strings with function accessors.  Maybe
it's time to apply patch #1309 to simplify that?

"target_type" and "target" could be merged into:
* "All"
* "Global observers"
* "01110" _A suite of players able to see that, got with_:

char target[256];
char *p = target;

players_iterate(pplayer) {
  *p++ = (BV_ISSET(pdata->target), player_index(pplayer))
  ? '1' : '0');
} players_iterate_end;
*p = '\0'


To learn how use bit vectors, you can look at utility/shared.h.


___

Reply to this item at:

  

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1352] save event cache in savegame

2009-10-29 Thread Matthias Pfafferodt

URL:
  

 Summary: save event cache in savegame
 Project: Freeciv
Submitted by: syntron
Submitted on: Freitag 30.10.2009 um 00:13
Category: general
Priority: 5 - Normal
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 2.2.0

___

Details:

basic work to save the event cache in the savegames. The handling (save/load)
of the bitvector event->target is missing as I'm not familiar enough with it
...

I tested the patch - the events are saved and loaded but not visible due to
the missing bitvector part.

As the event cache patch is applied for 2.2, this is also a possible
candidate for this version; no changes to network et. al.



___

File Attachments:


---
Date: Freitag 30.10.2009 um 00:13  Name:
event_cache20091030-0001-save-event-cache-in-savegame.diff  Size: 12kB   By:
syntron



___

Reply to this item at:

  

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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