Exemplo n.º 1
0
        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;*/
        }
Exemplo n.º 2
0
        public void setFirstAndOnly(Stat.Construction c)
        {
            list[0] = c;

            for (int i = 1; i < list.Length; i++)
            {
                list[i] = null;
            }
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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));
            }
        }
Exemplo n.º 7
0
 public void buildWonder(Stat.Construction w)
 {
     wondersBuilt[w.type] = true;
 }
Exemplo n.º 8
0
        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);
        }