Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trader not buildable after city building trader was taken by opponent #44

Open
mlsad3 opened this issue Jan 2, 2018 · 3 comments
Open
Assignees
Labels

Comments

@mlsad3
Copy link

mlsad3 commented Jan 2, 2018

I have a new civilization with two cities. One of them was building a trader (I'm only allowed 1 trader at this point of the game). An opponent AI captured this city. I noticed that I can no longer build traders, even after recapturing this same city. No production queue in my civilization has any Traders in it. PQ still thinks that I am limited.
I disabled CQUI and Civ IV lets me build my trader as expected. This appears to be a bug only with PQ (via CQUI).
I originally filed this under CQUI Azurency/CQUI_Community-Edition#255

@mlsad3
Copy link
Author

mlsad3 commented Jan 2, 2018

Looks like the same issue would happen if you are training a Spy, just from seeing the same code used with the Spy:

      if(spyCap > numberOfSpies) then
        for _,city in pairs(prodQueue) do
        for _,qi in pairs(city) do
          if(qi.entry.Hash == item.Hash) then
            numberOfSpies = numberOfSpies + 1;
          end
        end
      end

@kblease
Copy link
Owner

kblease commented Jan 2, 2018

Thanks for reporting this. When I have a chance I'll look into it.

@kblease kblease added the bug label Jan 2, 2018
@kblease kblease self-assigned this Jan 2, 2018
@mlsad3
Copy link
Author

mlsad3 commented Jan 2, 2018

I was hoping I could help more...but I'm not too familiar with lua, nor workshop code in general.
I was thinking maybe there needs to be some sort of sanity-check in prodQueue to make sure only data for user-owned-cities is in there, but I think that isn't what you intended (maybe there are other players' data in there as well?). But maybe instead of sanity-cleaning the prodQueue, the spy/trader code would be something like the ugly broken code below:

  if(spyCap > numberOfSpies) then
    for _,city in pairs(prodQueue) do
      local cityId = GetCityIdFromProdQueueKey(city); ?
      if (city:GetOwner() == Game.GetLocalPlayer() then
        for _,qi in pairs(city) do
          if(qi.entry.Hash == item.Hash) then
            numberOfSpies = numberOfSpies + 1;
          end
        end
      end
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants