Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #833667

Feature #822927: Rally points for cities

Network protocol: turn unit orders into array of struct

Added by Louis Moureaux almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Category:
General
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Unit orders were sent as 5 distinct arrays:

ORDERS orders[]
DIRECTION dirs[]
ACTIVITY activities[]
ACTION_SUB_TGT sub_targets[]
ACTION_ID actions[]

This combination was used four times in the protocol. This patch turns all of them into a single array:

UNIT_ORDER orders[]

This change simplifies the interface of some orders-related functions, making it possible to share code between goto and rally points.

The patch is provided for master, but I can make a 3.0 version if needed (there are some minor conflicts so please tell me what you think). This is the last patch for rally points that changes the network protocol; no data format change will be required.

This was tested by playing several 100s of turns with the binary protocol and a dozen with JSON.

History

#2 Updated by Marko Lindqvist almost 3 years ago

Have you checked that the delta protocol does sane things with this? I assume it does, but someone should make sure, maybe even add a couple of words to README.delta.

#3 Updated by Marko Lindqvist almost 3 years ago

  • Tracker changed from Task to Feature

#4 Updated by Marko Lindqvist almost 3 years ago

CC unithand.lo
../../../src/server/unithand.c: In function ‘handle_unit_orders’:
../../../src/server/unithand.c:4865:8: error: ‘i’ undeclared (first use in this function)
4865 | for (i = 0; i < length; i++) { | ^
../../../src/server/unithand.c:4865:8: note: each undeclared identifier is reported only once for each function it appears in

Please add reference to the ticket to the commit messages in the future. ("See hrm Feature #??????")

#5 Updated by Marko Lindqvist almost 3 years ago

- Fixed debug build compilation
- Bumped network capstring
- Added hrm ticket reference to commit message

#6 Updated by Louis Moureaux almost 3 years ago

../../../src/server/unithand.c:4865:8: note: each undeclared identifier is reported only once for each function it appears in

My fault, I had a warning about it being unused (in a non-debug build). Will refrain from blindly "fixing" these in the future :)

Please add reference to the ticket to the commit messages in the future. ("See hrm Feature #??????")

Sure, will do.

Have you checked that the delta protocol does sane things with this? I assume it does, but someone should make sure, maybe even add a couple of words to README.delta.

Delta will resend the whole array if any element changed because "diff" is not specified. The worst case is a bit worse than it used to be (since arrays were treated separately), while the best case is unchanged.

I'm a bit afraid of touching your patch because it doesn't apply cleanly to current master (capstring conflict), so I'm providing a new one with only the documentation update. I can open a separate issue if you prefer not to squash it.

#7 Updated by Marko Lindqvist almost 3 years ago

Louis Moureaux wrote:

I'm a bit afraid of touching your patch because it doesn't apply cleanly to current master (capstring conflict), so I'm providing a new one with only the documentation update. I can open a separate issue if you prefer not to squash it.

Let's have a separate ticket about it so this one can go forward already.

#8 Updated by Marko Lindqvist almost 3 years ago

  • Status changed from Resolved to Closed

#9 Updated by Marko Lindqvist almost 3 years ago

Marko Lindqvist wrote:

Louis Moureaux wrote:

the documentation update.

Let's have a separate ticket about it so this one can go forward already.

-> Feature #834328

Also available in: Atom PDF