City Planning Mode

Discussion in 'Civ5 - Mod Components' started by PawelS, Apr 2, 2016.

  1. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland


    A simple UI modification that should be useful in planning where to found cities.

    Download and instructions here.

    Any feedback is appreciated.
     

    Attached Files:

    • cpm.jpg
      cpm.jpg
      File size:
      119.2 KB
      Views:
      1,639
  2. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland
    Updated version uploaded - now it's compatible with Enhanced User Interface.
     
  3. ldvhl

    ldvhl ніщо

    Joined:
    May 15, 2013
    Messages:
    2,182
    Do you have any screenshots? I'm curious how it looks.
     
  4. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland
    Screenshot added :)
     
  5. ifLaMaster

    ifLaMaster Chieftain

    Joined:
    Jan 21, 2015
    Messages:
    24
    Great idea. But have one question. Can you change draw distance from 3 to 5? Or, maybe you can tell what to change in the code.
     
  6. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,581
    Location:
    Near Portsmouth, UK
    At the top of CityPlanningMode.lua, change
    iRadius = GameDefines.CITY_PLOTS_RADIUS
    to
    iRadius = 5
     
  7. ifLaMaster

    ifLaMaster Chieftain

    Joined:
    Jan 21, 2015
    Messages:
    24
    Thanks. Work, but crash after activation. 4 have the same result. Maybe, will stay with old good "city limits" for now, wait for update, and pray.
    Ps. Whoward69, your mods just awesome. :D
    Pps. 34(43/62)civ.dll component has a bug with world congress, who prevent to click on the "next" button, when player must open congress window.
    Ppps. Sorry for my precious english skill. :D
     
  8. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland
    I changed the radius to 5 and it works properly for me. So I need you to answer some questions:

    1. When exactly does the crash happen? When you press X?
    2. Do you use any mods? (or EUI)
    3. Are you sure that it doesn't crash when the radius is 3 and all the other circumstances are the same?
    4. Are you sure you made the change to the Lua file exactly as whoward69 described, and didn't change anything else?
     
  9. ifLaMaster

    ifLaMaster Chieftain

    Joined:
    Jan 21, 2015
    Messages:
    24
    I deleted cache and its working for now. Don't know why its works, because i do this a few hours ago, before installing all mods(including this one). Sorry.

    It's funny, but city limits make those problem.
     
  10. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland
    Yeah, I forgot to suggest clearing the cache :) I'm glad you sorted it out.
     
  11. Chinese American

    Chinese American Hamtastic Knight

    Joined:
    Aug 23, 2001
    Messages:
    432
    Location:
    Chinatown, USA
    can you attach screenshot to this topic or original post?
     
  12. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland
    Why do you need the screenshot attached? There is a link to it in the original post, and it's attached to the download.
     
  13. Chinese American

    Chinese American Hamtastic Knight

    Joined:
    Aug 23, 2001
    Messages:
    432
    Location:
    Chinatown, USA
    it's just good advertising. it's a visual mod and i need to visually inspect its usefulness at a glance.
     
  14. Grayson Carlyle

    Grayson Carlyle Chieftain

    Joined:
    Mar 26, 2015
    Messages:
    27
    This instantly crashes when you press 'x' with Super Power mod without any modifications to it. Super Power uses a city radius of 5, which should be what GameDefines.CITY_PLOTS_RADIUS is. Should I try manually setting it to 5?
     
  15. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,581
    Location:
    Near Portsmouth, UK
    See posts #7 to #9 first
     
  16. Grayson Carlyle

    Grayson Carlyle Chieftain

    Joined:
    Mar 26, 2015
    Messages:
    27
    After clearing the cache, it briefly showed the highlights, then crashed, instead of crashing when pressing 'x'.

    However, it was very late game on a huge map, and I think it crashed from the VRAM problems Civ5 has in those scenarios.

    And indeed, after starting a new game, it works perfectly fine.

    Thanks.
     
  17. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland
    @Grayson Carlyle: If the crashes are indeed connected to the VRAM usage, then I can do nothing about it. Also, I tried to use borders instead of filled hexes (which would possibly take less VRAM), but it doesn't work properly on non-wrapped maps where there are cities both on the west and east side of the map. It looks like a bug in the game's graphics engine. So I use borders only for highlighting the single city under cursor, which doesn't cause such problems.

    @Chinese American: The image was too large IMO to put it directly in the main post, so I decided to put a resized version there instead.
     
  18. biship

    biship Warlord

    Joined:
    Dec 7, 2003
    Messages:
    187
    Great mod! I'd love this to only show the areas around cities not hidden under the fog of war. Currently you can use it to see the areas of not yet discovered cities, which is kinda cheating.
     
  19. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,581
    Location:
    Near Portsmouth, UK
    As a quick fix, in CityPlanningMode.lua change
    Code:
    	-- show limits of all cities
    	for pCity in pPlayer:Cities () do
    		if pSelectedCity and pCity == pSelectedCity then
    			ShowCityLimit (pCity:GetX (), pCity:GetY (), sStyle.."_B")
    		else
    			ShowCityLimit (pCity:GetX (), pCity:GetY (), sStyle)
    		end
    	end
    
    to
    Code:
    	-- show limits of all cities
    [B][COLOR="SeaGreen"]	local iActiveTeam = Game.GetActiveTeam()[/COLOR][/B]
    	for pCity in pPlayer:Cities () do
    [B][COLOR="seagreen"]		if (pCity:Plot():IsRevealed(iActiveTeam)) then[/COLOR][/B]
    			if pSelectedCity and pCity == pSelectedCity then
    				ShowCityLimit (pCity:GetX (), pCity:GetY (), sStyle.."_B")
    			else
    				ShowCityLimit (pCity:GetX (), pCity:GetY (), sStyle)
    			end
    [B][COLOR="seagreen"]		end[/COLOR][/B]
    	end
    
    Spoiler :
    Yes I know that iActiveTeam can be set higher up, but then I'd have to show more code!
     
  20. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland
    Thanks :) I'm not sure if I want to change this in the "official" version though, as the "sensing undiscovered cities" thing is already present in the game - it happens that you can't build a city with a settler due to a city that lies in undiscovered territory. But I agree that it's cheating, as it allows you to locate these cities without sending a settler there (the display of potential city limits under cursor is another way to "cheat", as it won't appear on spots where a city can't be built; in mods where the minimum distance between cities is higher than normal it's a more significant effect). But it's a kind of cheat that I like, and I don't think it breaks the game or anything, so I think I'll keep it as it is :) Those who don't like this kind of cheating can of course make the change described in whoward's post. Other modifications are possible too, for example you can change the colors - they are in highlights.xml, under "CPM styles".
     

Share This Page