Project

General

Profile

Actions

Bug #1564

closed

Correct airlift enabled checking

Added by Alexandr Ignatiev 2 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Category:
client-common
Target version:
Start date:
07/04/2025
Due date:
% Done:

0%

Estimated time:

Description

When considering (with limited knowledge) the possibility of airlifting from/to foreign city, the functions action_hard_reqs_actor in actions.c and test_unit_can_airlift_to in unit.c return uncertain results due to unknown airlift counter even if airlift_from/to_always_enabled is set. This has actually few effect since client allows maybe-possible actions.

Headscratches note: how does it check presence of non-mutual ally units in a foreign city? I tested it in v.3.1 and the unit stays in source city without any note, so some check is performed but idk where, seems like definitely not in do_airlime. EDIT: yes, there is no check in main versoion, the unit lands on heads of non-allied units. I'll look how deep that goes. EDIT 2: yes, it goes back to 3.1 and earlier.


Files

3_4-airlift_possible_corr.patch (5.33 KB) 3_4-airlift_possible_corr.patch Alexandr Ignatiev, 07/07/2025 01:07 AM
3_4-airlift_possible_corr1.patch (8.91 KB) 3_4-airlift_possible_corr1.patch Alexandr Ignatiev, 07/07/2025 11:34 PM
3_4-airlift_possible_corr2.patch (16 KB) 3_4-airlift_possible_corr2.patch Alexandr Ignatiev, 07/08/2025 10:44 PM
3_3-airlift_possible_corr.patch (15.7 KB) 3_3-airlift_possible_corr.patch Alexandr Ignatiev, 07/09/2025 12:01 AM
3_1-airlift_possible_corr.patch (15.3 KB) 3_1-airlift_possible_corr.patch Alexandr Ignatiev, 07/09/2025 10:00 PM
3_2-airlift_possible_corr.patch (15.2 KB) 3_2-airlift_possible_corr.patch Alexandr Ignatiev, 07/09/2025 10:00 PM
3_2-airlift_possible_corr1.patch (15.3 KB) 3_2-airlift_possible_corr1.patch Alexandr Ignatiev, 07/11/2025 08:01 PM
3_1-airlift_possible_corr1.patch (15.3 KB) 3_1-airlift_possible_corr1.patch Alexandr Ignatiev, 07/11/2025 08:01 PM
Actions #1

Updated by Alexandr Ignatiev 2 months ago

  • Description updated (diff)
Actions #2

Updated by Alexandr Ignatiev 2 months ago

  • Description updated (diff)
Actions #3

Updated by Alexandr Ignatiev 2 months ago

  • Description updated (diff)
Actions #4

Updated by Alexandr Ignatiev 2 months ago

Patch for 3.4, earlier versions need another one

Actions #5

Updated by Alexandr Ignatiev 2 months ago

Hmm seems wrong for flagless units. They should be not airliftable neither to ally cities at all nor to own cities with ally units.

Actions #6

Updated by Alexandr Ignatiev 2 months ago

Edited into a mostly working function. Now should be propagated to earlier versions.

Actions #7

Updated by Alexandr Ignatiev 2 months ago

Ouch, misplaced the ? : branches.

Also, may we allow the clients to try airlift to any unseen city in hope that an ally conquered it (at least if we have a live ally)?

Actions #8

Updated by Alexandr Ignatiev 2 months ago

Rewrote things, tested it on a civ1 map, now it should work.

Actions #9

Updated by Alexandr Ignatiev 2 months ago

3.3 patch, need to remove flagless lines for 3.1/3.2 one

Actions #11

Updated by Marko Lindqvist 2 months ago

S3_1 patch uses nullptr:

../../src/common/unit.c: In function ‘test_unit_can_airlift_to’:
../../src/common/unit.c:94:33: error: ‘nullptr’ undeclared (first use in this function); did you mean ‘nullptr_t’?
94 | const struct tile *dst_tile = nullptr; | ^~~~~ | nullptr_t

Actions #12

Updated by Alexandr Ignatiev 2 months ago

hmm happens 3.3 and 3.2 also use it, but they somehow compiled at my installation.

Actions #13

Updated by Marko Lindqvist 2 months ago

nullptr is being defined even in S3_2, though our CodingStyle was (later) defined to prefer it in S3_3 and later only, and to avoid it in S3_2.

Actions #14

Updated by Alexandr Ignatiev 2 months ago

Marko Lindqvist wrote in #note-13:

though our CodingStyle was (later) defined to prefer it in S3_3

Does it mean the patch for main can go for 3.3?

Actions #15

Updated by Marko Lindqvist 2 months ago

Alexandr Ignatiev wrote in #note-14:

Marko Lindqvist wrote in #note-13:

though our CodingStyle was (later) defined to prefer it in S3_3

Does it mean the patch for main can go for 3.3?

They both should have nullptr instead of NULL, if that's what you are asking.

Updated by Alexandr Ignatiev 2 months ago

Well, that's likely the patces' only difference for now. So I correct 3.1,2 only.

Actions #17

Updated by Marko Lindqvist 2 months ago

  • Status changed from New to In Review
  • Assignee set to Marko Lindqvist
Actions #18

Updated by Marko Lindqvist about 2 months ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF