From: Ulrich K. <ku...@un...> - 2000-10-02 21:21:23
|
yOn Mon, 2 Oct 2000, Michael Grundel wrote: > > A few littleties: > > For memory's sake and as it is my job :-) I recommend the following patch > > for DataTypeInfoForOneTurn.java: > > > > 27,28c27,28 > > < data = new int[FreecivConstants.MAX_NUM_PLAYERS]; > > < defined = new boolean[FreecivConstants.MAX_NUM_PLAYERS]; > > --- > > > data = new int[4]; > > > defined = new boolean[4]; > > 44a45 > > > if (player >= data.length) grow(Math.max(data.length*2, player)); > ^^^ ^^^^^^^^^^^^^ > We should be careful not to make it larger than FreecivConstants.MAX_NUM_PLAYERS > by doubling. > Could this happen or did I miss something? Since MAX_NUM_PLAYERS is 32 this can not happen: 4 -> 8 -> 16 -> 32 So the highest player number will be 31 and that fits in an array with 32 places. Ulrich |