Ignore:
Timestamp:
Mar 9, 2021, 9:19:49 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Synced code with current trunk version.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/CityScreen.pas

    r246 r303  
    216216  Template := TDpiBitmap.Create;
    217217  Template.PixelFormat := pf24bit;
    218   LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'City.png', gfNoGamma);
     218  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'City.png',
     219    [gfNoGamma]);
    219220  CityMapTemplate := TDpiBitmap.Create;
    220221  CityMapTemplate.PixelFormat := pf24bit;
    221   LoadGraphicFile(CityMapTemplate, GetGraphicsDir + DirectorySeparator + 'BigCityMap.png', gfNoGamma);
     222  LoadGraphicFile(CityMapTemplate, GetGraphicsDir + DirectorySeparator + 'BigCityMap.png',
     223    [gfNoGamma]);
    222224  SmallCityMapTemplate := TDpiBitmap.Create;
    223225  SmallCityMapTemplate.PixelFormat := pf24bit;
    224226  LoadGraphicFile(SmallCityMapTemplate, GetGraphicsDir + DirectorySeparator + 'SmallCityMap.png',
    225     gfNoGamma);
     227    [gfNoGamma]);
    226228  SmallCityMap := TDpiBitmap.Create;
    227229  SmallCityMap.PixelFormat := pf24bit;
     
    13971399
    13981400procedure TCityDlg.ChooseProject;
    1399 const
    1400   ptSelect = 0;
    1401   ptTrGoods = 1;
    1402   ptUn = 2;
    1403   ptCaravan = 3;
    1404   ptImp = 4;
    1405   ptWonder = 6;
    1406   ptShip = 7;
    1407   ptInvalid = 8;
    1408 
    1409   function ProjectType(Project: integer): integer;
     1401type
     1402  TProjectType = (
     1403    ptSelect = 0,
     1404    ptTrGoods = 1,
     1405    ptUn = 2,
     1406    ptCaravan = 3,
     1407    ptImp = 4,
     1408    ptWonder = 6,
     1409    ptShip = 7,
     1410    ptInvalid = 8
     1411  );
     1412
     1413  function ProjectType(Project: integer): TProjectType;
    14101414  begin
    14111415    if Project and cpCompleted <> 0 then
    1412       result := ptSelect
     1416      Result := ptSelect
    14131417    else if Project and (cpImp + cpIndex) = cpImp + imTrGoods then
    1414       result := ptTrGoods
    1415     else if Project and cpImp = 0 then
     1418      Result := ptTrGoods
     1419    else if Project and cpImp = 0 then begin
    14161420      if MyModel[Project and cpIndex].Kind = mkCaravan then
    1417         result := ptCaravan
    1418       else
    1419         result := ptUn
     1421        Result := ptCaravan
     1422      else Result := ptUn;
     1423    end
    14201424    else if Project and cpIndex >= nImp then
    1421       result := ptInvalid
     1425      Result := ptInvalid
    14221426    else if Imp[Project and cpIndex].Kind = ikWonder then
    1423       result := ptWonder
     1427      Result := ptWonder
    14241428    else if Imp[Project and cpIndex].Kind = ikShipPart then
    1425       result := ptShip
    1426     else
    1427       result := ptImp
     1429      Result := ptShip
     1430    else
     1431      Result := ptImp;
    14281432  end;
    14291433
    14301434var
    1431   NewProject, OldMoney, pt0, pt1, cix1: integer;
     1435  NewProject, OldMoney, cix1: integer;
     1436  pt0, pt1: TProjectType;
    14321437  QueryOk: boolean;
    14331438begin
    1434   assert(not supervising);
     1439  Assert(not supervising);
    14351440  ModalSelectDlg.ShowNewContent_CityProject(wmModal, cix);
    14361441  if ModalSelectDlg.result <> -1 then
     
    14441449    else
    14451450    begin
    1446       NewProject := ModalSelectDlg.result;
    1447       QueryOk := true;
     1451      NewProject := ModalSelectDlg.Result;
     1452      QueryOk := True;
    14481453      if (NewProject and cpImp <> 0) and (NewProject and cpIndex >= 28) and
    14491454        (MyRO.NatBuilt[NewProject and cpIndex] > 0) then
     
    14531458          while (cix1 >= 0) and
    14541459            (MyCity[cix1].Built[NewProject and cpIndex] = 0) do
    1455             dec(cix1);
     1460            Dec(cix1);
    14561461          MessgText := Format(Phrases.Lookup('DOUBLESTATEIMP'),
    14571462            [Phrases.Lookup('IMPROVEMENTS', NewProject and cpIndex),
     
    14651470        end;
    14661471      if not QueryOk then
    1467         exit;
     1472        Exit;
    14681473
    14691474      if (MyCity[cix].Prod > 0) then
     
    14761481            (cpImp or cpIndex) then
    14771482          begin // loss of material -- do query
     1483            DpiApplication.ProcessMessages; // TODO: Needed for Gtk2, Lazarus gtk2 bug?
    14781484            if (pt1 = ptTrGoods) or (pt1 = ptShip) or (pt1 <> pt0) and
    1479               (pt0 <> ptCaravan) then
     1485              (pt0 <> ptCaravan) then begin
    14801486              QueryOk := SimpleQuery(mkOkCancel,
    14811487                Format(Phrases.Lookup('LOSEMAT'), [MyCity[cix].Prod0,
    14821488                MyCity[cix].Prod0]), 'MSG_DEFAULT') = mrOK
    1483             else if MyCity[cix].Project and (cpImp or cpIndex) = MyCity[cix]
    1484               .Project0 and (cpImp or cpIndex) then
    1485               QueryOk := SimpleQuery(mkOkCancel, Phrases.Lookup('LOSEMAT3'),
    1486                 'MSG_DEFAULT') = mrOK
     1489            end else
     1490            if MyCity[cix].Project and (cpImp or cpIndex) = MyCity[cix]
     1491              .Project0 and (cpImp or cpIndex) then begin
     1492                QueryOk := SimpleQuery(mkOkCancel, Phrases.Lookup('LOSEMAT3'),
     1493                  'MSG_DEFAULT') = mrOK;
     1494            end;
    14871495          end;
    14881496        end;
    14891497      end;
    14901498      if not QueryOk then
    1491         exit;
     1499        Exit;
    14921500
    14931501      OldMoney := MyRO.Money;
Note: See TracChangeset for help on using the changeset viewer.