public Construction() { list = new Stat.Construction[10]; // new xycv_ppc.structures.constructionList[ 10 ]; /* for ( int i = 0; i < list.Length; i ++ ) * list[ i ].ind = -1;*/ }
public void setFirstAndOnly(Stat.Construction c) { list[0] = c; for (int i = 1; i < list.Length; i++) { list[i] = null; } }
public void exchange(int pos0, int pos1) { // structures.constructionList[] buffer = list; // list[ pos0 ] = buffer[ pos1 ]; // list[ pos1 ] = buffer[ pos0 ]; Stat.Construction old0 = list[pos0], old1 = list[pos1]; list[pos0] = old1; list[pos1] = old0; }
public bool addAtEnd(Stat.Construction construction) //byte Type, int Ind ) { for (int i = 0; i < list.Length; i++) { if (list[i] == null) { list[i] = construction; /* list[ i ].type = Type; * list[ i ].ind = Ind;*/ return(true); } } return(false); }
public static int turnsLeftToBuild(byte owner, int city, Stat.Construction c) //byte type, int ind ) { getPFT getPFT1 = new getPFT(); int turnsLeft; if (c is Stat.Wealth) { turnsLeft = -1; } else { turnsLeft = (c.cost - Form1.game.playerList[owner].cityList[city].construction.points) / Form1.game.playerList[owner].cityList[city].production + 1; } return(turnsLeft); }
public static string turnsLeftToBuildS(byte owner, int city, Stat.Construction c) //byte type, int ind ) { int tl = turnsLeftToBuild(owner, city, c); //type, ind ); if (tl == -1) { return(""); } else if (tl < 2) { return(String.Format(language.getAString(language.order.turnLeft), tl)); } else { return(String.Format(language.getAString(language.order.turnsLeft), tl)); } }
public void buildWonder(Stat.Construction w) { wondersBuilt[w.type] = true; }
public static int turnsLeftToBuild(byte owner, int city, Construction construction, Stat.Construction c) //byte type, int ind ) { getPFT getPFT1 = new getPFT(); int costLeft; int cp = construction.points; for (int i = 0; i < construction.list.Length && construction.list[i] != null && cp > 0; i++) { // if ( construction.list[ i ].type == (byte)enums.cityBuildType.unit ) cp -= construction.list[i].cost; } /* else if ( construction.list[ i ].type == (byte)enums.cityBuildType.building ) // buildings * cp -= construction.list[ i ].cost;*/ if (c is Stat.Wealth) { costLeft = -1; } else { costLeft = c.cost; } /* if ( type == (byte)enums.cityBuildType.unit ) * costLeft = Statistics.units[ ind ].cost; * else if ( type == (byte)enums.cityBuildType.building ) // buildings * costLeft = Statistics.buildings[ ind ].cost; * else * costLeft = -1; */ if (cp > 0) { costLeft -= cp; } int turnsLeft = costLeft / Form1.game.playerList[owner].cityList[city].production + 1; if (turnsLeft < 1) { turnsLeft = 1; } return(turnsLeft); }