I have now officially started the code rewrite. In case you need context for this, it's best if you just review the plans for 1.17 thread. This basically covers all but the first point. I have branched off develop into the "rewrite" branch. It's not published yet and it makes little sense trying it out, because it will be either broken or largely indistinguishable in features from develop.
I won't give frequent updates here probably, because everything is very code focused and not that interesting to most people. As some small context for what I've started on first for those who have worked with the code before, here is what I've started with:
Handling lists of plots is one of the most common operations that a lot of functionalities require. Previously, this usually worked using pairs of tuples tTL and tBR and then using utils.getPlotList(). There are many more specialised functions for more specific use cases. Now you can do:
Also the plot list returned is a thin wrapper around the actual list, that is a bit easier to use:
I won't give frequent updates here probably, because everything is very code focused and not that interesting to most people. As some small context for what I've started on first for those who have worked with the code before, here is what I've started with:
Handling lists of plots is one of the most common operations that a lot of functionalities require. Previously, this usually worked using pairs of tuples tTL and tBR and then using utils.getPlotList(). There are many more specialised functions for more specific use cases. Now you can do:
Code:
# get rectangle between (0,0) and (2,2)
print plots.start(0, 0).end(2, 2)
> [(0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,1), (2,2)]
# position of rectangle corners does not matter anymore
print plots.start(2, 2).end(0, 0)
> [(0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,1), (2,2)]
# get all plots on the map
plots.all()
# get plots in a region
plots.region(rMesopotamia)
plots.regions(rMesopotamia, rEgypt)
Also the plot list returned is a thin wrapper around the actual list, that is a bit easier to use:
Code:
# can check if plot, city or unit is in area
plot = gc.getMap().plot(1, 1)
city = plot.getPlotCity()
unit = gc.getPlayer(0).makeUnit(iSettler, 1, 1)
plots = plots.start(0, 0).end(2, 2)
print (1, 1) in plots
> True
print plot in plots
> True
print city in plots
> True
print unit in plots
> True
# iterating over the plot list returns plot objects immediately
for plot in plots: print plot.getX() + plot.getY()
> 0
> 1
> 2
> 1
> 2
> 3
> 2
> 3
> 4