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 #839703

Server-side CMA

Added by Zoltán Žarkov almost 3 years ago. Updated over 2 years ago.

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

0%

Estimated time:

Description

It's useful to have server-side CMA so that it is not trivial to mess up an enemy's city workers by moving a submarine around.

0003-Add-server-side-CMA.patch (27.7 KB) 0003-Add-server-side-CMA.patch S3_0 Zoltán Žarkov, 2019-10-03 04:58 AM
0002-Add-server-side-CMA.patch (25.3 KB) 0002-Add-server-side-CMA.patch master Zoltán Žarkov, 2019-10-03 04:58 AM
0001-Add-server-side-CMA.patch (21.6 KB) 0001-Add-server-side-CMA.patch Zoltán Žarkov, 2020-04-29 05:39 PM
0001-Add-server-side-CMA.patch (28.5 KB) 0001-Add-server-side-CMA.patch Zoltán Žarkov, 2020-04-29 10:26 PM
0001-Add-server-side-CMA.patch (29 KB) 0001-Add-server-side-CMA.patch Zoltán Žarkov, 2020-04-30 12:26 AM
0001-Add-server-side-CMA.patch (33.3 KB) 0001-Add-server-side-CMA.patch Zoltán Žarkov, 2020-05-01 06:05 AM
0001-Add-server-side-CMA.patch (33.4 KB) 0001-Add-server-side-CMA.patch Zoltán Žarkov, 2020-05-04 05:21 PM

Related issues

Blocked by Freeciv - Feature #839704: CMA max_growth option for optimal food surplusClosed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

History

#2 Updated by Zoltán Žarkov over 2 years ago

  • Blocked by Feature #839704: CMA max_growth option for optimal food surplus added

#3 Updated by Zoltán Žarkov over 2 years ago

  • Assignee set to Marko Lindqvist
  • Sprint/Milestone changed from 3.0.0-beta1 to 3.1.0

After #839704 do you think you'd like to review this? There are some changes in the preceding issue that would also have to be reflected in this patch, but I'll work on this patch when the others are resolved.

#4 Updated by Marko Lindqvist over 2 years ago

Does this really require moving cm specific stuff from cm.[ch] to city.[ch]?

When handle_city_manager() receives !enabled, it sets city cm_parameter to NULL. Should it free() it first?

#5 Updated by Zoltán Žarkov over 2 years ago

I believe I moved struct declarations around to avoid circular includes in headers. Would you rather I put an opaque pointer in struct city in order to keep most of the functions in the same places?

#6 Updated by Zoltán Žarkov over 2 years ago

- I had renamed the cm_parameter_are_equal to match what is expected in generate_packets.py but now I have adapted generate_packets instead.
- Free cm_parameter when being set to NULL in handle_city_parameter
- struct cm_parameter remains defined in cm.h. Since cm_parameter is in packets_gen.h, common/aicore is added as include in many Makefiles.

#7 Updated by Marko Lindqvist over 2 years ago

Note to integrator (probably myself): This changes network protocol so capstring bump is needed when committing this (not part of current patch)

Some of those free() calls without setting pointer in the city structure to NULL afterwards look suspicious, but I've not searched for their context beyond what is visible in hrm patch display. Is there a danger that dangling pointer ever gets used?

Have you tested compiling this with json protocol enabled?

#8 Updated by Zoltán Žarkov over 2 years ago

- Added dataio for json, checked build.
- Added setting of NULL after free where needed. The second place, in city_destroy_virtual, should not need setting to NULL.

#9 Updated by Zoltán Žarkov over 2 years ago

- Added common/aicore to Makefile.am for gui-stub
- Improved failure behavior for player-defined cma. Now, the cma is canceled on failure, and player is notified.

#10 Updated by Marko Lindqvist over 2 years ago

- Some extraneous 'return' statements in handle_city_manager()
- Savegame loading looks for 'cma_enabled' as int, should be bool (and default value FALSE instead of 0)
- json enabled build does not compile. My configure: "--enable-debug --enable-json --disable-delta-protocol"

#11 Updated by Zoltán Žarkov over 2 years ago

- Removed redundant return statement
- Fixed cma_enabled savegame type
- Json enabled builds.

#12 Updated by Marko Lindqvist over 2 years ago

  • Category set to General
  • Status changed from New to Resolved

#13 Updated by Zoltán Žarkov over 2 years ago

- Memset packet->cm_parameter to 0 when packaging city and city's cm_parameter is not set. This was causing incompatible packet contents on client.

#14 Updated by Marko Lindqvist over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF