Engine:
* Converted all strings without maximum lengths to ansistrings (eliminates 255 char limit) or shortstrings (needs some testing)
* Goal/mission display now stays within screen borders even if it's very long
* Extended mine game mode display to respect no timer and random timer
--- a/hedgewars/CCHandlers.inc Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/CCHandlers.inc Mon Mar 01 19:54:33 2010 +0000
@@ -686,7 +686,7 @@
{$IFDEF DEBUGFILE}
AddFileLog('Setting up OpenGL...');
- AddFileLog('SDL video driver: ' + string(SDL_VideoDriverName(buf, sizeof(buf))));
+ AddFileLog('SDL video driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf))));
{$ENDIF}
SetupOpenGL();
end;
--- a/hedgewars/PascalExports.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/PascalExports.pas Mon Mar 01 19:54:33 2010 +0000
@@ -52,7 +52,7 @@
procedure HW_versionInfo(netProto: PShortInt; versionStr: PString); cdecl; export;
begin
if netProto <> nil then netProto^:= cNetProtoVersion;
- if versionStr <> nil then versionStr^:= string(cVersionString);
+ if versionStr <> nil then versionStr^:= shortstring(cVersionString);
end;
procedure HW_click; cdecl; export;
--- a/hedgewars/hwengine.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/hwengine.pas Mon Mar 01 19:54:33 2010 +0000
@@ -89,7 +89,7 @@
////////////////////////////////
procedure DoTimer(Lag: LongInt);
{$IFNDEF IPHONEOS}
-var s: string;
+var s: shortstring;
{$ENDIF}
begin
inc(RealTicks, Lag);
--- a/hedgewars/uConsole.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uConsole.pas Mon Mar 01 19:54:33 2010 +0000
@@ -65,7 +65,7 @@
s:= str;
end;
-function RegisterVariable(Name: string; VType: TVariableType; p: pointer; Trusted: boolean): PVariable;
+function RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean): PVariable;
var value: PVariable;
begin
New(value);
--- a/hedgewars/uConsts.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uConsts.pas Mon Mar 01 19:54:33 2010 +0000
@@ -391,8 +391,8 @@
cThemeCFGFilename = 'theme.cfg';
FontBorder = 2;
-var PathPrefix: string;
- Pathz: array[TPathType] of String;
+var PathPrefix: shortstring;
+ Pathz: array[TPathType] of shortstring;
CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture;
const cTagsMasks : array[0..7] of byte = (
@@ -1700,7 +1700,7 @@
implementation
procedure init_uConsts;
-var cPathz: array[TPathType] of String = (
+var cPathz: array[TPathType] of shortstring = (
'', // ptNone
'', // ptData
'Graphics', // ptGraphics
--- a/hedgewars/uFloat.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uFloat.pas Mon Mar 01 19:54:33 2010 +0000
@@ -52,7 +52,7 @@
operator < (const z1, z2: hwFloat) b : boolean;
operator > (const z1, z2: hwFloat) b : boolean;
-function cstr(const z: hwFloat): string;
+function cstr(const z: hwFloat): shortstring;
function hwRound(const t: hwFloat): LongInt;
function hwAbs(const t: hwFloat): hwFloat;
function hwSqr(const t: hwFloat): hwFloat;
@@ -261,8 +261,8 @@
b:= (z1.QWordValue > z2.QWordValue) xor z2.isNegative
end;
-function cstr(const z: hwFloat): string;
-var tmpstr: string;
+function cstr(const z: hwFloat): shortstring;
+var tmpstr: shortstring;
begin
str(z.Round, cstr);
if z.Frac <> 0 then
--- a/hedgewars/uIO.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uIO.pas Mon Mar 01 19:54:33 2010 +0000
@@ -141,7 +141,7 @@
end;
procedure IPCCheckSock;
-const ss: string = '';
+const ss: shortstring = '';
var i: LongInt;
buf: array[0..255] of byte;
s: shortstring absolute buf;
@@ -170,7 +170,7 @@
procedure LoadRecordFromFile(fileName: shortstring);
var f: file;
- ss: string = '';
+ ss: shortstring = '';
i: LongInt;
buf: array[0..255] of byte;
s: shortstring absolute buf;
--- a/hedgewars/uKeys.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uKeys.pas Mon Mar 01 19:54:33 2010 +0000
@@ -28,7 +28,7 @@
procedure init_uKeys;
procedure free_uKeys;
-function KeyNameToCode(name: string): word;
+function KeyNameToCode(name: shortstring): word;
procedure ProcessKbd;
procedure ResetKbd;
procedure FreezeEnterKey;
@@ -90,7 +90,7 @@
var tkbd, tkbdn: TKeyboardState;
KeyNames: array [0..cKeyMaxIndex] of string[15];
-function KeyNameToCode(name: string): word;
+function KeyNameToCode(name: shortstring): word;
var code: Word;
begin
code:= cKeyMaxIndex;
@@ -261,7 +261,7 @@
for i:= 6 to cKeyMaxIndex do
begin
- s:= string(sdl_getkeyname(i));
+ s:= shortstring(sdl_getkeyname(i));
//writeln(stdout,inttostr(i) + ': ' + s);
if s = 'unknown key' then KeyNames[i]:= ''
else begin
--- a/hedgewars/uLand.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uLand.pas Mon Mar 01 19:54:33 2010 +0000
@@ -719,7 +719,7 @@
procedure LoadMap;
var tmpsurf: PSDL_Surface;
- s: string;
+ s: shortstring;
f: textfile;
begin
WriteLnToConsole('Loading land from file...');
--- a/hedgewars/uLandObjects.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uLandObjects.pas Mon Mar 01 19:54:33 2010 +0000
@@ -349,7 +349,7 @@
end;
procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects);
-var s: string;
+var s: shortstring;
f: textfile;
i, ii: LongInt;
vobcount: Longword;
--- a/hedgewars/uLocale.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uLocale.pas Mon Mar 01 19:54:33 2010 +0000
@@ -40,27 +40,28 @@
TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable,
gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery,
- gidSolidLand, gidSharedAmmo, gidMineTimer);
+ gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, gidRandomMineTimer);
const MAX_EVENT_STRINGS = 100;
-var trammo: array[TAmmoStrId] of string;
- trammoc: array[TAmmoStrId] of string;
- trammod: array[TAmmoStrId] of string;
- trmsg: array[TMsgStrId] of string;
- trgoal: array[TGoalStrId] of string;
+var trammo: array[TAmmoStrId] of ansistring;
+ trammoc: array[TAmmoStrId] of ansistring;
+ trammod: array[TAmmoStrId] of ansistring;
+ trmsg: array[TMsgStrId] of ansistring;
+ trgoal: array[TGoalStrId] of ansistring;
-procedure LoadLocale(FileName: string);
+procedure LoadLocale(FileName: shortstring);
function Format(fmt: shortstring; var arg: shortstring): shortstring;
+function Format(fmt: ansistring; var arg: ansistring): ansistring;
-function GetEventString(e: TEventId): string;
+function GetEventString(e: TEventId): ansistring;
implementation
uses uMisc, uRandom, uConsole;
-var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of string;
+var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
trevt_n: array[TEventId] of integer;
-procedure LoadLocale(FileName: string);
+procedure LoadLocale(FileName: shortstring);
var s: shortstring;
f: textfile;
a, b, c: LongInt;
@@ -116,7 +117,7 @@
{$I+}
end;
-function GetEventString(e: TEventId): string;
+function GetEventString(e: TEventId): ansistring;
begin
if trevt_n[e] = 0 then // no messages for this event type?
GetEventString:= '*missing translation*'
@@ -132,4 +133,12 @@
else Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
end;
+function Format(fmt: ansistring; var arg: ansistring): ansistring;
+var i: LongInt;
+begin
+i:= Pos('%1', fmt);
+if i = 0 then Format:= fmt
+ else Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
+end;
+
end.
--- a/hedgewars/uMisc.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uMisc.pas Mon Mar 01 19:54:33 2010 +0000
@@ -129,13 +129,13 @@
procedure init_uMisc;
procedure free_uMisc;
procedure SplitBySpace(var a, b: shortstring);
-procedure SplitByChar(var a, b: string; c: char);
+procedure SplitByChar(var a, b: ansistring; c: char);
procedure movecursor(dx, dy: Integer);
function hwSign(r: hwFloat): LongInt;
function Min(a, b: LongInt): LongInt;
function Max(a, b: LongInt): LongInt;
-procedure OutError(Msg: String; isFatalError: boolean);
-procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
+procedure OutError(Msg: shortstring; isFatalError: boolean);
+procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean);
procedure SDLTry(Assert: boolean; isFatal: boolean);
function IntToStr(n: LongInt): shortstring;
function FloatToStr(n: hwFloat): shortstring;
@@ -185,14 +185,14 @@
end else b:= '';
end;
-procedure SplitByChar(var a, b: string; c: char);
+procedure SplitByChar(var a, b: ansistring; c: char);
var i: LongInt;
begin
i:= Pos(c, a);
if i > 0 then
begin
b:= copy(a, i + 1, Length(a) - i);
- byte(a[0]):= Pred(i)
+ setlength(a, Pred(i));
end else b:= '';
end;
@@ -223,7 +223,7 @@
if a > b then Max:= a else Max:= b
end;
-procedure OutError(Msg: String; isFatalError: boolean);
+procedure OutError(Msg: shortstring; isFatalError: boolean);
begin
{$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF}
WriteLnToConsole(Msg);
@@ -235,7 +235,7 @@
end
end;
-procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
+procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean);
begin
if not Assert then OutError(Msg, isFatal)
end;
--- a/hedgewars/uScript.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uScript.pas Mon Mar 01 19:54:33 2010 +0000
@@ -24,14 +24,14 @@
procedure ScriptPrintStack;
procedure ScriptClearStack;
-procedure ScriptLoad(name : string);
+procedure ScriptLoad(name : shortstring);
procedure ScriptOnGameInit;
-procedure ScriptCall(fname : string);
-function ScriptCall(fname : string; par1: LongInt) : LongInt;
-function ScriptCall(fname : string; par1, par2: LongInt) : LongInt;
-function ScriptCall(fname : string; par1, par2, par3: LongInt) : LongInt;
-function ScriptCall(fname : string; par1, par2, par3, par4 : LongInt) : LongInt;
+procedure ScriptCall(fname : shortstring);
+function ScriptCall(fname : shortstring; par1: LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt;
procedure init_uScript;
procedure free_uScript;
@@ -52,7 +52,7 @@
typinfo;
var luaState : Plua_State;
- ScriptAmmoStore : string;
+ ScriptAmmoStore : shortstring;
ScriptLoaded : boolean;
procedure ScriptPrepareAmmoStore; forward;
@@ -306,26 +306,26 @@
lua_settop(luaState, 0)
end;
-procedure ScriptSetInteger(name : string; value : LongInt);
+procedure ScriptSetInteger(name : shortstring; value : LongInt);
begin
lua_pushinteger(luaState, value);
lua_setglobal(luaState, Str2PChar(name));
end;
-procedure ScriptSetString(name : string; value : string);
+procedure ScriptSetString(name : shortstring; value : shortstring);
begin
lua_pushstring(luaState, Str2PChar(value));
lua_setglobal(luaState, Str2PChar(name));
end;
-function ScriptGetInteger(name : string) : LongInt;
+function ScriptGetInteger(name : shortstring) : LongInt;
begin
lua_getglobal(luaState, Str2PChar(name));
ScriptGetInteger:= lua_tointeger(luaState, -1);
lua_pop(luaState, 1);
end;
-function ScriptGetString(name : string) : string;
+function ScriptGetString(name : shortstring) : shortstring;
begin
lua_getglobal(luaState, Str2PChar(name));
ScriptGetString:= lua_tostring(luaState, -1);
@@ -367,7 +367,7 @@
ScriptApplyAmmoStore;
end;
-procedure ScriptLoad(name : string);
+procedure ScriptLoad(name : shortstring);
var ret : LongInt;
begin
ret:= luaL_loadfile(luaState, Str2PChar(name));
@@ -392,7 +392,7 @@
TurnTimeLeft:= ScriptGetInteger('TurnTimeLeft');
end;
-procedure ScriptCall(fname : string);
+procedure ScriptCall(fname : shortstring);
begin
if not ScriptLoaded then
exit;
@@ -406,22 +406,22 @@
GetGlobals;
end;
-function ScriptCall(fname : string; par1: LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1: LongInt) : LongInt;
begin
ScriptCall:= ScriptCall(fname, par1, 0, 0, 0)
end;
-function ScriptCall(fname : string; par1, par2: LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt;
begin
ScriptCall:= ScriptCall(fname, par1, par2, 0, 0)
end;
-function ScriptCall(fname : string; par1, par2, par3: LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt;
begin
ScriptCall:= ScriptCall(fname, par1, par2, par3, 0)
end;
-function ScriptCall(fname : string; par1, par2, par3, par4 : LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt;
begin
if not ScriptLoaded then
exit;
@@ -467,17 +467,17 @@
end;
// small helper functions making registering enums a lot easier
-function str(const en : TGearType) : string; overload;
+function str(const en : TGearType) : shortstring; overload;
begin
str:= GetEnumName(TypeInfo(TGearType), ord(en))
end;
-function str(const en : TSound) : string; overload;
+function str(const en : TSound) : shortstring; overload;
begin
str:= GetEnumName(TypeInfo(TSound), ord(en))
end;
-function str(const en : TAmmoType) : string; overload;
+function str(const en : TAmmoType) : shortstring; overload;
begin
str:= GetEnumName(TypeInfo(TAmmoType), ord(en))
end;
@@ -564,7 +564,7 @@
begin
end;
-procedure ScriptLoad(name : string);
+procedure ScriptLoad(name : shortstring);
begin
end;
@@ -572,26 +572,26 @@
begin
end;
-procedure ScriptCall(fname : string);
+procedure ScriptCall(fname : shortstring);
begin
end;
-function ScriptCall(fname : string; par1, par2, par3, par4 : LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt;
begin
ScriptCall:= 0
end;
-function ScriptCall(fname : string; par1: LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1: LongInt) : LongInt;
begin
ScriptCall:= 0
end;
-function ScriptCall(fname : string; par1, par2: LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt;
begin
ScriptCall:= 0
end;
-function ScriptCall(fname : string; par1, par2, par3: LongInt) : LongInt;
+function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt;
begin
ScriptCall:= 0
end;
--- a/hedgewars/uSound.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uSound.pas Mon Mar 01 19:54:33 2010 +0000
@@ -206,7 +206,7 @@
end;
procedure PlayMusic;
-var s: string;
+var s: shortstring;
begin
if (not isSoundEnabled)
or (MusicFN = '')
--- a/hedgewars/uStore.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uStore.pas Mon Mar 01 19:54:33 2010 +0000
@@ -62,9 +62,9 @@
procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
procedure DrawFillRect(r: TSDL_Rect);
procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
-function CheckCJKFont(s: string; font: THWFont): THWFont;
-function RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture;
-function RenderSpeechBubbleTex(s: string; SpeechType: Longword; font: THWFont): PTexture;
+function CheckCJKFont(s: ansistring; font: THWFont): THWFont;
+function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture;
+function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture;
procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean);
//procedure rotateSurface(Surface: PSDL_Surface);
procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL
@@ -72,10 +72,10 @@
procedure RenderHealth(var Hedgehog: THedgehog);
procedure AddProgress;
procedure FinishProgress;
-function LoadImage(const filename: string; imageFlags: LongInt): PSDL_Surface;
+function LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
procedure SetupOpenGL;
procedure SetScale(f: GLfloat);
-function RenderHelpWindow(caption, subcaption, description, extra: shortstring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
+function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
procedure RenderWeaponTooltip(atype: TAmmoType);
procedure ShowWeaponTooltip(x, y: LongInt);
procedure FreeWeaponTooltip;
@@ -118,7 +118,7 @@
SDL_FillRect(Surface, @r, FillColor)
end;
-function WriteInRoundRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: string): TSDL_Rect;
+function WriteInRoundRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect;
var w, h: LongInt;
tmpsurf: PSDL_Surface;
clr: TSDL_Color;
@@ -146,7 +146,7 @@
WriteInRoundRect:= finalRect;
end;
-function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: string): TSDL_Rect;
+function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect;
var w, h: LongInt;
tmpsurf: PSDL_Surface;
clr: TSDL_Color;
@@ -173,7 +173,7 @@
end;
procedure StoreLoad;
-var s: string;
+var s: shortstring;
procedure WriteNames(Font: THWFont);
var t: LongInt;
@@ -795,7 +795,7 @@
end;
-function CheckCJKFont(s: string; font: THWFont): THWFont;
+function CheckCJKFont(s: ansistring; font: THWFont): THWFont;
var l, i : LongInt;
u: WideChar;
tmpstr: array[0..256] of WideChar;
@@ -824,7 +824,7 @@
((#$2F800 <= u) and (u >= #$2FA1F))) // CJK Compatibility Ideographs Supplement *)
end;
-function RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture;
+function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture;
var w, h : LongInt;
finalSurface: PSDL_Surface;
begin
@@ -846,7 +846,7 @@
SDL_FreeSurface(finalSurface);
end;
-function RenderSpeechBubbleTex(s: string; SpeechType: Longword; font: THWFont): PTexture;
+function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture;
var textWidth, textHeight, x, y, w, h, i, j, pos, prevpos, line, numLines, edgeWidth, edgeHeight, cornerWidth, cornerHeight: LongInt;
finalSurface, tmpsurf, rotatedEdge: PSDL_Surface;
rect: TSDL_Rect;
@@ -1038,7 +1038,7 @@
Hedgehog.HealthTagTex:= RenderStringTex(s, Hedgehog.Team^.Clan^.Color, fnt16)
end;
-function LoadImage(const filename: string; imageFlags: LongInt): PSDL_Surface;
+function LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
var tmpsurf: PSDL_Surface;
s: shortstring;
begin
@@ -1095,7 +1095,7 @@
LoadImage:= tmpsurf //Result
end;
-function glLoadExtension(extension : string) : boolean;
+function glLoadExtension(extension : shortstring) : boolean;
begin
{$IFDEF IPHONEOS}
glLoadExtension:= false;
@@ -1138,11 +1138,11 @@
glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize);
- vendor:= LowerCase(string(pchar(glGetString(GL_VENDOR))));
+ vendor:= LowerCase(shortstring(pchar(glGetString(GL_VENDOR))));
{$IFDEF DEBUGFILE}
- AddFileLog('OpenGL-- Renderer: ' + string(pchar(glGetString(GL_RENDERER))));
+ AddFileLog('OpenGL-- Renderer: ' + shortstring(pchar(glGetString(GL_RENDERER))));
AddFileLog(' |----- Vendor: ' + vendor);
- AddFileLog(' |----- Version: ' + string(pchar(glGetString(GL_VERSION))));
+ AddFileLog(' |----- Version: ' + shortstring(pchar(glGetString(GL_VERSION))));
AddFileLog(' \----- GL_MAX_TEXTURE_SIZE: ' + inttostr(MaxTextureSize));
{$ENDIF}
@@ -1345,13 +1345,13 @@
end;
end;
-function RenderHelpWindow(caption, subcaption, description, extra: shortstring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
+function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
var tmpsurf: PSDL_SURFACE;
w, h, i, j: LongInt;
font: THWFont;
r, r2: TSDL_Rect;
wa, ha: LongInt;
- tmpline, tmpline2, tmpdesc: shortstring;
+ tmpline, tmpline2, tmpdesc: ansistring;
begin
// make sure there is a caption as well as a sub caption - description is optional
if caption = '' then caption:= '???';
@@ -1458,7 +1458,7 @@
{$IFNDEF IPHONEOS}
var r: TSDL_Rect;
i: LongInt;
- extra: string;
+ extra: ansistring;
extracolor: LongInt;
begin
// don't do anything if the window shouldn't be shown
--- a/hedgewars/uTeams.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uTeams.pas Mon Mar 01 19:54:33 2010 +0000
@@ -51,7 +51,7 @@
BotLevel : LongWord; // 0 - Human player
HatVisibility: GLfloat;
stats: TStatistics;
- Hat: String;
+ Hat: shortstring;
King: boolean; // Flag for a bunch of hedgehog attributes
Unplaced: boolean; // Flag for hog placing mode
end;
@@ -68,9 +68,9 @@
GraveTex,
HealthTex,
FlagTex: PTexture;
- Flag: string;
- GraveName: string;
- FortName: string;
+ Flag: shortstring;
+ GraveName: shortstring;
+ FortName: shortstring;
TeamHealth: LongInt;
TeamHealthBarWidth,
NewTeamHealthBarWidth: LongInt;
@@ -79,7 +79,7 @@
HedgehogsNumber: Longword;
hasGone: boolean;
voicepack: PVoicepack;
- PlayerHash: string; // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players
+ PlayerHash: shortstring; // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players
end;
TClan = record
@@ -147,9 +147,9 @@
with AliveClan^ do
begin
if TeamsNumber = 1 then
- s:= Format(trmsg[sidWinner], Teams[0]^.TeamName) // team wins
+ s:= Format(shortstring(trmsg[sidWinner]), Teams[0]^.TeamName) // team wins
else
- s:= Format(trmsg[sidWinner], Teams[0]^.TeamName); // clan wins
+ s:= Format(shortstring(trmsg[sidWinner]), Teams[0]^.TeamName); // clan wins
for j:= 0 to Pred(TeamsNumber) do
with Teams[j]^ do
--- a/hedgewars/uWorld.pas Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uWorld.pas Mon Mar 01 19:54:33 2010 +0000
@@ -41,8 +41,8 @@
procedure InitWorld;
procedure DrawWorld(Lag: LongInt);
-procedure AddCaption(s: string; Color: Longword; Group: TCapGroup);
-procedure ShowMission(caption, subcaption, text: string; icon, time : LongInt);
+procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
+procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
procedure HideMission;
implementation
@@ -79,7 +79,7 @@
// helper functions to create the goal/game mode string
function AddGoal(s: ansistring; gf: LongInt; si: TGoalStrId; i: LongInt): ansistring;
- var t: string;
+ var t: ansistring;
begin
if (GameFlags and gf) <> 0 then
begin
@@ -129,7 +129,15 @@
g:= AddGoal(g, gfArtillery, gidArtillery); // artillery?
g:= AddGoal(g, gfSolidLand, gidSolidLand); // solid land?
g:= AddGoal(g, gfSharedAmmo, gidSharedAmmo); // shared ammo?
-if cMinesTime <> 3000 then g:= AddGoal(g, gfMines, gidMineTimer, cMinesTime div 1000); // changed mine timer?
+if cMinesTime <> 3000 then // changed mine timer?
+ begin
+ if cMinesTime = 0 then
+ g:= AddGoal(g, gfMines, gidNoMineTimer)
+ else if cMinesTime < 0 then
+ g:= AddGoal(g, gfMines, gidRandomMineTimer)
+ else
+ g:= AddGoal(g, gfMines, gidMineTimer, cMinesTime div 1000);
+ end;
// if the string has been set, show it for (default timeframe) seconds
if g <> '' then ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 1, 0);
@@ -680,7 +688,7 @@
if missionTimer > 0 then dec(missionTimer, Lag);
if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0
if missionTex <> nil then
- DrawCentered(0, (cScreenHeight shr 1) + 100, missionTex);
+ DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex);
end;
// fps
@@ -770,7 +778,7 @@
glDisable(GL_BLEND)
end;
-procedure AddCaption(s: string; Color: Longword; Group: TCapGroup);
+procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
begin
//if Group in [capgrpGameState] then WriteLnToConsole(s);
if Captions[Group].Tex <> nil then FreeTexture(Captions[Group].Tex);
@@ -873,7 +881,7 @@
if WorldDx > 1024 then WorldDx:= 1024;
end;
-procedure ShowMission(caption, subcaption, text: string; icon, time : LongInt);
+procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
var r: TSDL_Rect;
begin
r.w:= 32;
--- a/share/hedgewars/Data/Locale/de.txt Mon Mar 01 19:20:43 2010 +0000
+++ b/share/hedgewars/Data/Locale/de.txt Mon Mar 01 19:54:33 2010 +0000
@@ -259,3 +259,5 @@
05:10=Unzerstörbares Terrain: Explosionen zerstören den Boden nicht
05:11=Gemeinsames Arsenal: Alle Teams gleicher Farbe teilen sich ihr Arsenal
05:12=Minenzünder: Minen explodieren nach %1 Sekunde(n)
+05:13=Minenzünder: Minen explodieren sofort
+05:14=Minenzünder: Minen explodieren nach 0 - 4 Sekunden
\ No newline at end of file
--- a/share/hedgewars/Data/Locale/en.txt Mon Mar 01 19:20:43 2010 +0000
+++ b/share/hedgewars/Data/Locale/en.txt Mon Mar 01 19:54:33 2010 +0000
@@ -460,4 +460,6 @@
05:09=Artillery: Hogs can't walk to change position
05:10=Indestructible Terrain: Most weapons won't destroy terrain
05:11=Shared Ammo: All teams of the same color share their ammunition
-05:12=Mine timers: Mines will detonated after %1 second(s)
+05:12=Mine timers: Mines will detonate after %1 second(s)
+05:13=Mine timers: Mines will detonate instantly
+05:14=Mine timers: Mines will detonate after 0 - 4 seconds
\ No newline at end of file