# HG changeset patch
# User nemo
# Date 1293657690 18000
# Node ID 8571151411b3a467961b2cff17cf65e7f5e1b2e8
# Parent 1565a553d200ba206ef19c9581746cd31d16d452
add a couple of variables to speed up UID lookups. Based on the assumption new visual gears and gears will tend to be at the end of the list. Set them on successful lookup or script gear creation, clear on delete. Oh also pick up a couple of TrevInc's translation changes
diff -r 1565a553d200 -r 8571151411b3 hedgewars/uGears.pas
--- a/hedgewars/uGears.pas Wed Dec 29 17:27:33 2010 +0100
+++ b/hedgewars/uGears.pas Wed Dec 29 16:21:30 2010 -0500
@@ -595,6 +595,7 @@
if CurAmmoGear = Gear then CurAmmoGear:= nil;
if FollowGear = Gear then FollowGear:= nil;
+if lastGearByUID = Gear then lastGearByUID := nil;
RemoveGearFromList(Gear);
Dispose(Gear)
end;
@@ -1778,13 +1779,20 @@
var gear: PGear;
begin
GearByUID:= nil;
+if uid = 0 then exit;
+if (lastGearByUID <> nil) and (lastGearByUID^.uid = uid) then
+ begin
+ GearByUID:= lastGearByUID;
+ exit
+ end;
gear:= GearsList;
while gear <> nil do
begin
if gear^.uid = uid then
begin
- GearByUID:= gear;
- exit
+ lastGearByUID:= gear;
+ GearByUID:= gear;
+ exit
end;
gear:= gear^.NextGear
end
diff -r 1565a553d200 -r 8571151411b3 hedgewars/uScript.pas
--- a/hedgewars/uScript.pas Wed Dec 29 17:27:33 2010 +0100
+++ b/hedgewars/uScript.pas Wed Dec 29 16:21:30 2010 -0500
@@ -272,6 +272,7 @@
t:= lua_tointeger(L, 7);
gear:= AddGear(x, y, gt, s, dx, dy, t);
+ lastGearByUID:= gear;
lua_pushinteger(L, gear^.uid)
end;
lc_addgear:= 1; // 1 return value
@@ -311,8 +312,12 @@
s:= lua_tointeger(L, 4);
c:= lua_toboolean(L, 5);
- vg:= AddVisualGear(x, y, vgt, s, c);
- if vg <> nil then lua_pushinteger(L, vg^.uid)
+ vg:= AddVisualGear(x, y, vgt, s, c);
+ if vg <> nil then
+ begin
+ lastVisualGearByUID:= vg;
+ lua_pushinteger(L, vg^.uid)
+ end
else lua_pushinteger(L, 0)
end;
lc_addvisualgear:= 1; // 1 return value
diff -r 1565a553d200 -r 8571151411b3 hedgewars/uVariables.pas
--- a/hedgewars/uVariables.pas Wed Dec 29 17:27:33 2010 +0100
+++ b/hedgewars/uVariables.pas Wed Dec 29 16:21:30 2010 -0500
@@ -2040,6 +2040,7 @@
LandBackSurface: PSDL_Surface;
digest: shortstring;
CurAmmoGear: PGear;
+ lastGearByUID: PGear;
GearsList: PGear;
AllInactive: boolean;
PrvInactive: boolean;
@@ -2097,6 +2098,7 @@
VisualGearsList: PVisualGear;
+ lastVisualGearByUID: PVisualGear;
vobFrameTicks, vobFramesCount, vobCount: Longword;
vobVelocity, vobFallSpeed: LongInt;
@@ -2153,6 +2155,9 @@
procedure initModule;
begin
+ lastVisualGearByUID:= nil;
+ lastGearByUID:= nil;
+
Pathz:= cPathz;
{* REFERENCE
4096 -> $FFFFF000
@@ -2160,19 +2165,19 @@
1024 -> $FFFFFC00
512 -> $FFFFFE00 *}
if (cReducedQuality and rqLowRes) <> 0 then
- begin
+ begin
LAND_WIDTH:= 2048;
LAND_HEIGHT:= 1024;
LAND_WIDTH_MASK:= $FFFFF800;
LAND_HEIGHT_MASK:= $FFFFFC00;
- end
+ end
else
- begin
+ begin
LAND_WIDTH:= 4096;
LAND_HEIGHT:= 2048;
LAND_WIDTH_MASK:= $FFFFF000;
LAND_HEIGHT_MASK:= $FFFFF800
- end;
+ end;
SDWaterColorArray[0].r := 184;
SDWaterColorArray[0].g := 152;
diff -r 1565a553d200 -r 8571151411b3 hedgewars/uVisualGears.pas
--- a/hedgewars/uVisualGears.pas Wed Dec 29 17:27:33 2010 +0100
+++ b/hedgewars/uVisualGears.pas Wed Dec 29 16:21:30 2010 -0500
@@ -328,6 +328,8 @@
if Gear^.PrevGear <> nil then Gear^.PrevGear^.NextGear:= Gear^.NextGear
else VisualGearsList:= Gear^.NextGear;
+ if lastVisualGearByUID = Gear then lastVisualGearByUID:= nil;
+
Dispose(Gear);
end;
@@ -524,13 +526,20 @@
var vg: PVisualGear;
begin
VisualGearByUID:= nil;
+if uid = 0 then exit;
+if (lastVisualGearByUID <> nil) and (lastVisualGearByUID^.uid = uid) then
+ begin
+ VisualGearByUID:= lastVisualGearByUID;
+ exit
+ end;
vg:= VisualGearsList;
while vg <> nil do
begin
if vg^.uid = uid then
begin
- VisualGearByUID:= vg;
- exit
+ lastVisualGearByUID:= vg;
+ VisualGearByUID:= vg;
+ exit
end;
vg:= vg^.NextGear
end
diff -r 1565a553d200 -r 8571151411b3 misc/hedgewars.desktop
--- a/misc/hedgewars.desktop Wed Dec 29 17:27:33 2010 +0100
+++ b/misc/hedgewars.desktop Wed Dec 29 16:21:30 2010 -0500
@@ -12,6 +12,7 @@
GenericName[es]=Batallas entre erizos
GenericName[it]=Ricci combattenti
GenericName[pt]=Batalhas entre ouriços
+GenericName[ko]=고슴도치 싸우기
Icon=hedgewars.png
Exec=hedgewars
Terminal=false
diff -r 1565a553d200 -r 8571151411b3 share/hedgewars/Data/misc/hedgewars-mimeinfo.xml
--- a/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml Wed Dec 29 17:27:33 2010 +0100
+++ b/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml Wed Dec 29 16:21:30 2010 -0500
@@ -15,6 +15,7 @@
Demo de Hedgewars
Demo di Hedgewars
Hedgewars Demo
+ 헤즈와스 데모
@@ -32,6 +33,7 @@
Partida guardada de Hedgewars
Partita salvata di Hedgewars
Partida guardada de Hedgewars
+ 헤즈와스 저장된 게임