Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Call To Power II > CtP2-Source Code Project > Increasing Bombardment Range
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
CivGroups
CTP2 Source Code Project (59): Not a Member - Join

bottom of page
  
Author
Thread   
Pages (4): [ 1   2   3   4   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 02-10-2004 03:45 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#31 Report this post to a moderator
Support Apolyton buy from Amazon

Does it look like then there is a BUG between how CanBombard and Bombard work. I'm thinking Bombard should be coded like CanBombard instead of using the IsNextTo. As it is now ArmyData:BOmbard doesnt even check if it CanBombard, instead it checks if the unit "IsNextTo"

As far as an army with different bombard range. I think it calculates as a single army each unit that can bombard. So (hypothetically) a catapult of 1 doesnt bombard but only the cannons of 2 can. Atleast how the code looks.

should it be

code:
ORDER_RESULT ArmyData::Bombard(const MapPoint &orderPoint) { MapPoint point = orderPoint; static CellUnitList defender; defender.Clear(); g_theWorld->GetArmy(point, defender); sint32 i; BOOL isSpaceBombard = FALSE; if(point == m_pos) { return ORDER_RESULT_ILLEGAL; } else { if(!point.CanBombard(m_pos)) { return ORDER_RESULT_ILLEGAL; } }

Last edited by E on 02-10-2004 at 03:51

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:22
  Old Post 02-10-2004 03:50 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#32 Report this post to a moderator
Suffering from ads?

quote:
Originally posted by E
Does it look like then there is a BUG between how CanBombard and Bombard work. I'm thinking Bombard should be coded like CanBombard instead of using the IsNextTo


It's not so much a bug as an unimplemented feature, but if BombardRange is to be implemented, that is indeed what must be done.

quote:
As far as an army with different bombard range. I think it calculates as a single army each unit that can bombard. So (hypothetically) a catapult of 1 doesnt bombard but only the cannons of 2 can. Atleast how the code looks.


Yes, but as Solver pointed out, there is the "fire and forget" code lurking somewhere which first moves the army into range and then bombards, so - if this is not disabled altogether - should it move the army until something is in range, or until all bombarding units are in range? Personally I'd choose disabling it altogether, but I'm also going to have to go to bed now, so I'll leave you to search it out andfind out how it works .

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:22
  Old Post 02-10-2004 03:53 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#33 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

quote:
Originally posted by E
should it be

code:
ORDER_RESULT ArmyData::Bombard(const MapPoint &orderPoint) { MapPoint point = orderPoint; static CellUnitList defender; defender.Clear(); g_theWorld->GetArmy(point, defender); sint32 i; BOOL isSpaceBombard = FALSE; if(point == m_pos) { return ORDER_RESULT_ILLEGAL; } else { if(!point.CanBombard) (m_pos)) { return ORDER_RESULT_ILLEGAL; } }


Well, not exactly like that - you can't call point.CanBombard() because point is a variable of type MapPoint, whereas CanBombard is a method of the UnitData class. The calls to CanBombard should probably come further down in the code, where it's looping through all the units...

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 02-10-2004 04:16 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#34 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

code:
BOOL ArmyData::CanBombardTargetType(const CellUnitList & units) const { sint32 i,j; for (i = m_nElements - 1; i>= 0; i--) { for (j = 0; j < units.Num(); j++) { if ( m_array[i]->CanBombardType(units[j]) == TRUE) return TRUE; } } return FALSE; } BOOL ArmyData::CanBombard(const MapPoint &point) const { static CellUnitList defender; defender.Clear(); g_theWorld->GetArmy(point, defender); sint32 i; if (defender.Num() < 1) return false; for (i = m_nElements - 1; i>= 0; i--) { if (m_array[i].CanBombard(defender)) return TRUE; } return FALSE; } BOOL ArmyData::CanBombard() const { sint32 i; for (i = m_nElements - 1; i>= 0; i--) { if( m_array[i].GetDBRec()->GetCanBombard() && m_array[i].CanPerformSpecialAction()) { return TRUE; } } return FALSE;

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 02-10-2004 04:22 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#35 Report this post to a moderator
Help yourself to an AD-FREE life

code:
int32 numAttacks = 0; sint32 numAlive = m_nElements; BOOL out_of_fuel; for (i = m_nElements - 1; i>= 0; i--) { if(!m_array[i].CanPerformSpecialAction()) continue; if (m_array[i].CanBombard(defender)) { if(m_array[i].Bombard(defender, FALSE)) { numAttacks++; g_director->AddAttackPos(m_array[i], point); AddSpecialActionUsed(m_array[i]); if(!m_array[i].GetDBRec()->GetMovementTypeAir()) { m_array[i].SetMovementPoints(0.0); } else { m_array[i].DeductMoveCost(k_MOVE_COMBAT_COST, out_of_fuel);


I think the AddAttackPos is where the fire and forget comes in play...

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 02-10-2004 04:28 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#36 Report this post to a moderator
Increase the size of your Attachments

ctp2_code\gfx\spritesys\director.cpp

but I'm not sure it does what I thought...


code:
void Director::AddAttackPos(Unit attacker, MapPoint &pos) { DQActionAttackPos *action=/forums/new DQActionAttackPos; DQItem *item = new DQItem(DQITEM_ATTACKPOS, action, dh_attackpos); item->SetOwner(attacker.GetOwner()); action->attackpos_attacker = attacker.GetActor(); action->attackpos_attacker_pos = attacker.RetPos(); action->attackpos_target_pos = pos; action->attackpos_soundID = attacker.GetAttackSoundID(); m_itemQueue->AddTail(item); if (g_player[g_selected_item->GetVisiblePlayer()] && g_player[g_selected_item->GetVisiblePlayer()]->IsVisible(pos)) if (attacker.m_id != 0) { AddCombatFlash(pos);

Flinx is offline Flinx
Prince
Toronto, ON CANADA
Nov 2001
time: 00:22
  Old Post 02-10-2004 06:09 Visit Flinx's homepage!
Edit/Delete Message Reply w/Quote
#37 Report this post to a moderator
Support Apolyton

quote:
Originally posted by Solver
ArmyData:BombardCity seems of interest as it has the (unused apparently) possibilities of damaging citizens/buildings during city bombardment.
IIRC there is a value in const.txt which sets the possibility of this to 0 but I could be wrong or that was what they had wanted to implement but were not able to and the values are not used now

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:22
  Old Post 02-10-2004 15:58 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#38 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Yes, but as Solver pointed out, there is the "fire and forget" code lurking somewhere which first moves the army into range and then bombards, so - if this is not disabled altogether - should it move the army until something is in range, or until all bombarding units are in range? Personally I'd choose disabling it altogether, but I'm also going to have to go to bed now, so I'll leave you to search it out andfind out how it works


It seems obvious that the code doesn't move armies into range to bombard - instead, the same code moves armies in range to execute any order, also bioinfections, franchises, etc. So we have two options: one is to disable it for bombard orders only (requires writing extra code), second is to disable it altogether (only need to take the code out). I'm strongly in favor of the latter. It is simpler to implement, and the "order and forget" movement feauture was annoying to me nonetheless - you better move units to the targets yourself. Also, disabling that will, I guess, prevent possible bugs with ranged bombard/other orders.

For the Bombard code, how about simply this:

code:
ORDER_RESULT ArmyData::Bombard(const MapPoint &orderPoint) { MapPoint point = orderPoint; static CellUnitList defender; defender.Clear(); g_theWorld->GetArmy(point, defender); sint32 i; BOOL isSpaceBombard = FALSE; if(point == m_pos) { return ORDER_RESULT_ILLEGAL; } else { if(! CanBombard(point)) { return ORDER_RESULT_ILLEGAL; } }


So we immediately check if the army can bombard the target point... and then ArmyData::CanBombard should probably be where we check for the range properly. I really need to access the code and MSVC now...

So, do the squared distance functions work properly now for anything like that we may want to code? I find the whole squared distance instead of 'squares to move' type of algorithm annoying, because it involves extra geometrical calculations.

quote:
MapPoint::GetSquaredDistance does exactly what it says (modulo some tweaks to account for the isometric tile set and wrapping, of course...). The reason it adds 0.5 is so that diagonally adjacent squares (which have a squaredistance of 2) fit inside distance 1 (which has rsq=(1+0.5)^2=2.25).


But it would work the same if diagonally adjacent squared were distance=1, right?



EDIT: CanBombard gotta check for point, not m_pos. m_pos is where the unit ordered to bombard is located, point is where the target is.

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:22
  Old Post 02-10-2004 16:01 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#39 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

quote:
code:
if (m_array[i].CanBombard(defender)) { if(m_array[i].Bombard(defender, FALSE)) { numAttacks++; g_director->AddAttackPos(m_array[i], point);


Weird. If that's the fire and forget code, why would it be invoked specifically for bombard, not just for any order? Besides, g_director is apparently an object of the Director class, and since we have

quote:
ctp2_code\gfx\spritesys\director.cpp


and the Director::AddAttackPos does not refer to Unit or Army classes, it seems that that is merely graphical code. I can't see where it adds a move order to the army there, so I think the fire and forget is elsewhere.

Flinx is offline Flinx
Prince
Toronto, ON CANADA
Nov 2001
time: 00:22
  Old Post 02-10-2004 22:09 Visit Flinx's homepage!
Edit/Delete Message Reply w/Quote
#40 Report this post to a moderator
Lose 30 kilos (of popups)

code:
ASSAULT_DESTROY_BUILDING_CHANCE 0.1 # chance of an assault on a city destroying a building BOMBARD_DESTROY_BUILDING_CHANCE 0.1 # chance of a bombardment on a city destroying a building BOMBARD_KILL_POP_CHANCE 0.1 ASSAULT_KILL_POP_CHANCE 0.4 CAPTURE_KILL_POP_CHANCE 1.0

Flinx is offline Flinx
Prince
Toronto, ON CANADA
Nov 2001
time: 00:22
  Old Post 02-10-2004 22:14 Visit Flinx's homepage!
Edit/Delete Message Reply w/Quote
#41 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by Solver
It seems obvious that the code doesn't move armies into range to bombard - instead, the same code moves armies in range to execute any order, also bioinfections, franchises, etc. So we have two options: one is to disable it for bombard orders only (requires writing extra code), second is to disable it altogether (only need to take the code out). I'm strongly in favor of the latter. It is simpler to implement, and the "order and forget" movement feauture was annoying to me nonetheless - you better move units to the targets yourself. Also, disabling that will, I guess, prevent possible bugs with ranged bombard/other orders.

Would the AI be affected? Does the AI use this code?

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:22
  Old Post 02-10-2004 22:30 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#42 Report this post to a moderator
Browse Apolyton AD-FREE

quote:

Would the AI be affected? Does the AI use this code?


I haven't yet found the code in question, but I'd think no. After all, it's more of an interface feauture, and only the human uses the interface. AI just sets goals for its units...

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:22
  Old Post 03-10-2004 00:24 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#43 Report this post to a moderator
Support Apolyton, buy Call to Power 2

quote:
Originally posted by Solver
But it would work the same if diagonally adjacent squared were distance=1, right?


Yes, it would be the same for distance 1 (and 0), but different for every other distance.

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:22
  Old Post 03-10-2004 00:42 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#44 Report this post to a moderator
Support Apolyton, buy Call to Power 2

Grr, I can't test changes to the code. I finally compiled & linked a Debug version on this comp, but I keep getting pummeled by various assertion faults when strating a new game. As for compilning a non-Debug version, that one crashes when starting a new game.

John, haven't you, by chance, tried to compile and run the latest playtest?

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:22
  Old Post 03-10-2004 00:56 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#45 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

quote:
Originally posted by Solver
John, haven't you, by chance, tried to compile and run the latest playtest?


I uploaded it, so it would be a little negligent of me not to test it first at least briefly... So, yes, I have compiled and run it, but I only played it for a few turns. Other people seem to be running it fine, though...

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:22
  Old Post 03-10-2004 00:59 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#46 Report this post to a moderator
Support Apolyton or Terrorists Win

Nah, that's not it. I have myself played the 14.09. playtest build without any problems, the one that was up for download.

However, taking a fresh copy of the original source and unzipping the zip file with all changed files from 13.09. over that, I get all that trouble. Assertion errors in great quantities, so I can't even start a new game.

But you probably compiled it exactly like that, just taking the source and unzipping the changes onto it, right?

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:22
  Old Post 03-10-2004 01:18 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#47 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

I think so. I don't remember having to take any special measures except rearranging the order of the include paths to put DXMedia before standard DirectX.

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:22
  Old Post 03-10-2004 01:19 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#48 Report this post to a moderator
Support Apolyton buy from Amazon

Yeah, during the summer and before I could do that myself, compile a debug version from the all-changes file posted by Martin and proceed to experiement with it. Now, however, I am for some reason unable to.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:22
Post  Old Post 03-10-2004 03:50 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#49 Report this post to a moderator
Remove this text

quote:
Originally posted by Solver
Grr, I can't test changes to the code. I finally compiled & linked a Debug version on this comp, but I keep getting pummeled by various assertion faults when strating a new game. As for compilning a non-Debug version, that one crashes when starting a new game.


Which mods do you use Solver? For instance some text file hacks in GoodMod cause some problems and also the slic code causes asserts, because the improvment_t type is not implemented but is used in the events concerning tile improvement. However you get less asserts with the unmodded game.

-Martin

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 03-10-2004 11:39 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#50 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

code:
if (m_array[i].CanBombard(defender)) { if(m_array[i].Bombard(defender, FALSE)) { numAttacks++; g_director->AddAttackPos(m_array[i], point); AddSpecialActionUsed(m_array[i]); if(!m_array[i].GetDBRec()->GetMovementTypeAir()) { m_array[i].SetMovementPoints(0.0); } else { m_array[i].DeductMoveCost(k_MOVE_COMBAT_COST, out_of_fuel);


I think may also be the part where, if people were inclined, to add something that checks for unit flag "blitz" which could allow a unit to attack multiple times if there were enough movements left a la Civ3....


Solver,
thinking of uses beyond just increasing bombard range and thinking about your "immobile" flag, would it be possible to just change the air units properties to "exclude" all of theterrain types. this may restrict them only to cities but if a flag was made that replicated all of the excludes and a later code for rebasing to airbases and carriers that might help finish your air combat code (assuming the changes to bombarg range work)

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:22
  Old Post 03-10-2004 17:13 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#51 Report this post to a moderator
Avatar Enlargement: We've got the solution

Martin,

I am running the game I compile without any mods. I'll try and see what I can do better now.

E,
For aircraft, I think MovementType: Air should stay, not to break anything else. So Immobile goes as a new flag that prevents movement. That's not the tricky part, I have gotten the Immobile flag to work. Of course, stacks that have an Immobile unit in them can't move either. The harder part would be the rebase code.... but for now I just need to get the damn thing to run properly.

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:22
  Old Post 03-10-2004 19:08 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#52 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

The damn thing is running nice finally. Ths is what I've found. As it stands, the GetDistance in UnitData::CanBombard is reduntant. It only gets invoked when the unit is adjacent to its target.

I did a test with a Catapult(range 1) bombing an adjacent target. The bombard order was processed, CanBombard and GetDistance invoked, all fine, target bombarded. Then a Cannon (range 2) trying to bombard a target two squares away. The bombard order was received, and the Cannon moved adjacent to its target - and only THEN was the UnitData::CanBombard invoked. When a Cannon is given the bombard order, it's a SelectedItem class event, not a UnitData or ArmyData event. I suspect the following code is to blame for this movement:

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); } }


So we have a specific bombard event added to the event manager... but I have no clue how that works yet. Am off to look at it further.

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 04-10-2004 20:46 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#53 Report this post to a moderator
Support Apolyton buy from Amazon

Great stuff Solver. Thanks for digging into this. i'm going to bump your air combat thread in case you feel like completing it

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:22
  Old Post 04-10-2004 22:07 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#54 Report this post to a moderator
Support Apolyton buy from Amazon

Alright, I spent more time looking through that code... so the fire & forget is what interferes, definitely, and is hidden somewhere in between the event code. I couldn't see where it orders units to move or checks distance there...

With the GameEvent and GameEventSomething classes I got pretty clear, but then there's this weird Walker class I don't really understand. If someone could dig in into how events work and get an explanation on how events are processed and where it checks if units need to move to execute orders, it would be most appreciated.

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 05-10-2004 01:05 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#55 Report this post to a moderator
Avatar Enlargement: We've got the solution

code:
STDEHANDLER(ArmyBombardOrderEvent) { Army a; MapPoint pos; if(!args->GetArmy(0, a)) return GEV_HD_Continue; if(!args->GetPos(0, pos)) return GEV_HD_Continue; a->AddOrders(UNIT_ORDER_BOMBARD , pos); return GEV_HD_Continue;


From Armyevent.cpp

It looks like it goes to add orders and then to Unit Orders so I dont think its here

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 05-10-2004 01:07 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#56 Report this post to a moderator
Support Apolyton, buy Civilization 2

then there is this towards the end of the armyevent.cpp

code:
void armyevent_Initialize() { g_gevManager->AddCallback(GEV_MoveOrder, GEV_PRI_Primary, &s_ArmyMoveOrderEvent); g_gevManager->AddCallback(GEV_MoveToOrder, GEV_PRI_Primary, &s_ArmyMoveToOrderEvent); g_gevManager->AddCallback(GEV_MovePathOrder, GEV_PRI_Primary, &s_ArmyMovePathOrderEvent); g_gevManager->AddCallback(GEV_VictoryMoveOrder, GEV_PRI_Primary, &s_ArmyVictoryMoveOrderEvent); g_gevManager->AddCallback(GEV_UnloadOrder, GEV_PRI_Primary, &s_ArmyUnloadOrderEvent); g_gevManager->AddCallback(GEV_SleepOrder, GEV_PRI_Primary, &s_ArmySleepOrderEvent); g_gevManager->AddCallback(GEV_MoveUnloadOrder, GEV_PRI_Primary, &s_ArmyMoveUnloadOrderEvent); g_gevManager->AddCallback(GEV_EntrenchOrder, GEV_PRI_Primary, &s_ArmyEntrenchOrderEvent); g_gevManager->AddCallback(GEV_DetrenchOrder, GEV_PRI_Primary, &s_ArmyDetrenchOrderEvent); g_gevManager->AddCallback(GEV_DisbandArmyOrder, GEV_PRI_Primary, &s_ArmyDisbandArmyOrderEvent); g_gevManager->AddCallback(GEV_GroupOrder, GEV_PRI_Primary, &s_ArmyGroupOrderEvent); g_gevManager->AddCallback(GEV_GroupUnitOrder, GEV_PRI_Primary, &s_ArmyGroupUnitOrderEvent); g_gevManager->AddCallback(GEV_UngroupOrder, GEV_PRI_Primary, &s_ArmyUngroupOrderEvent); g_gevManager->AddCallback(GEV_InvestigateCityOrder, GEV_PRI_Primary, &s_ArmyInvestigateCityOrderEvent); g_gevManager->AddCallback(GEV_NullifyWallsOrder, GEV_PRI_Primary, &s_ArmyNullifyWallsOrderEvent); g_gevManager->AddCallback(GEV_StealTechnologyOrder, GEV_PRI_Primary, &s_ArmyStealTechnologyOrderEvent); g_gevManager->AddCallback(GEV_InciteRevolutionOrder, GEV_PRI_Primary, &s_ArmyInciteRevolutionOrderEvent); g_gevManager->AddCallback(GEV_AssassinateRulerOrder, GEV_PRI_Primary, &s_ArmyAssassinateRulerOrderEvent); g_gevManager->AddCallback(GEV_InvestigateReadinessOrder, GEV_PRI_Primary, &s_ArmyInvestigateReadinessOrderEvent); g_gevManager->AddCallback(GEV_BombardOrder, GEV_PRI_Primary, &s_ArmyBombardOrderEvent);

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 05-10-2004 01:11 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#57 Report this post to a moderator
Support Apolyton buy from Amazon

Add I found nothing relating to bombard in unitevent.cpp and nothingin events.cpp either.

BUt maybe if you add a true/false check for the imobile flag in this unitevent.cpp:

code:
STDEHANDLER(AddUnitToArmyEvent) { Unit u; Army a; CAUSE_NEW_ARMY cause; if(!args->GetUnit(0, u)) return GEV_HD_Continue; if(!args->GetArmy(0, a)) return GEV_HD_Continue; if(!args->GetInt(0, (sint32 &)cause)) return GEV_HD_Continue; u->ChangeArmy(a, cause); Assert(u->GetArmy()->m_id == a->m_id); return GEV_HD_Continue; }


it might prevent immobile units from joining armies...

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 05-10-2004 01:14 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#58 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

The only other thing I can think of (and I'll stop posting) is in order.cpp

code:
bool Order::IsSpecialAttack(UNIT_ORDER_TYPE order) { switch(order) { case UNIT_ORDER_INVESTIGATE_CITY: case UNIT_ORDER_NULLIFY_WALLS: case UNIT_ORDER_STEAL_TECHNOLOGY: case UNIT_ORDER_INCITE_REVOLUTION: case UNIT_ORDER_ASSASSINATE: case UNIT_ORDER_INVESTIGATE_READINESS: case UNIT_ORDER_BOMBARD: case UNIT_ORDER_SUE: case UNIT_ORDER_FRANCHISE: case UNIT_ORDER_SUE_FRANCHISE: case UNIT_ORDER_EXPEL: case UNIT_ORDER_ESTABLISH_EMBASSY: case UNIT_ORDER_THROW_PARTY: case UNIT_ORDER_CAUSE_UNHAPPINESS: case UNIT_ORDER_PLANT_NUKE: case UNIT_ORDER_SLAVE_RAID: case UNIT_ORDER_ENSLAVE_SETTLER: case UNIT_ORDER_UNDERGROUND_RAILWAY: case UNIT_ORDER_INCITE_UPRISING: case UNIT_ORDER_BIO_INFECT: case UNIT_ORDER_NANO_INFECT: case UNIT_ORDER_CONVERT: case UNIT_ORDER_REFORM: case UNIT_ORDER_INDULGENCE: case UNIT_ORDER_SOOTHSAY: case UNIT_ORDER_CREATE_PARK: case UNIT_ORDER_PILLAGE: case UNIT_ORDER_INJOIN: case UNIT_ORDER_INTERCEPT_TRADE: case UNIT_ORDER_ADVERTISE: case UNIT_ORDER_SETTLE: case UNIT_ORDER_DISBAND: case UNIT_ORDER_UNLOAD: case UNIT_ORDER_LAUNCH: case UNIT_ORDER_TARGET: case UNIT_ORDER_CLEAR_TARGET: return true; default: return false;


lumps bombard as a special attack which usually requires moving close to something so it might be there? And it might require making separte code for bombard attacks and removing it from special attacks...

Fromafar is offline Fromafar
Prince

May 2003
time: 06:22
  Old Post 05-10-2004 02:06
Edit/Delete Message Reply w/Quote
#59 Report this post to a moderator
Lose 30 kilos (of popups)

You are getting colder . When the bombard order is chosen from the user interface (or from the AI goal code), it is using the ArmyData::PerformOrderHere function. This function will insert a GEV_MoveOrder before the GEV_BombardOrder when you are not adjacent to the target. So by the time you will encounter the actual bombard order, you should be at the target already.

And the Walker class is nothing to be afraid of. It is used to traverse the elements of a list. Nowadays, this would be called an iterator. This is probably old (CTP1) code, since newer parts do use the standard iterator.

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:22
  Old Post 05-10-2004 02:15 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#60 Report this post to a moderator
Support Apolyton, buy Civilization 2



code:
ArmyData::PerformOrderHere(const OrderRecord * order_rec, const Path * path) { Assert(path != NULL); if (path == NULL) return ; if (m_flags & k_CULF_IN_SPACE) return; Path *tmp_path = new Path((Path *) path); MapPoint target_pos; if (tmp_path->GetMovesRemaining() > 0) { target_pos = tmp_path->GetEnd(); } else { target_pos = m_pos; } if (s_orderDBToEventMap == NULL) AssociateEventsWithOrdersDB(); Assert(s_orderDBToEventMap != NULL); sint32 game_event = s_orderDBToEventMap[order_rec->GetIndex()]; sint32 range = 0; sint32 moves = tmp_path->GetMovesRemaining(); if (order_rec->GetRange()) { order_rec->GetRange(range); Assert(range <= moves || order_rec->GetTargetPretestAdjacentPosition()); } for (sint32 i = 0; moves > 0 && i < range; i++) { tmp_path->SnipEnd(); moves--; } g_gevManager->Pause(); if (game_event > 0) { if (range > 0 || order_rec->GetIsTeleport() || order_rec->GetIsTarget()) { g_gevManager->AddEvent( GEV_INSERT_AfterCurrent, static_cast(game_event), GEA_Army, Army(m_id), GEA_MapPoint, target_pos, GEA_End); } else { g_gevManager->AddEvent( GEV_INSERT_AfterCurrent, static_cast(game_event), GEA_Army, Army(m_id), GEA_End); } } if (tmp_path->GetMovesRemaining() > 0 && !order_rec->GetIsTeleport() && !order_rec->GetIsTarget()) { g_gevManager->AddEvent(GEV_INSERT_AfterCurrent, GEV_MoveOrder, GEA_Army, Army(m_id), GEA_Path, tmp_path, GEA_MapPoint, target_pos, GEA_Int, (game_event == -1), GEA_End); } else { delete tmp_path; } g_gevManager->AddEvent(GEV_INSERT_AfterCurrent, GEV_ClearOrders, GEA_Army, Army(m_id), GEA_End); g_gevManager->Resume(); }

 
Pages (4): [ 1   2   3   4   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:22.
Apolyton Time is 00:22.
    top of page
Rate This Thread:
Forum Jump:
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
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0829 seconds (92.03% PHP - 7.97% MySQL) with 36 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net