Xaroth Brook

You are very much correct

You are very much correct

well, if you check for rank 1, you do the same check as the max-city check did, as every town will be either rank 1 or higher...

well, if you check for rank 1, you do the same check as the max-city check did, as every town will be either rank 1 or higher...

Actually, my statement about your version is flawed, i should stop typing when I just wake up... Take this case: planet x has a cap of 50/50/30/20/20 if there are 20 towns at rank 5, none are abl...

Actually, my statement about your version is flawed, i should stop typing when I just wake up...

Take this case:

planet x has a cap of 50/50/30/20/20
if there are 20 towns at rank 5, none are able to progres from 3 to 4, in your test, this fails, as there are 0 rank 4 towns, and that code would allow progression.
If there are 20 towns at rank 5 still, and 10 at rank 3, none should be allowed to upgrade from 2 to 3, again, your code would not catch this.

I hope this clears it up even more.

I think you missed out my reasoning, as per the scrapbook: --start quote-- The number of player cities that can be placed is capped. The 3 main worlds of Corellia, Naboo, and Tatooine are able to ...

I think you missed out my reasoning, as per the scrapbook:

--start quote--
The number of player cities that can be placed is capped. The 3 main worlds of Corellia, Naboo, and Tatooine are able to hold 20 and the moons and adventure worlds of Talus, Rori, Dantooine, and Lok can hold up to 50 cities. It is important to note that there is also a cap on the number of cities that can achieve a certain rank. While the core worlds of Corellia, Naboo, and Tatooine can have a total of 20 cities, only 15 can be rank 3 or above and only 10 can be rank 4 or above. The moons/adventure planets of Talus, Rori, Dantooine, and Lok can have 30 cities above rank 3 and 20 above rank 4
--end quote--

it clearly states, only 15 can be rank 3 or above, and only 10 can be rank 4 or above.
Your test only tests at the current rank, which is flawed, as when there are 10 rank 4(or 5) cities, none are allowed to progress from rank 3 to 4, while a rank 4 is able to progress to 5

With your method we would be able to have a total of 100+ cities on a planet, as 1) there is no limit being calculated, and 2) you could have 10 rank 4 cities AND 10 rank 5 cities.

Sources:
http://www.swgemu.com/archive/scrapbookv51/data/20070127193144/index.html
http://www.swgemu.com/archive/scrapbookv51/data/20070127193158/index.html
http://swg.wikia.com/wiki/Player_city#Player_city_rank

Right, re-did this with the information I could grab from the scrapbook due to not being able to upload files, the patch, pasted last As per the scrapbook: The number of player cities that can b...

Right, re-did this with the information I could grab from the scrapbook

due to not being able to upload files, the patch, pasted last

As per the scrapbook:

The number of player cities that can be placed is capped. The 3 main worlds of Corellia, Naboo, and Tatooine are able to hold 20 and the moons and adventure worlds of Talus, Rori, Dantooine, and Lok can hold up to 50 cities. It is important to note that there is also a cap on the number of cities that can achieve a certain rank. While the core worlds of Corellia, Naboo, and Tatooine can have a total of 20 cities, only 15 can be rank 3 or above and only 10 can be rank 4 or above. The moons/adventure planets of Talus, Rori, Dantooine, and Lok can have 30 cities above rank 3 and 20 above rank 4.

To accomplish this:

  • Scrap the check for max cities, at all point we're checking for the rank at hand, which is equal or lower than the planet limit anyhow.
  • Check for cities of equal or greater rank than being checked, as per the scrapbook.
  • Double-check at the end.




The patch: (note, NEEDS TESTING, I don't have a full dev env running atm, so cannot do full testing.......)
Downloadable: http://rawr.xaroth.nl/xar/CityManagerImplementation.cpp.patch


Index: MMOCoreORB/src/server/zone/managers/city/CityManagerImplementation.cpp
===================================================================
— MMOCoreORB/src/server/zone/managers/city/CityManagerImplementation.cpp (revision 5901)
+++ MMOCoreORB/src/server/zone/managers/city/CityManagerImplementation.cpp (working copy)
@@ -186,9 +186,9 @@

bool CityManagerImplementation::isCityRankCapped(const String& planetName, byte rank) {
Vector<byte>* citiesAllowed = &citiesAllowedPerRank.get(planetName);


Locker _lock(_this.get());

@@ 200,12 +200,14 @@
if (cityZone == NULL || cityZone
>getZoneName() != planetName)
continue;

  • if (++totalCities > maxCities || totalCities > maxAtRank) {
  • return true;
    + if (city->getCityRank() >= rank)
    Unknown macro: {+ if (++totalAtRank >= maxAtRank)
    Unknown macro: { + return true; + }
    }

    }
    -

  • return false;
    +
    + return (totalAtRank >= maxAtRank);
    }


bool CityManagerImplementation::validateCityInRange(CreatureObject* creature, Zone* zone, float x, float y) {

  • More
  • SWGEMU-390
  • submitted for moderator approval