How to add missing link graphic?

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
I'll be honest: I'm not familiar with how to add graphics to CiV at all. Does anyone with more experience than I know what steps I'd take to add this missing link image for policy trees?

attachment.php


The policy on the right leads to two policies, one on tier 2 and one on tier 3.
 

Attachments

  • Policy Links.JPG
    Policy Links.JPG
    21.9 KB · Views: 174
I've never tried but have a look at the SocialPolicyPopup.lua around line 609. The pipe graphics are determined by the relative locations of prereqs and policies, based on a grid system for each policy branch's panel. In line 609 it steps through all the prereq-policy relationships and compares their grid locations, setting which curved (or straight) end pieces to use for the pipes between them.

The for loop at line 653 seems to add the long straight pipe sections between policies, again based on the grid system. A pipe image is requested from GetPipe() (which automatically links it to the proper policy branch panel), then the position is calculated based on the positions of the policy and prereq, then the appropriate texture is chosen (vTexture or hTexture for a vertical or horizontal pipe). On the vertical only relationships with distance greater than 1 are taken into account, since when we add the two ends of the pipe later they will add up to 1 'Y-unit' in the grid already (since the space between policies vertically is less than on the horizontal).

The next 2 for loops are for the connecting curves at the end of pipes, the first for all curves pointing down and the second for curves pointing up. These loops simply go through the curves we found back in line 609, creating and positioning each one.

If this system isn't working properly I'd guess something isn't right with the policy-prereq relationship between those two, because it looks like it should all be automatic. Also I'd make sure all the policies in that panel have the same PolicyBranchType, otherwise GetPipe() will not link the pipe graphic to the right panel.
 
Thank you for the tips about lines of code, it can take forever to figure out where this stuff is! :lol: I'll look through there and try and get a grasp of what's going on.

I suspected the code's likely error-free, and there doesn't seem to be anything wrong with the xml edits I made (copy-pasted below). Since it doesn't work, my reasoning is it might be an issue where the graphic for this type of pipe simply wasn't designed... there's nowhere else on the policy tree this sort of link is needed (tier 1 connected to both tier 2 and 3). I'm not really sure how to go about adding this graphic, though.

attachment.php


Code:
<Update>
  <Where Type="POLICY_ORGANIZED_RELIGION" />
  <Set GridX="1"/>
</Update>
<Update>
  <Where Type="POLICY_REFORMATION" />
  <Set GridX="1"/>
</Update>
<Update>
  <Where Type="POLICY_THEOCRACY" />
  <Set GridX="3"/>
</Update>
<Update>
  <Where Type="POLICY_FREE_RELIGION" />
  <Set GridX="3"/>
</Update>
  
<Policy_PrereqPolicies>
  <Row>
    <PolicyType>POLICY_THEOCRACY</PolicyType>
    <PrereqPolicy>POLICY_MANDATE_OF_HEAVEN</PrereqPolicy>
  </Row>
</Policy_PrereqPolicies>
 

Attachments

  • Policy Links 2.JPG
    Policy Links 2.JPG
    33.9 KB · Views: 102
I don't think you'll need to add a new graphic, all the horizontal pipes are the same graphic just positioned differently. It's strange that it's adding the first bend but not the rest of the pipe...

I would try throwing a few print statements into the SocialPolicyPopup.lua to find the problem. One inside the if block at line 693, like:
Code:
if (policy.PolicyBranchType == "POLICY_BRANCH_PIETY") then
    (print the x and y offset values as well as any other info you can think of like prereq.Type)
since that's the block that should add the missing horizontal pipe. Sometimes that's about all you can do, add some print statements and hope you see some clues :sad:
 
Back
Top Bottom