Finished Custom Game 'Opponents' selection (reduce only!)
This commit is contained in:
parent
ac16892bae
commit
a94be38288
4 changed files with 33 additions and 24 deletions
src
|
@ -62,6 +62,14 @@
|
|||
#define MapActionRocks 0xFFFD /// rocks on map
|
||||
#define MapActionForest 0xFFFE /// forest on map
|
||||
|
||||
// These are hard-coded PUD internals (and, as such, belong here!)
|
||||
#define WC_UnitPeasant 0x02 /// Human Peasant
|
||||
#define WC_UnitPeon 0x03 /// Orc Peon
|
||||
#define WC_UnitGoldMine 0x5C /// Goldmine
|
||||
#define WC_UnitOilPatch 0x5D /// Oilpatch
|
||||
#define WC_StartLocationHuman 0x5E /// Start location Human
|
||||
#define WC_StartLocationOrc 0x5F /// Start location Orc
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Declarations
|
||||
----------------------------------------------------------------------------*/
|
||||
|
|
|
@ -200,21 +200,9 @@ struct _unit_type_ {
|
|||
};
|
||||
|
||||
/// How many unit types are currently supported.
|
||||
/// FIXME: ARI: should be dynamic (ccl..)
|
||||
#define UnitTypeInternalMax 0x74
|
||||
|
||||
/// Human Peasant (for pud use only)
|
||||
#define WC_UnitPeasant 0x02
|
||||
/// Orc Peon (for pud use only)
|
||||
#define WC_UnitPeon 0x03
|
||||
/// Goldmine (for pud use only)
|
||||
#define WC_UnitGoldMine 0x5C
|
||||
/// Oilpatch (for pud use only)
|
||||
#define WC_UnitOilPatch 0x5D
|
||||
/// Start location unit type number in puds.
|
||||
#define WC_StartLocationHuman 0x5E
|
||||
/// Start location unit type number in puds.
|
||||
#define WC_StartLocationOrc 0x5F
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
|
|
@ -92,6 +92,7 @@ global void CreatePlayer(char* name,int type)
|
|||
|
||||
// Allocate memory for the "list" of this player's units.
|
||||
// FIXME: brutal way, as we won't need MAX_UNITS for this player...
|
||||
// FIXME: ARI: is this needed for 'PlayerNobody' ??
|
||||
if( !(player->Units=(Unit**)calloc(MAX_UNITS,sizeof(Unit*))) ) {
|
||||
DebugLevel0("Not enough memory to create player %d.\n",NumPlayers);
|
||||
return;
|
||||
|
|
|
@ -714,6 +714,7 @@ global void LoadPud(const char* pud,WorldMap* map)
|
|||
char buf[1024];
|
||||
int width;
|
||||
int height;
|
||||
int aiopps;
|
||||
|
||||
if( !(input=CLopen(pud)) ) {
|
||||
fprintf(stderr,"Try ./path/name\n");
|
||||
|
@ -739,7 +740,7 @@ global void LoadPud(const char* pud,WorldMap* map)
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
width=height=0;
|
||||
aiopps=width=height=0;
|
||||
|
||||
//
|
||||
// Parse all sections.
|
||||
|
@ -785,6 +786,15 @@ global void LoadPud(const char* pud,WorldMap* map)
|
|||
|
||||
for( i=0; i<16; ++i ) {
|
||||
p=PudReadByte(input);
|
||||
if (GameSettings.Opponents != SettingsPresetMapDefault) {
|
||||
if (p == PlayerComputer) {
|
||||
if (aiopps < GameSettings.Opponents) {
|
||||
aiopps++;
|
||||
} else {
|
||||
p = PlayerNobody;
|
||||
}
|
||||
}
|
||||
}
|
||||
CreatePlayer("Computer",p);
|
||||
}
|
||||
continue;
|
||||
|
@ -1137,7 +1147,7 @@ global void LoadPud(const char* pud,WorldMap* map)
|
|||
|
||||
Players[o].X=MapOffsetX+x;
|
||||
Players[o].Y=MapOffsetY+y;
|
||||
if (GameSettings.NumUnits == SettingsNumUnits1) {
|
||||
if (GameSettings.NumUnits == SettingsNumUnits1 && Players[o].Type != PlayerNobody) {
|
||||
if (t == WC_StartLocationHuman) {
|
||||
t = WC_UnitPeasant;
|
||||
} else {
|
||||
|
@ -1146,7 +1156,7 @@ global void LoadPud(const char* pud,WorldMap* map)
|
|||
v = 1;
|
||||
goto pawn;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (GameSettings.NumUnits == SettingsNumUnitsMapDefault ||
|
||||
t == WC_UnitGoldMine || t == WC_UnitOilPatch) {
|
||||
pawn:
|
||||
|
@ -1158,17 +1168,19 @@ pawn:
|
|||
if (s == PlayerRaceOrc && (t & 1) == 0) {
|
||||
t++;
|
||||
}
|
||||
// FIXME: This is hard-coded WAR2 ... also: support more races?
|
||||
// FIXME: ARI: This is hard-coded WAR2 ... also: support more races?
|
||||
}
|
||||
}
|
||||
unit=MakeUnitAndPlace(MapOffsetX+x,MapOffsetY+y
|
||||
,UnitTypeByWcNum(t),&Players[o]);
|
||||
if( unit->Type->GoldMine || unit->Type->OilPatch ) {
|
||||
unit->Value=v*2500;
|
||||
} else {
|
||||
// FIXME: active/inactive AI units!!
|
||||
if (Players[o].Type != PlayerNobody) {
|
||||
unit=MakeUnitAndPlace(MapOffsetX+x,MapOffsetY+y
|
||||
,UnitTypeByWcNum(t),&Players[o]);
|
||||
if( unit->Type->GoldMine || unit->Type->OilPatch ) {
|
||||
unit->Value=v*2500;
|
||||
} else {
|
||||
// FIXME: active/inactive AI units!!
|
||||
}
|
||||
UpdateForNewUnit(unit,0);
|
||||
}
|
||||
UpdateForNewUnit(unit,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue