URL:
<http://gna.org/bugs/?13803>
Summary: [Patch] Start position cleanup and extension
Project: Freeciv
Submitted by: mbook
Submitted on: Sunday 06/28/2009 at 06:07
Category: editor
Severity: 3 - Normal
Priority: 5 - Normal
Status: Ready For Test
Assigned to: mbook
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release:
Operating System: None
_______________________________________________________
Details:
The attached patch implements improved start position
functionality for the editor. Depends on the patches
in #13793, #13800, #13801 and #13802.
The user can now easily place start positions on the
map in edit mode, and efficiently set which nations
may start at any given position, including allowing
all nations or excluding specific ones (via the
property editor).
Two packets are used for communicating start position
information between clients and the server:
PACKET_EDIT_STARTPOS
PACKET_EDIT_STARTPOS_FULL
The first is used to either create or remove a start
position at a tile, and the second to set the nation
information. A bitvector is used to pack a list of
nations into the packet (bits correspond to nation
numbers), with a limit of 1024 maximum nations
(MAX_NUM_STARTPOS_NATIONS in fc_types.h). Hopefully
before more than 1024 nations exist there will be
better network protocol support for dynamic arrays
in packets, removing the need for hard-coded maximum
sizes.
These packets are sent by both the client and the
server, allowing most of the handling code to be
factored out into functions in common/map.c.
Some less noteworthy internal additions:
- Added a 'TILE' packet field (SINT32) used to
send tile indexes, as an alternative to sending
COORD x, y.
- Added a new object type OBJTYPE_STARTPOS to the
property editor, along with 2 read-only and 2
editable properties.
- Added a new value type VALTYPE_STARTPOS_NATIONS
for special handling of a hash_table used to
represent the nations at a start position.
- Added iterators for iterating all nations in a
start position, and all start positions on the
map.
- Updated version.in due to packet changes.
And some partially related fixes:
- PACKET_EDIT_TILE had incorrect but harmless
"UNIT id" field, which I changed to "TILE id".
- editgui_notify_object_{changed,created}() do not
propagate the notifications outside of edit mode.
- Made objtype_get_id_from_object() use -1 to
represent an invalid ID instead of zero, since for
example for tile IDs (i.e. as returned by tile
_index()) zero is a valid value.
- Added some argument checks in property_page_add
_objbind().
As far as start positions go now, what remains to
be done is:
* Make the map generator use the new start position
API (hence remove map.start_positions).
* Send start positions to editing clients when
entering edit mode.
* Implement saving and loading of the new start
position data structures in savegames/scenarios.
* Get a better start position map sprite than
user.attention (also perhaps somehow distinguish
between a start position allowing all, some, or
excluding nations).
----------------------------------------------------------------
ようやくやった。
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sunday 06/28/2009 at 06:07 Name: startpos_cleanup_and_extension.patch
Size: 52kB By: mbook
<http://gna.org/bugs/download.php?file_id=6068>
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?13803>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev