--- a/hedgewars/uFLGameConfig.pas Wed Dec 02 13:39:16 2015 +0300
+++ b/hedgewars/uFLGameConfig.pas Wed Dec 02 22:21:23 2015 +0300
@@ -27,6 +27,7 @@
procedure netSetMazeSize(mazesize: LongInt);
procedure netSetTemplate(template: LongInt);
procedure netSetAmmo(name: shortstring; definition: ansistring);
+procedure netSetScheme(scheme: TScheme);
procedure updatePreviewIfNeeded;
procedure sendConfig(config: PGameConfig);
@@ -408,4 +409,10 @@
sendUI(mtAmmo, @name[1], length(name))
end;
+procedure netSetScheme(scheme: TScheme);
+begin
+ currentConfig.scheme:= scheme;
+ sendUI(mtScheme, @scheme.schemeName[1], length(scheme.schemeName))
+end;
+
end.
--- a/hedgewars/uFLNetProtocol.pas Wed Dec 02 13:39:16 2015 +0300
+++ b/hedgewars/uFLNetProtocol.pas Wed Dec 02 22:21:23 2015 +0300
@@ -110,12 +110,79 @@
end
end;
+var schemeIndex: LongInt;
+ tmpScheme: TScheme;
+
procedure handler_CFG_SCHEME(var p: TCmdParam);
begin
+ schemeIndex:= 0
end;
+const schemeFields: array[0..43] of pointer = (
+ @tmpScheme.schemeName // 0
+ , @tmpScheme.fortsmode // 1
+ , @tmpScheme.divteams // 2
+ , @tmpScheme.solidland // 3
+ , @tmpScheme.border // 4
+ , @tmpScheme.lowgrav // 5
+ , @tmpScheme.laser // 6
+ , @tmpScheme.invulnerability // 7
+ , @tmpScheme.resethealth // 8
+ , @tmpScheme.vampiric // 9
+ , @tmpScheme.karma // 10
+ , @tmpScheme.artillery // 11
+ , @tmpScheme.randomorder // 12
+ , @tmpScheme.king // 13
+ , @tmpScheme.placehog // 14
+ , @tmpScheme.sharedammo // 15
+ , @tmpScheme.disablegirders // 16
+ , @tmpScheme.disablelandobjects // 17
+ , @tmpScheme.aisurvival // 18
+ , @tmpScheme.infattack // 19
+ , @tmpScheme.resetweps // 20
+ , @tmpScheme.perhogammo // 21
+ , @tmpScheme.disablewind // 22
+ , @tmpScheme.morewind // 23
+ , @tmpScheme.tagteam // 24
+ , @tmpScheme.bottomborder // 25
+ , @tmpScheme.damagefactor // 26
+ , @tmpScheme.turntime // 27
+ , @tmpScheme.health // 28
+ , @tmpScheme.suddendeath // 29
+ , @tmpScheme.caseprobability // 30
+ , @tmpScheme.minestime // 31
+ , @tmpScheme.minesnum // 32
+ , @tmpScheme.minedudpct // 33
+ , @tmpScheme.explosives // 34
+ , @tmpScheme.airmines // 35
+ , @tmpScheme.healthprobability // 36
+ , @tmpScheme.healthcaseamount // 37
+ , @tmpScheme.waterrise // 38
+ , @tmpScheme.healthdecrease // 39
+ , @tmpScheme.ropepct // 40
+ , @tmpScheme.getawaytime // 41
+ , @tmpScheme.worldedge // 42
+ , @tmpScheme.scriptparam // 43
+ );
+
procedure handler_CFG_SCHEME_s(var s: TCmdParamS);
begin
+ if(schemeIndex = 0) then
+ tmpScheme.schemeName:= s.str1
+ else
+ if(schemeIndex = 43) then
+ tmpScheme.scriptparam:= copy(s.str1, 2, length(s.str1) - 1)
+ else
+ if(schemeIndex < 26) then
+ PBoolean(schemeFields[schemeIndex])^:= s.str1[1] = 't'
+ else
+ if(schemeIndex < 43) then
+ PLongInt(schemeFields[schemeIndex])^:= strToInt(s.str1);
+
+ if(schemeIndex = 43) then
+ netSetScheme(tmpScheme);
+
+ inc(schemeIndex);
end;
procedure handler_CFG_SCRIPT(var p: TCmdParamS);
--- a/hedgewars/uFLSchemes.pas Wed Dec 02 13:39:16 2015 +0300
+++ b/hedgewars/uFLSchemes.pas Wed Dec 02 22:21:23 2015 +0300
@@ -21,7 +21,7 @@
listOfSchemeNames: array[0..MAX_SCHEME_NAMES] of PChar;
tmpScheme: TScheme;
-const ints: array[0 .. 16] of record
+const ints: array[0 .. 17] of record
name: shortstring;
param: ^LongInt;
end = (
@@ -42,8 +42,9 @@
, (name: 'ropepct'; param: @tmpScheme.ropepct)
, (name: 'getawaytime'; param: @tmpScheme.getawaytime)
, (name: 'worldedge'; param: @tmpScheme.worldedge)
+ , (name: 'airmines'; param: @tmpScheme.airmines)
);
-const bools: array[0 .. 19] of record
+const bools: array[0 .. 25] of record
name: shortstring;
param: ^boolean;
end = (
@@ -67,6 +68,12 @@
, (name: 'morewind'; param: @tmpScheme.morewind)
, (name: 'tagteam'; param: @tmpScheme.tagteam)
, (name: 'bottomborder'; param: @tmpScheme.bottomborder)
+ , (name: 'resethealth'; param: @tmpScheme.resethealth)
+ , (name: 'disablelandobjects'; param: @tmpScheme.disablelandobjects)
+ , (name: 'aisurvival'; param: @tmpScheme.aisurvival)
+ , (name: 'infattack'; param: @tmpScheme.infattack)
+ , (name: 'resetweps'; param: @tmpScheme.resetweps)
+ , (name: 'perhogammo'; param: @tmpScheme.perhogammo)
);
--- a/hedgewars/uFLTypes.pas Wed Dec 02 13:39:16 2015 +0300
+++ b/hedgewars/uFLTypes.pas Wed Dec 02 22:21:23 2015 +0300
@@ -11,7 +11,7 @@
, mtRemoveRoomClient, mtRoomChatLine, mtAddRoom, mtUpdateRoom
, mtRemoveRoom, mtError, mtWarning, mtMoveToLobby, mtMoveToRoom
, mtNickname, mtSeed, mtTheme, mtScript, mtFeatureSize, mtMapGen
- , mtMap, mtMazeSize, mtTemplate, mtAmmo);
+ , mtMap, mtMazeSize, mtTemplate, mtAmmo, mtScheme);
TFLIBEvent = (flibGameFinished);
@@ -65,6 +65,12 @@
, disablewind
, morewind
, tagteam
+ , resethealth
+ , disablelandobjects
+ , aisurvival
+ , infattack
+ , resetweps
+ , perhogammo
, bottomborder: boolean;
damagefactor
, turntime
@@ -82,6 +88,7 @@
, healthdecrease
, ropepct
, getawaytime
+ , airmines
, worldedge: LongInt
end;
PScheme = ^TScheme;
--- a/qmlFrontend/flib.h Wed Dec 02 13:39:16 2015 +0300
+++ b/qmlFrontend/flib.h Wed Dec 02 22:21:23 2015 +0300
@@ -42,6 +42,7 @@
, MSG_MAZESIZE
, MSG_TEMPLATE
, MSG_AMMO
+ , MSG_SCHEME
};
typedef union string255_
--- a/qmlFrontend/hwengine.cpp Wed Dec 02 13:39:16 2015 +0300
+++ b/qmlFrontend/hwengine.cpp Wed Dec 02 22:21:23 2015 +0300
@@ -306,6 +306,10 @@
emit ammoChanged(QString::fromUtf8(msg));
break;
}
+ case MSG_SCHEME: {
+ emit schemeChanged(QString::fromUtf8(msg));
+ break;
+ }
}
}
--- a/qmlFrontend/hwengine.h Wed Dec 02 13:39:16 2015 +0300
+++ b/qmlFrontend/hwengine.h Wed Dec 02 22:21:23 2015 +0300
@@ -80,6 +80,7 @@
void mazeSizeChanged(int mazeSize);
void templateChanged(int templ);
void ammoChanged(const QString & ammo);
+ void schemeChanged(const QString & scheme);
void roomAdded(quint32 flags
, const QString & name
--- a/qmlFrontend/qml/qmlFrontend/GameConfig.qml Wed Dec 02 13:39:16 2015 +0300
+++ b/qmlFrontend/qml/qmlFrontend/GameConfig.qml Wed Dec 02 22:21:23 2015 +0300
@@ -127,6 +127,10 @@
}
}
}
+ Connections {
+ target: HWEngine
+ onSchemeChanged: cbScheme.showItem({"iconSource" : "", "text" : scheme});
+ }
}