1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Draft of new Event conditions

This commit is contained in:
AlexVinS
2016-02-22 23:43:57 +03:00
parent dc5ad7d7b3
commit 4bcfb8c27d
5 changed files with 46 additions and 14 deletions

View File

@@ -98,6 +98,7 @@ struct DLL_LINKAGE PlayerInfo
struct DLL_LINKAGE EventCondition
{
enum EWinLoseType {
//internal use, deprecated
HAVE_ARTIFACT, // type - required artifact
HAVE_CREATURES, // type - creatures to collect, value - amount to collect
HAVE_RESOURCES, // type - resource ID, value - amount to collect
@@ -105,19 +106,28 @@ struct DLL_LINKAGE EventCondition
CONTROL, // position - position of object, optional, type - type of object
DESTROY, // position - position of object, optional, type - type of object
TRANSPORT, // position - where artifact should be transported, type - type of artifact
//map format version pre 1.0
DAYS_PASSED, // value - number of days from start of the game
IS_HUMAN, // value - 0 = player is AI, 1 = player is human
DAYS_WITHOUT_TOWN, // value - how long player can live without town, 0=instakill
STANDARD_WIN, // normal defeat all enemies condition
CONST_VALUE // condition that always evaluates to "value" (0 = false, 1 = true)
CONST_VALUE, // condition that always evaluates to "value" (0 = false, 1 = true)
//map format version 1.0+
HAVE_0,
HAVE_BUILDING_0,
DESTROY_0
};
EventCondition(EWinLoseType condition = STANDARD_WIN);
EventCondition(EWinLoseType condition, si32 value, si32 objectType, int3 position = int3(-1, -1, -1));
const CGObjectInstance * object; // object that was at specified position on start
const CGObjectInstance * object; // object that was at specified position or with instance name on start
si32 value;
si32 objectType;
si32 objectSubtype;
std::string objectInstanceName;
int3 position;
EWinLoseType condition;
@@ -129,6 +139,11 @@ struct DLL_LINKAGE EventCondition
h & objectType;
h & position;
h & condition;
if(version > 759)
{
h & objectSubtype;
h & objectInstanceName;
}
}
};