Changeset 153 for trunk


Ignore:
Timestamp:
Nov 15, 2017, 10:20:16 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: Show other players cells with normal power and cells of current player with power lowered by unit moves.
  • Modified: Translate also exception messages.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Languages/xtactics.cs.po

    r151 r153  
    652652msgstr "Člověk"
    653653
     654#: ugame.sattackerpowerpositive
     655msgctxt "ugame.sattackerpowerpositive"
     656msgid "Attacker power have to be higher then 0."
     657msgstr "Síla útočníka musí být větší než 0."
     658
     659#: ugame.scellremoveneighborerror
     660msgid "Can't remove cell from neighbour cell"
     661msgstr "Nelze odstranit buňku ze sousední buňky"
     662
    654663#: ugame.scomputer
    655664msgctxt "ugame.scomputer"
     
    657666msgstr "Počítač"
    658667
     668#: ugame.sdefenderpowerpositive
     669msgid "Defender power have to be higher then or equal to 0."
     670msgstr "Síla obránce musí být vyšší než nebo rovna nule."
     671
    659672#: ugame.shuman
    660673msgctxt "ugame.shuman"
     
    666679msgstr "Potřebujete alespoň dva hráče"
    667680
     681#: ugame.snegativecellpowernotallowed
     682msgid "Not allowed to substract power under zero to negative value"
     683msgstr "Není povoleno odečíst sílu pod nulu do záporné hodnoty"
     684
    668685#: ugame.snewgamefile
    669686msgid "New game.xtg"
     
    679696msgstr "Neukončená bitva"
    680697
     698#: ugame.sunitpowermismatch
     699msgid "Unit move power mismatch. Cell power is %d but %d moved away."
     700msgstr "Chyba síly přesunu jednotek. Síla buňky je %d, ale %d přesunuto pryč."
     701
    681702#: ugame.swrongfileformat
    682703msgid "Wrong file format"
  • trunk/Languages/xtactics.po

    r151 r153  
    631631msgstr ""
    632632
     633#: ugame.sattackerpowerpositive
     634msgctxt "ugame.sattackerpowerpositive"
     635msgid "Attacker power have to be higher then 0."
     636msgstr ""
     637
     638#: ugame.scellremoveneighborerror
     639msgid "Can't remove cell from neighbour cell"
     640msgstr ""
     641
    633642#: ugame.scomputer
    634643msgctxt "ugame.scomputer"
     
    636645msgstr ""
    637646
     647#: ugame.sdefenderpowerpositive
     648msgid "Defender power have to be higher then or equal to 0."
     649msgstr ""
     650
    638651#: ugame.shuman
    639652msgctxt "ugame.shuman"
     
    645658msgstr ""
    646659
     660#: ugame.snegativecellpowernotallowed
     661msgid "Not allowed to substract power under zero to negative value"
     662msgstr ""
     663
    647664#: ugame.snewgamefile
    648665msgid "New game.xtg"
     
    658675msgstr ""
    659676
     677#: ugame.sunitpowermismatch
     678msgid "Unit move power mismatch. Cell power is %d but %d moved away."
     679msgstr ""
     680
    660681#: ugame.swrongfileformat
    661682msgid "Wrong file format"
  • trunk/UGame.pas

    r152 r153  
    6161    Weight: Integer; // Temporary value
    6262    Links: TCellLinks;
     63    procedure Check;
    6364    function NeighboringToVoid: Boolean;
    6465    procedure AreaExtend;
     
    514515  SNewGameFile = 'New game.xtg';
    515516  SZeroZoomNotAlowed = 'Zero zoom not allowed';
     517  SCellRemoveNeighborError = 'Can''t remove cell from neighbour cell';
     518  SNegativeCellPowerNotAllowed = 'Not allowed to substract power under zero to negative value';
     519  SAttackerPowerPositive = 'Attacker power have to be higher then 0.';
     520  SDefenderPowerPositive = 'Defender power have to be higher then or equal to 0.';
     521  SUnitPowerMismatch = 'Unit move power mismatch. Cell power is %d but %d moved away.';
    516522
    517523procedure InitStrings;
     
    726732  for I := 0 to Cells.Count - 1 do begin
    727733    if TCell(Cells[I]).Neighbors.Remove(TCell(Cells[1 - I])) = -1 then
    728       raise Exception.Create('Can''t remove cell from neighbour cell');
     734      raise Exception.Create(SCellRemoveNeighborError);
    729735    if TCell(Cells[I]).Links.Remove(Self) = -1 then
    730       raise Exception.Create('Can''t remove cell from neighbour cell');
     736      raise Exception.Create(SCellRemoveNeighborError);
    731737  end;
    732738  FreeAndNil(Cells);
     
    978984      Cell := TPlayerCell(Cells[C]);
    979985      if (Cell.MapCell.Terrain <> ttVoid) and Cell.MapCell.IsVisible(View) then begin
    980         CellText := IntToStr(Cell.MapCell.GetAvialPower);
     986        if Cell.MapCell.Player = Player then
     987          CellText := IntToStr(Cell.MapCell.GetAvialPower)
     988          else CellText := IntToStr(Cell.MapCell.Power);
    981989        if Assigned(SelectedCell) and (SelectedCell = Cell.MapCell) then
    982990            Brush.Color := clGreen
     
    17501758  if FPower = AValue then Exit;
    17511759  if AValue < 0 then
    1752     raise Exception.Create('Not allowed to substract power under zero do negative value');
     1760    raise Exception.Create(SNegativeCellPowerNotAllowed);
    17531761  FPower := AValue;
     1762end;
     1763
     1764procedure TCell.Check;
     1765var
     1766  AvailPower: Integer;
     1767begin
     1768  AvailPower := GetAvialPower;
     1769  if AvailPower < 0 then
     1770    raise Exception.Create(Format(SUnitPowerMismatch, [Power, -(AvailPower - Power)]));
    17541771end;
    17551772
     
    18971914  for UnitMove in MovesFrom do
    18981915    Result := Result - UnitMove.CountOnce;
    1899   if Result < 0 then raise Exception.Create('Unit move power mismatch. Cell power is ' +
    1900     IntToStr(Power) + ' but ' + IntToStr(- (Result - Power)) + ' moved away.');
    19011916end;
    19021917
     
    19431958  for I := Neighbors.Count - 1 downto 0 do
    19441959    if TCell(Neighbors[I]).Neighbors.Remove(Self) = -1 then
    1945       raise Exception.Create('Can''t remove cell from neighbour cell');
     1960      raise Exception.Create(SCellRemoveNeighborError);
    19461961  FreeAndNil(Neighbors);
    19471962  inherited Destroy;
     
    25222537  DefendRolls := TFPGList<Integer>.Create;
    25232538  if AttackPower < 1 then
    2524     raise Exception.Create('Attacker power have to be higher then 0.');
     2539    raise Exception.Create(SAttackerPowerPositive);
    25252540  if DefendPower < 0 then
    2526     raise Exception.Create('Defender power have to be higher then or equal to 0.');
     2541    raise Exception.Create(SDefenderPowerPositive);
    25272542  while (AttackPower > 0) and (DefendPower > 0) do begin
    25282543    // Risk game rules:
     
    26542669    end;
    26552670  end;
     2671
    26562672  // Remove empty moves
    26572673  for I := Moves.Count - 1 downto 0 do
     
    27342750      end;
    27352751    end;
     2752    CellFrom.Check;
    27362753    if Assigned(Game.FOnMoveUpdated) then Game.FOnMoveUpdated(Result);
    27372754  end;
Note: See TracChangeset for help on using the changeset viewer.