Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3894 closed defect (fixed)

[PATCH] We should be able to set a trade-route with a miraged market

Reported by: mimo Owned by: mimo
Priority: Should Have Milestone: Alpha 21
Component: UI & Simulation Keywords: patch
Cc: Itms Patch:

Description

Currently, the gui does not allow to set a route with a miraged market, which is a problem when trading with neutrals, or with allies before the shared los tech. The mirage should be extended to contain the market info, and this be used by the gui when setting a route.

Once done, UnitAI should be able to use this info to take the proper action when a market is destroyed or captured.

see also some discussion in #3277

Attachments (5)

marketVisibility.patch (6.4 KB ) - added by mimo 8 years ago.
patch to allow making a trade route with a miraged market
marketVisibility-v2.patch (11.1 KB ) - added by mimo 8 years ago.
new approach, should be more robust
marketVisibility-v2.1.patch (11.4 KB ) - added by mimo 8 years ago.
marketVisibility-v3.patch (11.6 KB ) - added by mimo 8 years ago.
marketVisibility-v3.1.patch (12.0 KB ) - added by mimo 8 years ago.
with fixes of elexis comments

Download all attachments as: .zip

Change History (14)

by mimo, 8 years ago

Attachment: marketVisibility.patch added

patch to allow making a trade route with a miraged market

comment:1 by mimo, 8 years ago

Keywords: review patch added
Summary: We should be able to set a trade-route with a miraged market[PATCH] We should be able to set a trade-route with a miraged market

comment:2 by Itms, 8 years ago

Cc: Itms added

by mimo, 8 years ago

Attachment: marketVisibility-v2.patch added

new approach, should be more robust

by mimo, 8 years ago

Attachment: marketVisibility-v2.1.patch added

comment:3 by mimo, 8 years ago

Mirages have no obstructions, so the previous patch may not give the best path when targeting a mirage. So here a is a modified version which recomputes the path as soon as the market becomes visible when approaching to it.

comment:4 by elexis, 8 years ago

I noticed the exact same behavior when telling units to construct a miraged foundation. They will first walk to the center of the foundation, then go back to the edge of the foundation and try to construct it. But since the other units following the first have the same behavior, the units have to wait until all units had reached the middle of the foundation, so there is quite a delay. Notice this happens when issuing a repair command, but not when issuing a build command.

comment:5 by mimo, 8 years ago

r18145 has fixed the obstruction problems of mirages, so the hack in version 2.1 is no more needed and the right patch is marketVisibility-v2.patch

Last edited 8 years ago by mimo (previous) (diff)

comment:6 by mimo, 8 years ago

I've just uploaded v3 which improves the UnitAI behaviour. When a market is destroyed or captured, the trader returns back to the other market if the lost one is visible, otherwise it continues its route up to the point where the market would have been visible and then returns back.

by mimo, 8 years ago

Attachment: marketVisibility-v3.patch added

comment:7 by elexis, 8 years ago

Syntax check only:

  • cmpTrader ? cmpTrader.GetFirstMarket() : undefined -> cmpTrader && cmpTrader.GetFirstMarket()
  • duplicate parenthesis (msg.to == -1)
unneeded parenthesis (!cmpTrader.HasMarket(this.entity) || (!onDestruction && cmpTrader.CanTrade(this.entity))) as && has a higher operator precedence than
(like * and +)

by mimo, 8 years ago

Attachment: marketVisibility-v3.1.patch added

with fixes of elexis comments

comment:8 by mimo, 8 years ago

Owner: set to mimo
Resolution: fixed
Status: newclosed

In 18172:

allow trade with mirage markets, fixes #3894

comment:9 by mimo, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.