[SCM] advanced 3D real time strategy game engine branch, master, updated. c16eb6228ca23ff0cb19e30b72fb5bf5e3487b63
Marco Amadori
marco.amadori at gmail.com
Mon Oct 26 02:10:01 UTC 2009
The following commit has been merged in the master branch:
commit 7434fe1f4a7c8e6fa8fe9169c3a5c2fe11016817
Author: Marco Amadori <marco.amadori at gmail.com>
Date: Mon Oct 26 01:02:26 2009 +0100
Imported Upstream version 0.80.5.1
diff --git a/AI/SConscript b/AI/SConscript
index 311cb6b..e598118 100644
--- a/AI/SConscript
+++ b/AI/SConscript
@@ -781,7 +781,7 @@ for baseName in skirmishais_toBuild:
objs += skirmishAIObjsLegacyCPP
if needCPP:
- buildList += wrapp_cppWrapper_cmd
+ buildList += wrap_cppWrapper_cmd
myEnv.AppendUnique(CPPPATH = ['Wrappers'])
objs += skirmishAIObjsCpp
diff --git a/AI/Skirmish/AAI/data/AIOptions.lua b/AI/Skirmish/AAI/data/AIOptions.lua
index 52bb3fc..d435d62 100644
--- a/AI/Skirmish/AAI/data/AIOptions.lua
+++ b/AI/Skirmish/AAI/data/AIOptions.lua
@@ -1,37 +1,14 @@
--
--- Custom Options Definition Table format
+-- Custom Options Definition Table format
--
--- NOTES:
--- - using an enumerated table lets you specify the options order
---
--- These keywords must be lowercase for LuaParser to read them.
---
--- key: the string used in the script.txt
--- name: the displayed name
--- desc: the description (could be used as a tooltip)
--- type: the option type
--- def: the default value;
--- min: minimum value for number options
--- max: maximum value for number options
--- step: quantization step, aligned to the def value
--- maxlen: the maximum string length for string options
--- items: array of item strings for list options
--- scope: 'all', 'player', 'team', 'allyteam' <<< not supported yet >>>
+-- A detailed example of how this format works can be found
+-- in the spring source under:
+-- AI/Skirmish/NullAI/data/AIOptions.lua
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local options = {
- {
- key="difficulty",
- name="AI Difficulty Level",
- desc="1 means, the AI plays very poor, 5 means, it gives its best",
- type = 'number',
- def = 3,
- min = 1,
- max = 5,
- step = 1,
- },
}
return options
diff --git a/AI/Skirmish/CppTestAI/data/AIOptions.lua b/AI/Skirmish/CppTestAI/data/AIOptions.lua
new file mode 100644
index 0000000..d435d62
--- /dev/null
+++ b/AI/Skirmish/CppTestAI/data/AIOptions.lua
@@ -0,0 +1,15 @@
+--
+-- Custom Options Definition Table format
+--
+-- A detailed example of how this format works can be found
+-- in the spring source under:
+-- AI/Skirmish/NullAI/data/AIOptions.lua
+--
+--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+local options = {
+}
+
+return options
+
diff --git a/AI/Skirmish/KAIK/Containers.cpp b/AI/Skirmish/KAIK/Containers.cpp
index 177412a..70e5780 100644
--- a/AI/Skirmish/KAIK/Containers.cpp
+++ b/AI/Skirmish/KAIK/Containers.cpp
@@ -45,7 +45,6 @@ CR_REG_METADATA(BuilderTracker, (
CR_MEMBER(buildTaskId),
CR_MEMBER(taskPlanId),
CR_MEMBER(factoryId),
- CR_MEMBER(customOrderId),
CR_MEMBER(stuckCount),
CR_MEMBER(idleStartFrame),
CR_MEMBER(commandOrderPushFrame),
diff --git a/AI/Skirmish/KAIK/Containers.h b/AI/Skirmish/KAIK/Containers.h
index b960340..4dcafeb 100644
--- a/AI/Skirmish/KAIK/Containers.h
+++ b/AI/Skirmish/KAIK/Containers.h
@@ -118,8 +118,6 @@ struct BuilderTracker {
int taskPlanId;
// if not NULL then this worker belongs to this Factory.
int factoryId;
- // if not NULL then this worker is on reclaim job or something, not tracked until it gets idle
- int customOrderId;
// if not NULL then this worker is stuck or something
int stuckCount;
diff --git a/AI/Skirmish/KAIK/DefenseMatrix.cpp b/AI/Skirmish/KAIK/DefenseMatrix.cpp
index 2d8138d..88a62cd 100644
--- a/AI/Skirmish/KAIK/DefenseMatrix.cpp
+++ b/AI/Skirmish/KAIK/DefenseMatrix.cpp
@@ -42,11 +42,13 @@ void CDefenseMatrix::Init() {
}
void CDefenseMatrix::MaskBadBuildSpot(float3 pos) {
- int f3multiplier = 8 * THREATRES;
- int x = (int) (pos.x / f3multiplier);
- int y = (int) (pos.z / f3multiplier);
+ if (pos.IsInBounds()) {
+ const int f3multiplier = 8 * THREATRES;
+ const int x = (int) (pos.x / f3multiplier);
+ const int y = (int) (pos.z / f3multiplier);
- BuildMaskArray[y * ai->pather->PathMapXSize + x] = 1;
+ BuildMaskArray[y * ai->pather->PathMapXSize + x] = 1;
+ }
}
float3 CDefenseMatrix::GetDefensePos(const UnitDef* def, float3 builderpos) {
diff --git a/AI/Skirmish/KAIK/UnitHandler.cpp b/AI/Skirmish/KAIK/UnitHandler.cpp
index 16f5b77..71c1dd2 100644
--- a/AI/Skirmish/KAIK/UnitHandler.cpp
+++ b/AI/Skirmish/KAIK/UnitHandler.cpp
@@ -146,7 +146,6 @@ void CUnitHandler::UnitCreated(int unitID) {
builderTracker->taskPlanId = 0;
builderTracker->factoryId = 0;
builderTracker->stuckCount = 0;
- builderTracker->customOrderId = 0;
// under construction
builderTracker->commandOrderPushFrame = -2;
builderTracker->categoryMaker = CAT_LAST;
@@ -278,7 +277,7 @@ bool CUnitHandler::VerifyOrder(BuilderTracker* builderTracker) {
bool commandFound = false;
bool hit = false;
- if (mycommands->size() > 0) {
+ if (!mycommands->empty()) {
// it has orders
const Command* c = &mycommands->front();
@@ -328,16 +327,9 @@ bool CUnitHandler::VerifyOrder(BuilderTracker* builderTracker) {
return false;
}
- if (builderTracker->customOrderId != 0) {
- assert(!hit);
+ if (!commandFound) {
hit = true;
- // CMD_MOVE is for human control stuff, CMD_REPAIR is for repairs of just made stuff
- // CMD_GUARD... ?
- if (c->id == CMD_RECLAIM || c->id == CMD_MOVE || c->id == CMD_REPAIR)
- commandFound = true;
- else {
- return false;
- }
+ commandFound = (c->id == CMD_RECLAIM || c->id == CMD_MOVE || c->id == CMD_REPAIR);
}
if (hit && commandFound) {
@@ -430,22 +422,9 @@ void CUnitHandler::ClearOrder(BuilderTracker* builderTracker, bool reportError)
FactoryBuilderRemove(builderTracker);
}
- if (builderTracker->customOrderId != 0) {
- assert(!hit);
- hit = true;
- // why is this builder idle?
- // no tracking of custom orders yet
- //SNPRINTF(logMsg, logMsg_maxSize,
- // "builder %i: was idle, but it is on customOrderId: %i (removing the builder from the job)",
- // unit, builderTracker->customOrderId);
- //PRINTF("%s", logMsg);
- builderTracker->customOrderId = 0;
- }
-
assert(builderTracker->buildTaskId == 0);
assert(builderTracker->taskPlanId == 0);
assert(builderTracker->factoryId == 0);
- assert(builderTracker->customOrderId == 0);
}
@@ -538,11 +517,7 @@ void CUnitHandler::DecodeOrder(BuilderTracker* builderTracker, bool reportError)
hit = true;
FactoryBuilderRemove(builderTracker);
}
- if (builderTracker->customOrderId != 0) {
- assert(!hit);
- hit = true;
- builderTracker->customOrderId = 0;
- }
+
BuildTask* bt = &*i;
BuildTaskAddBuilder(bt, builderTracker);
found = true;
@@ -550,7 +525,6 @@ void CUnitHandler::DecodeOrder(BuilderTracker* builderTracker, bool reportError)
}
if (!found) {
// not found, just make a custom order
- builderTracker->customOrderId = taskPlanCounter++;
builderTracker->idleStartFrame = -1;
}
}
@@ -738,9 +712,6 @@ void CUnitHandler::BuildTaskCreate(int id) {
if (builderTracker->factoryId != 0) {
FactoryBuilderRemove(builderTracker);
}
- if (builderTracker->customOrderId != 0) {
- builderTracker->customOrderId = 0;
- }
// this builder is now free
if (builderTracker->idleStartFrame == -2) {
@@ -832,8 +803,7 @@ void CUnitHandler::BuildTaskRemove(BuilderTracker* builderTracker) {
assert(builderTracker->buildTaskId != 0);
assert(builderTracker->taskPlanId == 0);
assert(builderTracker->factoryId == 0);
- assert(builderTracker->customOrderId == 0);
- // std::list<BuildTask>::iterator killtask;
+
bool found = false;
bool found2 = false;
@@ -877,7 +847,7 @@ void CUnitHandler::BuildTaskAddBuilder(BuildTask* buildTask, BuilderTracker* bui
assert(builderTracker->buildTaskId == 0);
assert(builderTracker->taskPlanId == 0);
assert(builderTracker->factoryId == 0);
- assert(builderTracker->customOrderId == 0);
+
builderTracker->buildTaskId = buildTask->id;
}
@@ -928,12 +898,11 @@ bool CUnitHandler::BuildTaskAddBuilder(int builderID, UnitCategory category) {
const bool b1 = (builderTracker->taskPlanId == 0);
const bool b2 = (builderTracker->buildTaskId == 0);
const bool b3 = (builderTracker->factoryId == 0);
- const bool b4 = (builderTracker->customOrderId == 0);
- const bool b5 = builderDef->canAssist;
- const bool b6 = (category == CAT_FACTORY && frame >= 18000);
+ const bool b4 = builderDef->canAssist;
+ const bool b5 = (category == CAT_FACTORY && frame >= 18000);
- if (!b1 || !b2 || !b3 || !b4 || !b5) {
- if (b6) {
+ if (!b1 || !b2 || !b3 || !b4) {
+ if (b5) {
// note that FactoryBuilderAdd() asserts b1 through b4
// immediately after BuildTaskAddBuilder() is tried and
// fails in BuildUp(), so at least those must be true
@@ -943,9 +912,10 @@ bool CUnitHandler::BuildTaskAddBuilder(int builderID, UnitCategory category) {
msg << "[CUnitHandler::BuildTaskAddBuilder()] frame " << frame << "\n";
msg << "\tbuilder " << builderID << " not able to be added to CAT_FACTORY build-task\n";
msg << "\tb1: " << b1 << ", b2: " << b2 << ", b3: " << b3;
- msg << ", b4: " << b4 << ", b5: " << b5 << ", b6: " << b6;
+ msg << ", b4: " << b4 << ", b5: " << b5;
L(ai, msg.str());
}
+
return false;
}
@@ -1006,7 +976,7 @@ bool CUnitHandler::BuildTaskAddBuilder(int builderID, UnitCategory category) {
}
}
- if (b6) {
+ if (b5) {
std::stringstream msg;
msg << "[CUnitHandler::BuildTaskAddBuilder()] frame " << frame << "\n";
msg << "\tno joinable CAT_FACTORY build-tasks or task-plans for builder " << builderID;
@@ -1031,15 +1001,11 @@ void CUnitHandler::TaskPlanCreate(int builder, float3 pos, const UnitDef* builtd
BuilderTracker* builderTracker = GetBuilderTracker(builder);
// make sure this builder is free
- // KLOOTNOTE: no longer use assertions
- // since new code for extractor upgrading
- // (in CBuildUp) seems to trigger them?
bool b1 = (builderTracker->taskPlanId == 0);
bool b2 = (builderTracker->buildTaskId == 0);
bool b3 = (builderTracker->factoryId == 0);
- bool b4 = (builderTracker->customOrderId == 0);
- if (!b1 || !b2 || !b3 || !b4) {
+ if (!b1 || !b2 || !b3) {
return;
}
@@ -1083,7 +1049,7 @@ void CUnitHandler::TaskPlanAdd(TaskPlan* taskPlan, BuilderTracker* builderTracke
assert(builderTracker->buildTaskId == 0);
assert(builderTracker->taskPlanId == 0);
assert(builderTracker->factoryId == 0);
- assert(builderTracker->customOrderId == 0);
+
builderTracker->taskPlanId = taskPlan->id;
}
@@ -1094,7 +1060,7 @@ void CUnitHandler::TaskPlanRemove(BuilderTracker* builderTracker) {
assert(builderTracker->buildTaskId == 0);
assert(builderTracker->taskPlanId != 0);
assert(builderTracker->factoryId == 0);
- assert(builderTracker->customOrderId == 0);
+
builderTracker->taskPlanId = 0;
int builder = builderTracker->builderID;
bool found = false;
@@ -1285,7 +1251,6 @@ bool CUnitHandler::FactoryBuilderAdd(BuilderTracker* builderTracker) {
assert(builderTracker->buildTaskId == 0);
assert(builderTracker->taskPlanId == 0);
assert(builderTracker->factoryId == 0);
- assert(builderTracker->customOrderId == 0);
for (std::list<Factory>::iterator i = Factories.begin(); i != Factories.end(); i++) {
CUNIT* u = ai->MyUnits[i->id];
@@ -1328,7 +1293,7 @@ void CUnitHandler::FactoryBuilderRemove(BuilderTracker* builderTracker) {
assert(builderTracker->buildTaskId == 0);
assert(builderTracker->taskPlanId == 0);
assert(builderTracker->factoryId != 0);
- assert(builderTracker->customOrderId == 0);
+
std::list<Factory>::iterator killfactory;
for (std::list<Factory>::iterator i = Factories.begin(); i != Factories.end(); i++) {
@@ -1351,9 +1316,8 @@ void CUnitHandler::BuilderReclaimOrder(int builderId, const float3&) {
assert(builderTracker->buildTaskId == 0);
assert(builderTracker->taskPlanId == 0);
assert(builderTracker->factoryId == 0);
- assert(builderTracker->customOrderId == 0);
- // Just use taskPlanCounter for the id.
- builderTracker->customOrderId = taskPlanCounter++;
+
+ taskPlanCounter++;
}
diff --git a/AI/Skirmish/KAIK/data/AIOptions.lua b/AI/Skirmish/KAIK/data/AIOptions.lua
index c9c1dac..d435d62 100644
--- a/AI/Skirmish/KAIK/data/AIOptions.lua
+++ b/AI/Skirmish/KAIK/data/AIOptions.lua
@@ -1,37 +1,15 @@
--
--- Custom Options Definition Table format
+-- Custom Options Definition Table format
--
--- NOTES:
--- - using an enumerated table lets you specify the options order
---
--- These keywords must be lowercase for LuaParser to read them.
---
--- key: the string used in the script.txt
--- name: the displayed name
--- desc: the description (could be used as a tooltip)
--- type: the option type
--- def: the default value;
--- min: minimum value for number options
--- max: maximum value for number options
--- step: quantization step, aligned to the def value
--- maxlen: the maximum string length for string options
--- items: array of item strings for list options
--- scope: 'all', 'player', 'team', 'allyteam' <<< not supported yet >>>
+-- A detailed example of how this format works can be found
+-- in the spring source under:
+-- AI/Skirmish/NullAI/data/AIOptions.lua
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local options = {
- {
- key="difficulty",
- name="AI Difficulty Level",
- desc="1 means, the AI plays very poor, 5 means, it gives its best",
- type = 'number',
- def = 3,
- min = 1,
- max = 5,
- step = 1,
- },
}
return options
+
diff --git a/AI/Skirmish/NullAI/data/AIOptions.lua b/AI/Skirmish/NullAI/data/AIOptions.lua
new file mode 100644
index 0000000..8d5fb79
--- /dev/null
+++ b/AI/Skirmish/NullAI/data/AIOptions.lua
@@ -0,0 +1,123 @@
+--
+-- Example AIOptions.lua
+--
+--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+-- Custom Options Definition Table format
+--
+-- NOTES:
+-- - using an enumerated table lets you specify the options order
+--
+-- These keywords must be lowercase for LuaParser to read them.
+--
+-- key: the string used in the script.txt
+-- name: the displayed name
+-- desc: the description (could be used as a tooltip)
+-- type: the option type (bool|number|string|list|section)
+-- section: can be used to group this option with others (optional)
+-- def: the default value
+-- min: minimum value for type=number options
+-- max: maximum value for type=number options
+-- step: quantization step, aligned to the def value
+-- maxlen: the maximum string length for type=string options
+-- items: array of item strings for type=list options
+-- scope: 'all', 'player', 'team', 'allyteam' <<< not supported yet >>>
+--
+-- This is an example file, show-casting all the possibilities of this format.
+-- It contains one example for option types bool, string and list, and two
+-- for number and section.
+--
+--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+
+local options = {
+
+
+ { -- section
+ key = 'cheats',
+ name = 'Cheats',
+ desc = 'Fine-Grained settings specifying which kind of cheats \nthe AI is allowed to use.',
+ type = 'section',
+ },
+
+ { -- section
+ key = 'performance',
+ name = 'Performance Relevant Settings',
+ desc = 'These settings may be relevant for both CPU usage and AI difficulty.',
+ type = 'section',
+ },
+
+ { -- list
+ key = 'aggressiveness',
+ name = 'Level Of Aggressivity',
+ desc = 'How aggressive the AI should act.\nkey: aggressiveness',
+ type = 'list',
+ section = 'performance',
+ def = 'normal',
+ items = {
+ {
+ key = 'deffensive',
+ name = 'Deffensive',
+ desc = 'The AI will hardly ever attack.',
+ },
+ {
+ key = 'normal',
+ name = 'Normal',
+ desc = 'The AI will try to keep a balance between defensive and aggressive play styles.',
+ },
+ {
+ key = 'aggressive',
+ name = 'Aggressive',
+ desc = 'The AI will put most of its resources into building attack forces.',
+ },
+ },
+ },
+
+ { -- number (decimal)
+ key = 'maxgroupsize',
+ name = 'Max Group Size',
+ desc = 'Maximum number of units per group, which the AI tries to keep together.\nkey: maxgroupsize',
+ type = 'number',
+ section = 'performance',
+ def = 10,
+ min = 2,
+ max = 50,
+ step = 1.0,
+ },
+
+ { -- number (float)
+ key = 'resourcebonous',
+ name = 'Resource Bonous',
+ desc = 'The AI will get 1+[this-value] times as muhc resources as a normal player.\nkey: resourcebonous',
+ type = 'number',
+ section = 'cheats',
+ def = 0.0,
+ min = 0.0,
+ max = 20.0,
+ -- quantization is aligned to the def value
+ -- (step <= 0) -> there is no quantization
+ step = 0.1,
+ },
+
+ { -- bool
+ key = 'maphack',
+ name = 'Map Hack',
+ desc = 'Whether the AI can see everything on the map, always, or is bount to LOS & Radar usage.\nkey: maphack',
+ type = 'bool',
+ section = 'cheats',
+ def = false,
+ },
+
+ { -- string
+ key = 'reporturl',
+ name = 'Report URL',
+ desc = 'Statistics and learning data will be sent ot this URL every 5 minutes.\nkey: reporturl',
+ type = 'string',
+ def = 'http://myAIStats.myDomain.com/statsReceiver.cgi',
+ },
+
+}
+
+return options
+
diff --git a/AI/Skirmish/NullJavaAI/data/AIOptions.lua b/AI/Skirmish/NullJavaAI/data/AIOptions.lua
index c9c1dac..d435d62 100644
--- a/AI/Skirmish/NullJavaAI/data/AIOptions.lua
+++ b/AI/Skirmish/NullJavaAI/data/AIOptions.lua
@@ -1,37 +1,15 @@
--
--- Custom Options Definition Table format
+-- Custom Options Definition Table format
--
--- NOTES:
--- - using an enumerated table lets you specify the options order
---
--- These keywords must be lowercase for LuaParser to read them.
---
--- key: the string used in the script.txt
--- name: the displayed name
--- desc: the description (could be used as a tooltip)
--- type: the option type
--- def: the default value;
--- min: minimum value for number options
--- max: maximum value for number options
--- step: quantization step, aligned to the def value
--- maxlen: the maximum string length for string options
--- items: array of item strings for list options
--- scope: 'all', 'player', 'team', 'allyteam' <<< not supported yet >>>
+-- A detailed example of how this format works can be found
+-- in the spring source under:
+-- AI/Skirmish/NullAI/data/AIOptions.lua
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local options = {
- {
- key="difficulty",
- name="AI Difficulty Level",
- desc="1 means, the AI plays very poor, 5 means, it gives its best",
- type = 'number',
- def = 3,
- min = 1,
- max = 5,
- step = 1,
- },
}
return options
+
diff --git a/AI/Skirmish/NullLegacyCppAI/data/AIOptions.lua b/AI/Skirmish/NullLegacyCppAI/data/AIOptions.lua
index c9c1dac..d435d62 100644
--- a/AI/Skirmish/NullLegacyCppAI/data/AIOptions.lua
+++ b/AI/Skirmish/NullLegacyCppAI/data/AIOptions.lua
@@ -1,37 +1,15 @@
--
--- Custom Options Definition Table format
+-- Custom Options Definition Table format
--
--- NOTES:
--- - using an enumerated table lets you specify the options order
---
--- These keywords must be lowercase for LuaParser to read them.
---
--- key: the string used in the script.txt
--- name: the displayed name
--- desc: the description (could be used as a tooltip)
--- type: the option type
--- def: the default value;
--- min: minimum value for number options
--- max: maximum value for number options
--- step: quantization step, aligned to the def value
--- maxlen: the maximum string length for string options
--- items: array of item strings for list options
--- scope: 'all', 'player', 'team', 'allyteam' <<< not supported yet >>>
+-- A detailed example of how this format works can be found
+-- in the spring source under:
+-- AI/Skirmish/NullAI/data/AIOptions.lua
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local options = {
- {
- key="difficulty",
- name="AI Difficulty Level",
- desc="1 means, the AI plays very poor, 5 means, it gives its best",
- type = 'number',
- def = 3,
- min = 1,
- max = 5,
- step = 1,
- },
}
return options
+
diff --git a/AI/Skirmish/NullOOJavaAI/data/AIOptions.lua b/AI/Skirmish/NullOOJavaAI/data/AIOptions.lua
index c9c1dac..d435d62 100644
--- a/AI/Skirmish/NullOOJavaAI/data/AIOptions.lua
+++ b/AI/Skirmish/NullOOJavaAI/data/AIOptions.lua
@@ -1,37 +1,15 @@
--
--- Custom Options Definition Table format
+-- Custom Options Definition Table format
--
--- NOTES:
--- - using an enumerated table lets you specify the options order
---
--- These keywords must be lowercase for LuaParser to read them.
---
--- key: the string used in the script.txt
--- name: the displayed name
--- desc: the description (could be used as a tooltip)
--- type: the option type
--- def: the default value;
--- min: minimum value for number options
--- max: maximum value for number options
--- step: quantization step, aligned to the def value
--- maxlen: the maximum string length for string options
--- items: array of item strings for list options
--- scope: 'all', 'player', 'team', 'allyteam' <<< not supported yet >>>
+-- A detailed example of how this format works can be found
+-- in the spring source under:
+-- AI/Skirmish/NullAI/data/AIOptions.lua
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local options = {
- {
- key="difficulty",
- name="AI Difficulty Level",
- desc="1 means, the AI plays very poor, 5 means, it gives its best",
- type = 'number',
- def = 3,
- min = 1,
- max = 5,
- step = 1,
- },
}
return options
+
diff --git a/AI/Skirmish/RAI/data/AIOptions.lua b/AI/Skirmish/RAI/data/AIOptions.lua
index c9c1dac..d435d62 100644
--- a/AI/Skirmish/RAI/data/AIOptions.lua
+++ b/AI/Skirmish/RAI/data/AIOptions.lua
@@ -1,37 +1,15 @@
--
--- Custom Options Definition Table format
+-- Custom Options Definition Table format
--
--- NOTES:
--- - using an enumerated table lets you specify the options order
---
--- These keywords must be lowercase for LuaParser to read them.
---
--- key: the string used in the script.txt
--- name: the displayed name
--- desc: the description (could be used as a tooltip)
--- type: the option type
--- def: the default value;
--- min: minimum value for number options
--- max: maximum value for number options
--- step: quantization step, aligned to the def value
--- maxlen: the maximum string length for string options
--- items: array of item strings for list options
--- scope: 'all', 'player', 'team', 'allyteam' <<< not supported yet >>>
+-- A detailed example of how this format works can be found
+-- in the spring source under:
+-- AI/Skirmish/NullAI/data/AIOptions.lua
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local options = {
- {
- key="difficulty",
- name="AI Difficulty Level",
- desc="1 means, the AI plays very poor, 5 means, it gives its best",
- type = 'number',
- def = 3,
- min = 1,
- max = 5,
- step = 1,
- },
}
return options
+
diff --git a/Documentation/changelog.txt b/Documentation/changelog.txt
index ffe3c3b..5b6e077 100644
--- a/Documentation/changelog.txt
+++ b/Documentation/changelog.txt
@@ -1,4 +1,10 @@
Spring change log
+0.80.5.1:
+Bugfixes:
+ - fix a bug where empty network packets were spammed (eating bandwith and demo space)
+ - fix a possible desync in the pathfinder
+ - fix mouse jumping in windowed mode (windows)
+ - fixed crash in KAIK
0.80.5:
Bugfixes:
@@ -11,7 +17,7 @@ Bugfixes:
Gui:
- joystick support
- some bugs resolved which could lead to crashes when using ogg samples or music
- - properly hande dds textures
+ - properly handle dds textures
- fix some mouse-jumping in windows
Sim:
diff --git a/rts/Game/Camera.cpp b/rts/Game/Camera.cpp
index c286ad8..0eab778 100644
--- a/rts/Game/Camera.cpp
+++ b/rts/Game/Camera.cpp
@@ -148,7 +148,10 @@ static bool CalculateInverse4x4(const double m[4][4], double inv[4][4])
void CCamera::Update(bool freeze)
{
pos2 = pos;
- up.UnsafeANormalize();
+
+ up.x = 0.0f;
+ up.y = 1.0f;
+ up.z = 0.0f;
right = forward.cross(up);
right.UnsafeANormalize();
diff --git a/rts/Game/Camera.h b/rts/Game/Camera.h
index 38d0f25..f42ca61 100644
--- a/rts/Game/Camera.h
+++ b/rts/Game/Camera.h
@@ -24,13 +24,6 @@ public:
void Roll(float rad);
void Pitch(float rad);
- void RestoreUp()
- {
- up.x = 0.0f;
- up.y = 1.0f;
- up.z = 0.0f;
- };
-
float3 pos;
float3 pos2; //use this for calculating orthodirections (might differ from pos when calcing shadows)
float3 rot; //varning inte alltid uppdaterad
diff --git a/rts/Game/Camera/FPSController.cpp b/rts/Game/Camera/FPSController.cpp
index ce3d9ea..71d2054 100644
--- a/rts/Game/Camera/FPSController.cpp
+++ b/rts/Game/Camera/FPSController.cpp
@@ -39,7 +39,6 @@ void CFPSController::MouseMove(float3 move)
{
camera->rot.y -= mouseScale*move.x;
camera->rot.x -= mouseScale*move.y*move.z;
- camera->RestoreUp();
if(camera->rot.x>PI*0.4999f)
camera->rot.x=PI*0.4999f;
if(camera->rot.x<-PI*0.4999f)
diff --git a/rts/Game/Camera/FreeController.cpp b/rts/Game/Camera/FreeController.cpp
index c009150..958601f 100644
--- a/rts/Game/Camera/FreeController.cpp
+++ b/rts/Game/Camera/FreeController.cpp
@@ -94,8 +94,6 @@ void CFreeController::SetTrackingInfo(const float3& target, float radius)
void CFreeController::Update()
{
- camera->RestoreUp();
-
if (!gu->active) {
vel = ZeroVector;
avel = ZeroVector;
diff --git a/rts/Game/Camera/OverheadController.cpp b/rts/Game/Camera/OverheadController.cpp
index 1b97015..5e54a07 100644
--- a/rts/Game/Camera/OverheadController.cpp
+++ b/rts/Game/Camera/OverheadController.cpp
@@ -114,7 +114,6 @@ void COverheadController::MouseWheelMove(float move)
void COverheadController::Update()
{
- camera->RestoreUp();
}
float3 COverheadController::GetPos()
diff --git a/rts/Game/Camera/RotOverheadController.cpp b/rts/Game/Camera/RotOverheadController.cpp
index af4ad01..92fb7da 100644
--- a/rts/Game/Camera/RotOverheadController.cpp
+++ b/rts/Game/Camera/RotOverheadController.cpp
@@ -61,7 +61,6 @@ void CRotOverheadController::MouseWheelMove(float move)
void CRotOverheadController::Update()
{
- camera->RestoreUp();
}
float3 CRotOverheadController::GetPos()
diff --git a/rts/Game/Camera/SmoothController.cpp b/rts/Game/Camera/SmoothController.cpp
index b8bd6d7..83889e5 100644
--- a/rts/Game/Camera/SmoothController.cpp
+++ b/rts/Game/Camera/SmoothController.cpp
@@ -164,7 +164,6 @@ void SmoothController::MouseWheelMove(float move)
void SmoothController::Update()
{
- camera->RestoreUp();
}
float3 SmoothController::GetPos()
diff --git a/rts/Game/Camera/TWController.cpp b/rts/Game/Camera/TWController.cpp
index 2632814..834d340 100644
--- a/rts/Game/Camera/TWController.cpp
+++ b/rts/Game/Camera/TWController.cpp
@@ -66,7 +66,6 @@ void CTWController::MouseWheelMove(float move)
void CTWController::Update()
{
- camera->RestoreUp();
}
float3 CTWController::GetPos()
diff --git a/rts/Game/GameServer.cpp b/rts/Game/GameServer.cpp
index faa8afd..1c1d03a 100644
--- a/rts/Game/GameServer.cpp
+++ b/rts/Game/GameServer.cpp
@@ -706,8 +706,7 @@ void CGameServer::ProcessPacket(const unsigned playernum, boost::shared_ptr<cons
case NETMSG_QUIT: {
Message(str(format(PlayerLeft) %players[a].GetType() %players[a].name %" normal quit"));
Broadcast(CBaseNetProtocol::Get().SendPlayerLeft(a, 1));
- players[a].myState = GameParticipant::DISCONNECTED;
- players[a].link.reset();
+ players[a].Kill();
if (hostif)
{
hostif->SendPlayerLeft(a, 1);
@@ -1266,9 +1265,8 @@ void CGameServer::ServerReadNet()
if (players[a].link->CheckTimeout())
{
Message(str(format(PlayerLeft) %players[a].GetType() %players[a].name %" timeout")); //this must happen BEFORE the reset!
- players[a].myState = GameParticipant::DISCONNECTED;
- players[a].link.reset();
Broadcast(CBaseNetProtocol::Get().SendPlayerLeft(a, 0));
+ players[a].Kill();
if (hostif)
{
hostif->SendPlayerLeft(a, 0);
diff --git a/rts/Game/GameVersion.cpp b/rts/Game/GameVersion.cpp
index f8fae13..041d0d0 100644
--- a/rts/Game/GameVersion.cpp
+++ b/rts/Game/GameVersion.cpp
@@ -16,7 +16,7 @@ namespace SpringVersion
const char* const Major = "0.80";
const char* const Minor = "5";
-const char* const Patchset = "0";
+const char* const Patchset = "1";
const char* const Additional = "";
/** Build date and time. */
diff --git a/rts/Game/SelectMenu.cpp b/rts/Game/SelectMenu.cpp
index 6e5735a..64a3ac7 100644
--- a/rts/Game/SelectMenu.cpp
+++ b/rts/Game/SelectMenu.cpp
@@ -306,15 +306,8 @@ bool SelectMenu::HandleEventSelf(const SDL_Event& ev)
case SDL_KEYDOWN: {
if (ev.key.keysym.sym == SDLK_ESCAPE)
{
- if(keys[SDLK_LSHIFT])
- {
- logOutput.Print("User exited");
- globalQuit=true;
- }
- else
- {
- logOutput.Print("Use shift-esc to quit");
- }
+ logOutput.Print("User exited");
+ globalQuit=true;
}
else if (ev.key.keysym.sym == SDLK_RETURN)
{
diff --git a/rts/Game/UI/MouseHandler.cpp b/rts/Game/UI/MouseHandler.cpp
index 58b23f6..6084d54 100644
--- a/rts/Game/UI/MouseHandler.cpp
+++ b/rts/Game/UI/MouseHandler.cpp
@@ -689,7 +689,6 @@ void CMouseHandler::ToggleState()
if (locked) {
locked = false;
ShowMouse();
- mouseInput->SetPos(int2(lastx, lasty)); //! workarounds a mouse jump caused by the combination of SDL_WM_GrabInput (done in wsdl) + SDL_ShowCursor
} else {
locked = true;
HideMouse();
diff --git a/rts/Sim/Path/PathFinder.cpp b/rts/Sim/Path/PathFinder.cpp
index bbb5ae3..ee0bab1 100644
--- a/rts/Sim/Path/PathFinder.cpp
+++ b/rts/Sim/Path/PathFinder.cpp
@@ -686,7 +686,7 @@ void CPathFinder::InitHeatMap()
{
heatmap.resize(gs->mapx);
for (int i = 0; i<gs->mapx; ++i) {
- heatmap[i].resize(gs->mapy);
+ heatmap[i].resize(gs->mapy, HeatMapValue());
}
heatMapOffset = 0;
}
diff --git a/rts/Sim/Path/PathFinder.h b/rts/Sim/Path/PathFinder.h
index 5f9449b..5e8cf03 100644
--- a/rts/Sim/Path/PathFinder.h
+++ b/rts/Sim/Path/PathFinder.h
@@ -216,6 +216,8 @@ private:
// Heat mapping
struct HeatMapValue {
+ HeatMapValue(): value(0), ownerId(0) {
+ }
int value;
int ownerId;
};
diff --git a/rts/System/Net/UDPConnection.cpp b/rts/System/Net/UDPConnection.cpp
index 9417dbb..0740b05 100644
--- a/rts/System/Net/UDPConnection.cpp
+++ b/rts/System/Net/UDPConnection.cpp
@@ -47,12 +47,12 @@ public:
unsigned Remaining() const
{
- return length - pos;
+ return length - std::min(pos, length);
};
private:
const unsigned char* data;
unsigned length;
- size_t pos;
+ unsigned pos;
};
class Packer
@@ -87,10 +87,13 @@ Packet::Packet(const unsigned char* data, unsigned length)
if (nakType > 0)
{
- naks.resize(nakType);
+ naks.reserve(nakType);
for (int i = 0; i != nakType; ++i)
{
- buf.Unpack(naks[i]);
+ if (buf.Remaining() >= sizeof(naks[i]))
+ buf.Unpack(naks[i]);
+ else
+ break;
}
}
@@ -515,7 +518,7 @@ void UDPConnection::SendIfNecessary(bool flushed)
lastUnackResent = curTime;
}
- if (flushed || !newChunks.empty() || !resendRequested.empty() || nak < 0 || lastSendTime + spring_msecs(200) < curTime)
+ if (flushed || !newChunks.empty() || !resendRequested.empty() || nak > 0 || lastSendTime + spring_msecs(200) < curTime)
{
bool todo = true;
while (todo)
diff --git a/rts/System/Net/UDPListener.cpp b/rts/System/Net/UDPListener.cpp
index fa1687c..63b4cb1 100644
--- a/rts/System/Net/UDPListener.cpp
+++ b/rts/System/Net/UDPListener.cpp
@@ -22,7 +22,6 @@
#include "ProtocolDef.h"
#include "UDPConnection.h"
#include "Socket.h"
-#include "LogOutput.h"
namespace netcode
{
@@ -81,7 +80,7 @@ void UDPListener::Update()
if (bytesReceived < Packet::headerSize)
continue;
- Packet data(&buffer[0], buffer.size());
+ Packet data(&buffer[0], bytesReceived);
bool processed = false;
for (std::list< boost::weak_ptr<UDPConnection> >::iterator i = conn.begin(); i != conn.end(); ++i)
diff --git a/rts/System/Platform/Win/wsdl.cpp b/rts/System/Platform/Win/wsdl.cpp
index a4f3ad3..6983b37 100644
--- a/rts/System/Platform/Win/wsdl.cpp
+++ b/rts/System/Platform/Win/wsdl.cpp
@@ -285,10 +285,11 @@ LRESULT OnMouseButton(HWND hWnd, UINT uMsg, int client_x, int client_y, UINT fla
oldMode = SDL_WM_GrabInput(SDL_GRAB_QUERY);
saveMode = true;
}
-#ifndef DEBUG
+
+ POINT pt;
+ GetCursorPos(&pt); //! SDL_WM_GrabInput sometimes moves the cursor, so we have to reset it afterwards
SDL_WM_GrabInput(SDL_GRAB_ON);
- //SetCursorPos(screen_pt.x, screen_pt.y);
-#endif
+ SetCursorPos(pt.x, pt.y);
}
} else {
//! release after all up events received
@@ -296,8 +297,10 @@ LRESULT OnMouseButton(HWND hWnd, UINT uMsg, int client_x, int client_y, UINT fla
{
if (saveMode)
{
+ POINT pt;
+ GetCursorPos(&pt); //! SDL_WM_GrabInput sometimes moves the cursor, so we have to reset it afterwards
SDL_WM_GrabInput(oldMode);
- //SetCursorPos(screen_pt.x, screen_pt.y);
+ SetCursorPos(pt.x, pt.y);
saveMode = false;
}
outstanding_press_events = 0;
diff --git a/rts/aGui/Window.cpp b/rts/aGui/Window.cpp
index d0a062d..f12a841 100644
--- a/rts/aGui/Window.cpp
+++ b/rts/aGui/Window.cpp
@@ -85,7 +85,10 @@ bool Window::HandleEventSelf(const SDL_Event& ev)
}
case SDL_KEYDOWN: {
if (ev.key.keysym.sym == SDLK_ESCAPE)
+ {
WantClose();
+ return true;
+ }
break;
}
}
diff --git a/rts/build/scons/rts.py b/rts/build/scons/rts.py
index ae67c38..1c2b885 100644
--- a/rts/build/scons/rts.py
+++ b/rts/build/scons/rts.py
@@ -452,6 +452,8 @@ def generate(env):
else:
print 'Precompiled header disabled'
+ spring_defines += ['_WIN32_WINNT=0x500']
+
# gml library
if env['gml']:
env.AppendUnique(CCFLAGS = ['-mno-tls-direct-seg-refs'], CXXFLAGS = ['-mno-tls-direct-seg-refs'], LINKFLAGS = ['-mno-tls-direct-seg-refs'])
diff --git a/rts/lib/liblobby/Connection.cpp b/rts/lib/liblobby/Connection.cpp
index 5af2732..d952eea 100644
--- a/rts/lib/liblobby/Connection.cpp
+++ b/rts/lib/liblobby/Connection.cpp
@@ -1,5 +1,5 @@
#ifdef _MSC_VER
-#include "StdAfx.h"
+#include "lib/streflop/streflop_cond.h"
#endif
#include "Connection.h"
@@ -7,21 +7,23 @@
#include <boost/asio.hpp>
#include <boost/bind.hpp>
+
#if BOOST_VERSION < 103600
using namespace boost::system::posix_error;
#else
using namespace boost::system::errc;
#endif
-
+using namespace boost::asio;
boost::asio::io_service netservice;
-
Connection::Connection() : sock(netservice)
{
}
Connection::~Connection()
{
+ sock.close();
+ netservice.poll();
}
void Connection::Connect(const std::string& server, int port)
@@ -36,12 +38,17 @@ void Connection::Connect(const std::string& server, int port)
std::ostringstream portbuf;
portbuf << port;
ip::tcp::resolver::query query(server, portbuf.str());
- ip::tcp::resolver::iterator iter = resolver.resolve(query);
+ ip::tcp::resolver::iterator iter = resolver.resolve(query, err);
+ if (err)
+ {
+ DoneConnecting(false, err.message());
+ return;
+ }
tempAddr = iter->endpoint().address();
}
ip::tcp::endpoint serverep(tempAddr, port);
- sock.async_connect(serverep, boost::bind(&Connection::ConnectCallback, this, _1));
+ sock.async_connect(serverep, boost::bind(&Connection::ConnectCallback, this, placeholders::error));
}
void Connection::SendData(const std::string& msg)
@@ -65,7 +72,7 @@ void Connection::ConnectCallback(const boost::system::error_code& error)
if (!error)
{
DoneConnecting(true, "");
- boost::asio::async_read_until(sock, incomeBuffer, "\n", boost::bind(&Connection::ReceiveCallback, this, _1, _2));
+ boost::asio::async_read_until(sock, incomeBuffer, "\n", boost::bind(&Connection::ReceiveCallback, this, placeholders::error, placeholders::bytes_transferred));
}
else
{
@@ -88,7 +95,7 @@ void Connection::ReceiveCallback(const boost::system::error_code& error, size_t
}
else
{
- if (error.value() == connection_reset || error.value() == boost::asio::error::eof )
+ if (error.value() == connection_reset || error.value() == boost::asio::error::eof)
{
sock.close();
Disconnected();
@@ -100,7 +107,7 @@ void Connection::ReceiveCallback(const boost::system::error_code& error, size_t
}
if (sock.is_open())
{
- boost::asio::async_read_until(sock, incomeBuffer, "\n", boost::bind(&Connection::ReceiveCallback, this, _1, _2));
+ boost::asio::async_read_until(sock, incomeBuffer, "\n", boost::bind(&Connection::ReceiveCallback, this, placeholders::error, placeholders::bytes_transferred));
}
}
--
advanced 3D real time strategy game engine
More information about the Pkg-games-commits
mailing list