Exemplo n.º 1
0
        static void MakeCheckError_Check(List <FELint.ErrorSt> errors, uint support_addr, uint id)
        {
            uint uid = UnitForm.GetUnitIDWhereSupportAddr(support_addr);

            if (uid == U.NOT_FOUND)
            {
                return;
            }
            uid++;

            //実際の値を見る
            uint support_unit_count = 0;
            uint limit = support_addr + SUPPORT_LIMIT;

            for (uint addr = support_addr; addr < limit; addr++)
            {
                uint target_uid = Program.ROM.u8(addr);
                if (target_uid == 0)
                {
                    continue;
                }
                support_unit_count++;

                uint init_value = Program.ROM.u8(addr + SUPPORT_LIMIT);
                uint add_value  = Program.ROM.u8(addr + SUPPORT_LIMIT + SUPPORT_LIMIT);
                MakeCheckError_SelfCheck(errors, support_addr, id, uid, target_uid, init_value, add_value);

                if (target_uid > 0x45)
                {     //敵ユニット支援
                    if (add_value > 0)
                    { //敵ユニット支援に進行度があるのはおかしいよ
                        errors.Add(new FELint.ErrorSt(FELint.Type.SUPPORT_UNIT, support_addr
                                                      , R._("ユニット({0})が、ユニット({1})への支援は、支援相手のユニットがUnitID:0x45を超えているので、敵ユニット同士の支援だと思われますが、「進行度」が({2})に設定されています。\r\n敵ユニットの支援ポイントが増えることはないので、0にするべきです。\r\n(UnitID:0x45を超えるデータに仲間になるユニットを配置してはいけません)"
                                                            , UnitForm.GetUnitNameWithID(uid), UnitForm.GetUnitNameWithID(target_uid), add_value
                                                            )
                                                      , id));
                    }
                }
            }
            //件数の比較
            uint all_count = Program.ROM.u8(support_addr + 0x15);

            if (all_count != support_unit_count)
            {
                errors.Add(new FELint.ErrorSt(FELint.Type.SUPPORT_UNIT, support_addr
                                              , R._("ユニット({0})の支援人数が正しくありません。支援人数が{1}人なのに、実際のデータには、{2}人の支援があります。"
                                                    , UnitForm.GetUnitNameWithID(uid), all_count, support_unit_count
                                                    )
                                              , id));
            }
            if (all_count > SUPPORT_LIMIT)
            {
                errors.Add(new FELint.ErrorSt(FELint.Type.SUPPORT_UNIT, support_addr
                                              , R._("支援で登録できる人数は7人までです。それを上回る({0})人を、データ({1})で、指定しています。"
                                                    , all_count, U.ToHexString(support_addr)
                                                    )
                                              , id));
                return;
            }
        }
Exemplo n.º 2
0
        void AutoCollect()
        {
            if (!AutoCollectCheckbox.Checked)
            {
                return;
            }

            uint support_count = 0;

            if (this.B0.Value != 0)
            {
                support_count++;
            }
            if (this.B1.Value != 0)
            {
                support_count++;
            }
            if (this.B2.Value != 0)
            {
                support_count++;
            }
            if (this.B3.Value != 0)
            {
                support_count++;
            }
            if (this.B4.Value != 0)
            {
                support_count++;
            }
            if (this.B5.Value != 0)
            {
                support_count++;
            }
            if (this.B6.Value != 0)
            {
                support_count++;
            }
            this.B21.Value = support_count;

            uint uid = UnitForm.GetUnitIDWhereSupportAddr(U.toOffset(this.Address.Value));

            if (uid == U.NOT_FOUND)
            {
                return;
            }
            uid++;

            Undo.UndoData undodata = Program.Undo.NewUndoData(this);
            AutoCollectByTargetSupport(uid, (uint)this.B0.Value, (uint)this.B7.Value, (uint)this.B14.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B1.Value, (uint)this.B8.Value, (uint)this.B15.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B2.Value, (uint)this.B9.Value, (uint)this.B16.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B3.Value, (uint)this.B10.Value, (uint)this.B17.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B4.Value, (uint)this.B11.Value, (uint)this.B18.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B5.Value, (uint)this.B12.Value, (uint)this.B19.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B6.Value, (uint)this.B13.Value, (uint)this.B20.Value, undodata);
            Program.Undo.Push(undodata);
        }
Exemplo n.º 3
0
        static InputFormRef Init(Form self)
        {
            return(new InputFormRef(self
                                    , ""
                                    , Program.ROM.RomInfo.support_unit_pointer
                                    , 24
                                    , (int i, uint addr) =>
            {     //とりあえず 00 00 まで読む.
                if (Program.ROM.u16(addr) != 0)
                { //0ではないのでまだデータがある.
                    return true;
                }
                //飛び地になっていることがあるらしい.
                //4ブロックほど検索してみる.
                uint found_addr = addr;
                for (int n = 0; n < 4; n++, found_addr += 24)
                {
                    uint uid = UnitForm.GetUnitIDWhereSupportAddr(found_addr);
                    if (uid != U.NOT_FOUND)
                    {    //発見!
                        return true;
                    }
                }
                //見つからない.
                return false;
            }
                                    , (int i, uint addr) =>
            {
                uint uid = UnitForm.GetUnitIDWhereSupportAddr(addr);
                if (uid == U.NOT_FOUND)
                {
                    return "-EMPTY-";
                }

                return U.ToHexString(uid + 1) +
                " " + UnitForm.GetUnitName(uid + 1);
            }
                                    ));
        }
Exemplo n.º 4
0
        void GotoSupportTalk(NumericUpDown src)
        {
            if (src.Value <= 0)
            {
                return;
            }

            uint addr = InputFormRef.SelectToAddr(AddressList);

            if (U.NOT_FOUND == addr)
            {
                return;
            }
            uint uid = UnitForm.GetUnitIDWhereSupportAddr(addr);

            if (uid == U.NOT_FOUND)
            {
                return;
            }
            uid = uid + 1;  //IDは1から降るので

            if (Program.ROM.RomInfo.version == 8)
            {
                SupportTalkForm f = (SupportTalkForm)InputFormRef.JumpForm <SupportTalkForm>(U.NOT_FOUND);
                f.JumpTo(uid, (uint)src.Value);
            }
            else if (Program.ROM.RomInfo.version == 7)
            {
                SupportTalkFE7Form f = (SupportTalkFE7Form)InputFormRef.JumpForm <SupportTalkFE7Form>(U.NOT_FOUND);
                f.JumpTo(uid, (uint)src.Value);
            }
            else if (Program.ROM.RomInfo.version == 6)
            {
                SupportTalkFE6Form f = (SupportTalkFE6Form)InputFormRef.JumpForm <SupportTalkFE6Form>(U.NOT_FOUND);
                f.JumpTo(uid, (uint)src.Value);
            }
        }