DLL - Various Mod Components

Informational (and needs work) - if the second unit in the city leaves, because its the one moving it loses the icon, but the garrisoned unit (as its not moved) incorrectly keeps it.

It would be quite simple to make it functional - like the aircraft select menu.

I've moved the unit limit onto the plot. The current code says "if I'm a city, use CITY_UNIT_LIMIT, otherwise use PLOT_UNIT_LIMIT" but a scenario modder could extend it, for example, to have a different limit in forts/citadels, or even for flat plains/grassland to support more units than hills/forests/tundra
 
is there any chance of creating a link to eras?

i tried adding to CustomModDbUpdates.sql to read
Code:
ALTER TABLE Eras
  ADD CityWorkingChange INTEGER DEFAULT 0;
but i guess it's buried in the .dll

That will alter the DB, but without anything in the DLL it will do nothing.

Eras tend not to have features like that, so rather than "going against the established patterns", I'll expose the variables that extend the city range to Lua, then with the Era event, you'll be able to achieve what you want.
 
The city stacking is potentially very useful to me. But I'd like to apply it to a specific unit type (in my mod's case, GPs) and not to military. Is that possible?

What I'd find really useful would be more general control of these kind of movement/stacking limits by unit type. Something like xml tags in the Units table:
  • STACK_WITH_UNITCLASS
  • STACK_WITH_COMBATCLASS
  • UNLIMITED_STACK_WITH_SAME_SPECIAL_TYPE (I'm thinking GPs here but modder could define new special types)
  • UNLIMITED_STACK_WITH_SAME_LAYER (I'm using "layer" because I can't think of the right word; what I mean is Civilians vs Land Military vs Sea Military; Air already has this)
  • UNLIMITED_STACK_IN_CITIES
  • CAN_COEXIST_WITH_FOREIGN_UNITS
  • CAN_ENTER_FOREIGN_CITIES
With that, a modder could do a variety of things:
  • Get rid of 1upt for civilians since it has no positive gameplay value whatsoever (unless you view congestion or AI blocking as positive gameplay values).
  • Eliminate the stupid off-roading my workers have to do to get around any foreign unit (civ or mil) that I've allowed in my territory
  • Have civilians or other units do stuff in foreign cities (like religions conversions, trade missions or other new actions) rather than next to city.
  • Interesting and varied military stacking options (doesn't interest me, but others might want it)
 
The city stacking is potentially very useful to me. But I'd like to apply it to a specific unit type (in my mod's case, GPs) and not to military. Is that possible?

What I'd find really useful would be more general control of these kind of movement/stacking limits by unit type.

All things are possibly, but the reality is that such fine grained control would have to be as a C++ mod to the DLL. Depending on the number of units on the map (player, ai and minors) and depending on the map size, the stacking check function can be called hundreds possibly even thousands of times a turn (with a turn being player 0 thru player 63), so while writing such a generic XML driven method would be possibly, it would almost certainly grind the game to death by the mid game.
 
I was assuming it would be a DLL modification deep in the unit movement code, with these unit properties (defined in xml) cached into the unit object itself. Or in any case C++ methods that reference cached data rather than the DB table.

But is your point that it would be hard to do this in a generic way (with properties defined in xml) rather than hard-coding in C++ exactly what I need for my mod?
 
But is your point that it would be hard to do this in a generic way (with properties defined in xml) rather than hard-coding in C++ exactly what I need for my mod?

What I was trying to get across was trying to do this in a generic way from a series of XML entries (even with caching into unit/plot objects) would require so much conditional overhead ("do I have this property set, if so then I need to consider these additional restrictions") that it would probably kill the path-finding code by mid-game.

Whereas writing a direct replacement for the plot stacking method in C++ for a very specific set of conditions for a scenario / total conversion mod would be much more efficient and hence practical.

The two methods that control stacking limits are
CvPlot::getNumFriendlyUnitsOfType(CvUnit*) and CvPlot::getUnitLimit() (in my DLL, or just CvGame::getPLOT_UNIT_LIMIT() in the standard DLL)
Adding scenario specific changes to these wouldn't require a lot of C++ knowledge.
 
I've moved the unit limit onto the plot. The current code says "if I'm a city, use CITY_UNIT_LIMIT, otherwise use PLOT_UNIT_LIMIT" but a scenario modder could extend it, for example, to have a different limit in forts/citadels, or even for flat plains/grassland to support more units than hills/forests/tundra
Hey, this sounds cool, can you put limits that depend on the unit class - so for instance, one limit for melee unit, another for ranged units? Or unit types? (Thinking still of my wish to limit number of Aircrafts in city to a capped value, here seems like an opening to have a handle to control this.)
 
Hey, this sounds cool, can you put limits that depend on the unit class - so for instance, one limit for melee unit, another for ranged units? Or unit types? (Thinking still of my wish to limit number of Aircrafts in city to a capped value, here seems like an opening to have a handle to control this.)

See post #267 as to the issues with trying to place loads of limits in XML on stacking. And anyway, you can already limit the number of aircraft in cities with the rebase events I added some versions back
 
If that's all there is in database.log, it looks like you've not clicked Next from the Mods Browser screen, as your log file should look similar to the one below just before you click the "Start Game" button - note the duplicate block of warnings about the SPECIAL layout handler, and the multiple pairs of lines at the end

Spoiler :
Code:
[13290.208] constraint failed
[13290.208] While executing - 'INSERT INTO ArtDefine_StrategicView(StrategicViewType, TileType, Asset) VALUES(?,?,?)'
[13299.927] no such table: ContentPackage.LocalizedText
[13303.047] Validating Foreign Key Constraints...
[13303.063] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[13303.063] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[13303.063] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[13304.233] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_HITTITE_WARCHARIOT" does not exist in Units
[13304.233] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SUMERIAN_PHALANX" does not exist in Units
[13304.233] Failed Validation.
[13307.805] 
-- SQLite Memory Statistics --
Memory Usage:
		[Cur]		[Max]
Malloc:		366960		33255968
PageCache:	4389		4982
LookAside:	0		0
Scratch:	0		1

Static Buffer Overflows:
		[TooLarge]	[NoSpace]
PageCache:	0		29696000
Scratch:	0		0

Largest Allocations:
Malloc:		131072
PageCache:	1160
Scratch:	6640

Prepared Statements:
Current:		6
------------------------------
[13364.246] no such table: ContentPackage.LocalizedText
[13371.032] no such table: ContentPackage.LocalizedText
[13387.256] Validating Foreign Key Constraints...
[13387.272] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[13387.272] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[13387.272] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[13388.489] Failed Validation.
[13388.988] 
-- SQLite Memory Statistics --
Memory Usage:
		[Cur]		[Max]
Malloc:		384600		33255968
PageCache:	4968		4982
LookAside:	0		0
Scratch:	0		1

Static Buffer Overflows:
		[TooLarge]	[NoSpace]
PageCache:	0		29696000
Scratch:	0		0

Largest Allocations:
Malloc:		131072
PageCache:	1160
Scratch:	6640

Prepared Statements:
Current:		8
------------------------------
[13389.019] constraint failed
[13389.019] While executing - 'INSERT INTO Defines(Name, Value) VALUES(?, ?)'
[13389.019] constraint failed
[13389.019] While executing - 'INSERT INTO Defines(Name, Value) VALUES(?, ?)'
[13389.019] constraint failed
[13389.019] While executing - 'INSERT INTO Defines(Name, Value) VALUES(?, ?)'

Edit: Also, what's in your CustomMods.log file?

You can zip and attach the logs to your posts here rather than using the MediaFire spam/spyware site
 
That's odd because I'm definitely starting the game via the mods browser:
Spoiler :
1024x575.resizedimage

I'm assuming CustomMods.log is in the same directory as database.log? If so CustomMods.log is not there. :/ Only files available are: App.log, Database.log, Localization.log, Lua.log, net_mesage_debug.log, stopwatch.log, system_init.log, xml.log, xml-perf.log.
 
That image proves nothing, it all depends if you clicked "Single Player" or "Back" next. If you have no CustomMods.log, you are either not loading the mod/dll or the game is crashing BEFORE you get to the Setup Screen (where the "Start Game" button is)
 
IMPORTANT: PATCH 1.0.3.18

The patch yesterday changed a number of methods within the core DLL.

Until Firaxis release the source code for the patch, this mod and all dependant mods are broken beyond repair

Even when they have released the source it is likely to take days, if not weeks, of free time (I have a full time job) to work out what has altered and what I need to do to get this working again. (If they've changed the path-finding code ... :( )
 
How to avoid this patch auto-update? (I have legit Civ5 with steam client installed.)
 
Back
Top Bottom