hedgewars/hwengine.dpr
changeset 97 e7c1df9cce2c
parent 81 d74e0e914b50
child 109 ab0340f580c2
equal deleted inserted replaced
96:aeeb4da6b157 97:e7c1df9cce2c
   161 end;
   161 end;
   162 
   162 
   163 ////////////////////
   163 ////////////////////
   164 procedure GetParams;
   164 procedure GetParams;
   165 var c: integer;
   165 var c: integer;
       
   166     i: integer;
       
   167     p: TPathType;
       
   168 begin
       
   169 PathPrefix:= ParamStr(0);
       
   170 for i:= 1 to Length(PathPrefix) do
       
   171     if PathPrefix[i] = '\' then PathPrefix[i]:= '/';
       
   172 i:= Length(PathPrefix);
       
   173 while (i > 0) and not (PathPrefix[i] = '/') do dec(i);
       
   174 Delete(PathPrefix, i, Length(PathPrefix) - i + 1);
       
   175 dec(i);
       
   176 while (i > 0) and not (PathPrefix[i] = '/') do dec(i);
       
   177 Delete(PathPrefix, i, Length(PathPrefix) - i + 1);
       
   178 PathPrefix:= PathPrefix + '/share/hedgewars/';
       
   179 for p:= Low(TPathType) to High(TPathType) do
       
   180     if p <> ptMapCurrent then Pathz[p]:= PathPrefix + Pathz[p];
       
   181 
   166 {$IFDEF DEBUGFILE}
   182 {$IFDEF DEBUGFILE}
   167     i: integer;
   183 AddFileLog('Prefix: "' + PathPrefix +'"');
   168 begin
       
   169 for i:= 0 to ParamCount do
   184 for i:= 0 to ParamCount do
   170     AddFileLog(inttostr(i) + ': ' + ParamStr(i));
   185     AddFileLog(inttostr(i) + ': ' + ParamStr(i));
   171 {$ELSE}
   186 {$ELSE}
   172 begin
   187 begin
   173 {$ENDIF}
   188 {$ENDIF}
   179    val(cBitsStr, cBits, c);
   194    val(cBitsStr, cBits, c);
   180    val(ParamStr(4), ipcPort, c);
   195    val(ParamStr(4), ipcPort, c);
   181    cFullScreen:= ParamStr(5) = '1';
   196    cFullScreen:= ParamStr(5) = '1';
   182    isSoundEnabled:= ParamStr(6) = '1';
   197    isSoundEnabled:= ParamStr(6) = '1';
   183    cLocaleFName:= ParamStr(7);
   198    cLocaleFName:= ParamStr(7);
   184    end else OutError(errmsgShouldntRun, true);
   199    end else OutError(errmsgShouldntRun, true)
   185 end;
   200 end;
   186 
   201 
   187 procedure ShowMainWindow;
   202 procedure ShowMainWindow;
   188 var flags: Longword;
   203 var flags: Longword;
   189 begin
   204 begin