Beispiel #1
0
        public bool AddStationed(ITroopStub stub)
        {
            if (BaseStation == null)
            {
                throw new Exception("Cannot station in this troop manager");
            }

            int nextId = IdGen.GetNext();

            if (nextId == -1)
            {
                return(false);
            }

            var stationTroopId = (ushort)nextId;

            stub.BeginUpdate();
            stub.StationTroopId = stationTroopId;
            stub.State          = TroopState.Stationed;
            stub.Station        = BaseStation;
            stub.EndUpdate();

            RegisterStub(stationTroopId, stub);
            return(true);
        }
Beispiel #2
0
        public void DbLoaderAddStation(ITroopStub stub)
        {
            if (BaseStation == null)
            {
                throw new Exception("Cannot station in this troop manager");
            }

            int nextId = IdGen.GetNext();

            if (nextId == -1)
            {
                return;
            }

            var stationTroopId = (ushort)nextId;

            stub.StationTroopId = stationTroopId;
            stub.Station        = BaseStation;

            RegisterStub(stationTroopId, stub);
        }