 |
|  |
 |
|
Solver
|
|
Apolyton Duke Of Something
|
 |
Latvia, Riga
Sep 2000 time: 07:34
|
|
I would like some help from those who have dealt more with the source. I've taken, as an example, the code for bombarding a tile.
code:
void SelectedItem::Bombard(const MapPoint &pnt)
{
PLAYER_INDEX player = GetVisiblePlayer();
if(m_select_state[player] == SELECT_TYPE_LOCAL_ARMY ) {
g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_BombardOrder,
GEA_Army, m_selected_army[player],
GEA_MapPoint, pnt,
GEA_End);
}
}
There's separate code for executing the bombardment, counting the damage, etc., understanable things. However, can anyone enlighten me as to how to properly use that g_gevManager properly? Its class is GameEventManager, and I can see several different classes that do with it, like GameEvent, GameEventArgList, etc.
Any information on those classes would be much appreciated.
|
|
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:34
|
|
For testing a unit flag you can write a slic handler I have here something:
This goes into your ..\ctp2_data\default\gamedata\scenario.slc:
code:
int_t int0;
int_t int1;
int_t int2;
int_t int3;
int_t int4;
int_t int5;
int_t int6;
int_t int7;
int_t int8;
int_t int9;
int_t int10;
int_t int11;
int_t int12;
int_t int13;
int_t int14;
int_t int15;
int_t int16;
int_t int17;
int_t int18;
int_t int19;
int_t int20;
int_t int21;
int_t int22;
int_t int23;
int_t int24;
int_t int25;
int_t int26;
int_t int27;
int_t int28;
int_t int29;
HandleEvent(ArmyClicked)'MG_Test'post{
unit_t MGUnit;
unit_t MGUnit2;
GetUnitFromArmy(army[0], 0, MGUnit);
int0 = CargoCapacity(MGUnit);
int1 = MaxCargoSize(MGUnit);
int2 = CargoSize(MGUnit);
int3 = GetContinent(MGUnit.location);
int4 = IsWater(MGUnit.location);
if(CargoSize(MGUnit) > 0){
int5 = GetUnitFromCargo(MGUnit, 0, MGUnit2);
int6 = MGUnit2.type;
}
int7 = MGUnit.type;
MessageAll('MGMAETestMessage');
}
And this goes into your ..\ctp2_data\german\gamedata\scen_str.txt or whatever the language of your CTP2 currently is.
code:
TEST_MESSAGE_FOR_MAE "0: {int0}, 1: {int1}, 2: {int2}, 3: {int3}, 4: {int4}, 5: {int5}, 6: {int6}, 7: {int7}, 8: {int8}, 9: {int9}, 10: {int10}, 11: {int11}, 12: {int12}, 13: {int13}, 14: {int14}, 15: {int15}, 16: {int16}, 17: {int17}, 18: {int18}, 19: {int19}, 20: {int20} 21: {int21}, 22: {int22}, 23: {int23}, 24: {int24}, 25: {int25}, 26: {int26}, 27: {int27}, 28: {int28}, 29: {int29}"
Of course you can edit the event handler to your needs:
code:
HandleEvent(ArmyClicked)'MG_Test'post{
unit_t MGUnit;
GetUnitFromArmy(army[0], 0, MGUnit);
int0 = UnitDB(MGUnit.type).WhateverFlag;
MessageAll('MGMAETestMessage');
}
As adding flags is done via dbgen it would be surprisingly if it doesn't work. If you want to know what some code does or get to know the values there use a message box, insert into c++ code something like this given you have some interger lieing around like int index:
code:
char buff[20];
sprintf(buff, "%i", index);
MessageBox(NULL, buff, buff, MB_OK);
Or if you want to know wich functions call a certain piece of code use Assert(FALSE); to make the program throuwing an assert and writing the assertion falure stack to ..\ctp2_code\ctp\logs\civ3logXX.txt.
-Martin
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:34
|
|
The Bombard event is a bit of a pain. They changed bombarding from CTP1 where you could bombard at range. Instead they put in a 'fire and forget' feature where you set the target and the unit moves up next to it and bombards. It would be nice to re-instate range so that the bombarding unit moves to within it's range of the target and then bombards. For example, you could then have the AI move a sub close to one of your ships and bombard, i.e., effectively fire a torpedo.
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:34
|
|
Yup, ZBRangeAttack is normal ranged attack. IIRC, there's also a range field in orders.txt thats no longer used.
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:34
|
|
That's a good idea. Have you already done it?
|
|
|  |
All times are GMT. The time now is 05:34. Apolyton Time is 00:34. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|