General Tso
Panzer General
These questions are all concerned with using Unit
ushMission from within Lua. First question: are the values required for the passed variable "flags" available in Lua? I couldn't find them. I found this mess in CvAStar.h
I manually copied the values over to Lua and some of them seems to work the way they should. Is there some way to use these values in Lua in the same way that most other things are done (GameDefines, GameInfo etc.)? I can keep using my current method but I'm uncomfortable with the fact that future changes within the dll could cause problems. My other question in regards to these values is: Since Lua doesn't have a Bitwise Or, can I just add these values together to get the same result (sorry for the basic question - it's been a lot of years since I last went to math class
). So basically since these are single bit values, if I use something like (MOVE_ANY_ROUTE + MOVE_IGNORE_STACKING) would that be the same as (MOVE_ANY_ROUTE | MOVE_IGNORE_STACKING)?
Next up is a question about the passed variable "missionAI" (again for PushMission). It looks like it takes an Enum value that's defined in CvEnums.h but I can't find it anywhere in Lua. So again I manually created the values. Am I missing something - are they available to Lua? One other basic question. Here's the Enum for missionAI:
If I need to manually assign the values would it be correct to assume that MISSIONAI_SHADOW = 0, MISSIONAI_GROUP = 1, MISSIONAI_LOAD_ASSAULT = 2, ....

Code:
// PATHFINDER FLAGS
// WARNING: Some of these flags are passed into the unit mission and stored in the missions iFlags member.
// Because the mission's iFlags are sharing space with the pathfinder flags, we currently have mission
// modifier flags listed below that really don't have anything to do with the pathfinder.
// A fix for this would be to have the mission contain separate pathfinder and modifier flags.
// These flags determine plots that can be entered
#define MOVE_TERRITORY_NO_UNEXPLORED (0x00000001)
#define MOVE_TERRITORY_NO_ENEMY (0x00000002)
#define MOVE_IGNORE_STACKING (0x00000004)
// These two tell about presence of enemy units
#define MOVE_UNITS_IGNORE_DANGER (0x00000008)
#define MOVE_UNITS_THROUGH_ENEMY (0x00000010)
// Used for human player movement
#define MOVE_DECLARE_WAR (0x00000020)
// Used for AI group attacks (??). Not really a pathfinder flag
#define MISSION_MODIFIER_DIRECT_ATTACK (0x00000040)
#define MISSION_MODIFIER_NO_DEFENSIVE_SUPPORT (0x00000100)
#define MOVE_MAXIMIZE_EXPLORE (0x00000080)
//
// Used for route information
#define MOVE_ANY_ROUTE (0x80000000) // because we're passing in the player number as well as the route flag
#define MOVE_ROUTE_ALLOW_UNEXPLORED (0x40000000) // When searching for a route, allow the search to use unrevealed plots
//#define MOVE_NON_WAR_ROUTE // we're passing the player id and other flags in as well. This flag checks to see if it can get from point to point without going into territory with a team we're at war with
I manually copied the values over to Lua and some of them seems to work the way they should. Is there some way to use these values in Lua in the same way that most other things are done (GameDefines, GameInfo etc.)? I can keep using my current method but I'm uncomfortable with the fact that future changes within the dll could cause problems. My other question in regards to these values is: Since Lua doesn't have a Bitwise Or, can I just add these values together to get the same result (sorry for the basic question - it's been a lot of years since I last went to math class

Next up is a question about the passed variable "missionAI" (again for PushMission). It looks like it takes an Enum value that's defined in CvEnums.h but I can't find it anywhere in Lua. So again I manually created the values. Am I missing something - are they available to Lua? One other basic question. Here's the Enum for missionAI:
Code:
enum MissionAITypes
{
NO_MISSIONAI = -1,
MISSIONAI_SHADOW,
MISSIONAI_GROUP,
MISSIONAI_LOAD_ASSAULT,
MISSIONAI_LOAD_SETTLER,
MISSIONAI_LOAD_SPECIAL,
MISSIONAI_GUARD_CITY,
MISSIONAI_GUARD_RESOURCE,
MISSIONAI_GUARD_TRADE_NET,
MISSIONAI_GUARD_SPY,
MISSIONAI_ATTACK_SPY,
MISSIONAI_SPREAD,
MISSIONAI_CONSTRUCT,
MISSIONAI_HURRY,
MISSIONAI_GREAT_WORK,
MISSIONAI_EXPLORE,
MISSIONAI_BLOCKADE,
MISSIONAI_PILLAGE,
MISSIONAI_FOUND,
MISSIONAI_BUILD,
MISSIONAI_ASSAULT,
MISSIONAI_CARRIER,
MISSIONAI_PICKUP,
NUM_MISSIONAI_TYPES
};
If I need to manually assign the values would it be correct to assume that MISSIONAI_SHADOW = 0, MISSIONAI_GROUP = 1, MISSIONAI_LOAD_ASSAULT = 2, ....