1 /*
2 * Seven Kingdoms: Ancient Adversaries
3 *
4 * Copyright 1997,1998 Enlight Software Ltd.
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 //Filename : OAI_ACT.CPP
22 //Description: AI - action progressing functions
23
24 #include <ALL.h>
25 #include <OBOX.h>
26 #include <OSYS.h>
27 #include <OCONFIG.h>
28 #include <OINFO.h>
29 #include <OU_MARI.h>
30 #include <ONATION.h>
31
32 //------- Begin of function Nation::process_action --------//
33 //
34 // [int] priorityActionRecno - if this is given, this specific action will
35 // be processed first. Otherwise it will process
36 // actions in the array in a sequential order.
37 //
38 // [int] processActionMode - if this is given, only message of this type
39 // will be processed and all messages in the queued of this
40 // type will be processed.
41 //
42 // Note: priorityActionRecno and processActionMode couldn't be used at
43 // the same time.
44 //
45 // return: <int> 1 - all messages of the specific action mode are processed or all messages are processed
46 // or the priority message has been processed.
47 //
process_action(int priorityActionRecno,int processActionMode)48 int Nation::process_action(int priorityActionRecno, int processActionMode)
49 {
50 err_when( priorityActionRecno && processActionMode );
51
52 // #define MAX_PROCESS_ACTION_TIME 0.01 // maximum time given to processing actions (second)
53 // unsigned expireTime = misc.get_time() + (unsigned)(MAX_PROCESS_ACTION_TIME*1000);
54
55 int actionRecno, rc, delFlag, doneFlag=0;
56 int thisSessionProcessCount=0; // actions processed in this call session
57 ActionNode* actionNode;
58
59 int divider = 4-config.ai_aggressiveness; // the more nations there, the less process count
60 int nationRecno = nation_recno;
61 int maxSessionProcessCount = 70 / nation_array.nation_count / MAX(divider,1);
62
63 for( actionRecno=1 ; actionRecno<=action_count() &&
64 (thisSessionProcessCount < maxSessionProcessCount || processActionMode) && !doneFlag ; // if processActionMode has been specific, then all messages in the queue of this type will be processed
65 actionRecno++ )
66 {
67 //----- priority action ------//
68
69 if( priorityActionRecno )
70 {
71 actionRecno = priorityActionRecno;
72 doneFlag = 1; // mark it done, so if the function "continue" to the next loop, the function will end
73 }
74
75 actionNode = get_action(actionRecno);
76
77 //----- if only process specific action mode -----//
78
79 if( processActionMode && actionNode->action_mode != processActionMode )
80 continue;
81
82 //--- if the AI action is about processing diplomatic message ---//
83
84 if( actionNode->action_mode == ACTION_AI_PROCESS_TALK_MSG &&
85 processActionMode != ACTION_AI_PROCESS_TALK_MSG )
86 {
87 if( misc.random(10) > 0 ) // 1/10 chance of processing the diplomatic messages
88 continue;
89 }
90
91 //----------------------------------------------//
92
93 if( actionNode->processing_instance_count == actionNode->instance_count )
94 {
95 //---------------------------------------------//
96 //
97 // If this action has been marked processing for over 6 months
98 // and we still haven't received finishing notifications,
99 // then there may be some accidents (or bugs) happened, and
100 // we will need to delete the action.
101 //
102 //---------------------------------------------//
103
104 if( info.game_date > actionNode->add_date + 30 * 6 )
105 {
106 del_action(actionRecno);
107 actionRecno--; // stay in this array position as the current one has been deleted, the following one replace the current one's position
108 }
109
110 continue;
111 }
112
113 err_when( actionNode->processing_instance_count > actionNode->instance_count );
114
115 if( info.game_date < actionNode->next_retry_date && !priorityActionRecno ) // priorityAction bypass retry date checking
116 continue;
117
118 if( actionNode->retry_count==0 ) // the actionNode may still exist even when retry_count==0, waiting for processed_count to reach processing_count
119 continue;
120
121 //-- there is an unprocessing action in this waiting node --//
122
123 switch( actionNode->action_mode )
124 {
125 case ACTION_AI_BUILD_FIRM:
126 rc = ai_build_firm(actionNode);
127 break;
128
129 case ACTION_AI_ASSIGN_OVERSEER:
130 rc = ai_assign_overseer(actionNode);
131 break;
132
133 case ACTION_AI_ASSIGN_CONSTRUCTION_WORKER:
134 rc = ai_assign_construction_worker(actionNode);
135 break;
136
137 case ACTION_AI_ASSIGN_WORKER:
138 rc = ai_assign_worker(actionNode);
139 break;
140
141 case ACTION_AI_ASSIGN_SPY:
142 rc = ai_assign_spy(actionNode);
143 break;
144
145 case ACTION_AI_SCOUT:
146 rc = ai_scout(actionNode);
147 break;
148
149 case ACTION_AI_SETTLE_TO_OTHER_TOWN:
150 rc = ai_settle_to_other_town(actionNode);
151 break;
152
153 case ACTION_AI_PROCESS_TALK_MSG:
154 rc = ai_process_talk_msg(actionNode);
155 break;
156
157 case ACTION_AI_SEA_TRAVEL:
158 rc = ai_sea_travel(actionNode);
159 break;
160
161 case ACTION_AI_SEA_TRAVEL2:
162 rc = ai_sea_travel2(actionNode);
163 break;
164
165 case ACTION_AI_SEA_TRAVEL3:
166 rc = ai_sea_travel3(actionNode);
167 break;
168 }
169
170 if( nation_array.is_deleted(nationRecno) ) // diplomatic option can result in surrendering
171 return 0;
172
173 thisSessionProcessCount++;
174
175 //------ check the return result -------//
176
177 delFlag = 0;
178
179 if( rc==1 ) // the action has been processed, but not sure whether it is complete or not
180 {
181 actionNode->processing_instance_count++;
182
183 //---------------------------------------------------//
184 // for ACTION_DYNAMIC, the action is immediately
185 // deleted when processing_instance_count == instance_count.
186 //---------------------------------------------------//
187
188 if( actionNode->action_type == ACTION_DYNAMIC )
189 {
190 if( actionNode->processing_instance_count > actionNode->instance_count )
191 delFlag = 1;
192 }
193 }
194 else if( rc==0 ) // action failed, retry
195 {
196 actionNode->next_retry_date = info.game_date + 7; // try again one week later
197
198 if( --actionNode->retry_count==0 )
199 delFlag = 1;
200
201 err_when( actionNode->retry_count < 0 );
202 }
203 else if( rc== -1 ) // action failed, remove immediately if return -1
204 {
205 actionNode->retry_count = 0;
206 delFlag = 1;
207 }
208
209 //-----------------------------------------//
210
211 if( delFlag && actionNode->processing_instance_count == actionNode->processed_instance_count ) // if processing_count > processed_count, do not remove this ActionNode, as there are some unit using this actionNode, when they finish or fail the action, processed_count will increase and processing_count will reach processed_count
212 {
213 del_action(actionRecno);
214 actionRecno--; // stay in this array position as the current one has been deleted, the following one replace the current one's position
215 }
216 }
217
218 return actionRecno > action_count() || doneFlag;
219 }
220 //---------- End of function Nation::process_action --------//
221
222
223 //------- Begin of function Nation::process_action_id --------//
224 //
225 // Process a specific action.
226 //
process_action_id(int actionId)227 int Nation::process_action_id(int actionId)
228 {
229 for( int i=action_count() ; i>0 ; i-- )
230 {
231 if( get_action(i)->action_id == actionId )
232 {
233 process_action(i);
234 return 1;
235 }
236 }
237
238 return 0;
239 }
240 //---------- End of function Nation::process_action_id --------//
241
242
243 //------- Begin of function Nation::get_action_based_on_id --------//
244 //
245 // Return ActionNode for the given actionId.
246 //
get_action_based_on_id(int actionId)247 ActionNode* Nation::get_action_based_on_id(int actionId)
248 {
249 for( int i=action_count() ; i>0 ; i-- )
250 {
251 if( get_action(i)->action_id == actionId )
252 {
253 return get_action(i);
254 }
255 }
256
257 return 0;
258 }
259 //---------- End of function Nation::get_action_based_on_id --------//
260
261
262 //--------- Begin of function Nation::add_action --------//
263 //
264 // <short> xLoc, yLoc - location of the action
265 // <short> refXLoc, refYLoc - reference location (optional, not all action types need this)
266 // <int> actionMode - action mode
267 // <int> actionPara - action parameter
268 // [int] instanceCount - no. of instances of this action should be carried out
269 // (default: 1)
270 // [int] unitRecno - recno of the unit responsible for this action
271 // if not given, an appropriate unit will be found.
272 // [int] actionPara2 - action para2
273 // [short*] groupUnitArray - array of unit recno in the group for the action
274 // the no. of units in the array is stored in instance_count
275 // (default: NULL)
276 //
277 // return: <int> recno of the action added in action_array
278 // 0 - if the action is not added as it is already in action_array.
279 //
add_action(short xLoc,short yLoc,short refXLoc,short refYLoc,int actionMode,int actionPara,int instanceCount,int unitRecno,int actionPara2,short * groupUnitArray)280 int Nation::add_action(short xLoc, short yLoc, short refXLoc, short refYLoc,
281 int actionMode, int actionPara, int instanceCount,
282 int unitRecno, int actionPara2, short* groupUnitArray)
283 {
284 err_when( instanceCount < 1 );
285
286 //--- check if the action has been added already or not ---//
287
288 if( is_action_exist(xLoc, yLoc, refXLoc, refYLoc, actionMode, actionPara, unitRecno) )
289 return 0;
290
291 //---------- queue the action ----------//
292
293 ActionNode actionNode;
294
295 memset( &actionNode, 0, sizeof(ActionNode) );
296
297 actionNode.action_mode = actionMode; // what kind of action
298 actionNode.action_para = actionPara; // parameter of the action
299 actionNode.action_para2 = actionPara2; // parameter of the action
300 actionNode.action_x_loc = xLoc; // location to act to
301 actionNode.action_y_loc = yLoc;
302 actionNode.ref_x_loc = refXLoc; // the refective location of this action make to
303 actionNode.ref_y_loc = refYLoc;
304 actionNode.retry_count = STD_ACTION_RETRY_COUNT; // number of term to wait before discarding this action
305 actionNode.instance_count = instanceCount; // num of this action being processed in the waiting queue
306
307 int immediateProcess=0;
308
309 if( groupUnitArray )
310 {
311 // the no. of units in the array is stored in instance_count
312
313 err_when( instanceCount < 1 );
314 err_when( instanceCount > ActionNode::MAX_ACTION_GROUP_UNIT );
315
316 memcpy( actionNode.group_unit_array, groupUnitArray, instanceCount * sizeof(groupUnitArray[0]) );
317
318 immediateProcess = 1; // have to execute this command immediately as the unit in unit_array[] may change
319 actionNode.retry_count = 1; // only try once as the unit in unit_array[] may change
320 }
321
322 if( unitRecno )
323 {
324 //-- this may happen when the unit is a spy and has just changed cloak --//
325
326 if( !nation_array[unit_array[unitRecno]->true_nation_recno()]->is_ai() &&
327 !nation_array[unit_array[unitRecno]->nation_recno]->is_ai() )
328 {
329 return 0;
330 }
331
332 //-------------------------------------//
333
334 actionNode.unit_recno = unitRecno;
335
336 if( unit_array[unitRecno]->is_visible() )
337 {
338 immediateProcess = 1; // have to execute this command immediately as the unit in unit_array[] may change
339 actionNode.retry_count = 1; // only try once as the unit in unit_array[] may change
340 }
341 else //--- the unit is still being trained ---//
342 {
343 actionNode.next_retry_date = info.game_date + TOTAL_TRAIN_DAYS + 1;
344 }
345 }
346
347 //-------- set action type ---------//
348
349 actionNode.action_type = ACTION_FIXED; // default action type
350
351 //------- link into action_array --------//
352
353 return add_action( &actionNode, immediateProcess );
354 }
355 //---------- End of function Nation::add_action --------//
356
357
358 //--------- Begin of function Nation::add_action --------//
359 //
360 // <ActionNode*> actionNode - the action node to be added.
361 // [int] immediateProcess - process this action immediately
362 //
add_action(ActionNode * actionNode,int immediateProcess)363 int Nation::add_action(ActionNode* actionNode, int immediateProcess)
364 {
365 //----------- reset some vars -----------//
366
367 actionNode->add_date = info.game_date;
368 actionNode->action_id = ++last_action_id;
369 actionNode->retry_count = STD_ACTION_RETRY_COUNT;
370
371 actionNode->processing_instance_count = 0;
372 actionNode->processed_instance_count = 0;
373
374 //------- link into action_array --------//
375
376 action_array.linkin( actionNode );
377
378 if( immediateProcess )
379 process_action( action_array.recno() );
380
381 return action_array.recno();
382 }
383 //---------- End of function Nation::add_action --------//
384
385
386 //--------- Begin of function Nation::del_action --------//
387 //
del_action(int actionRecno)388 void Nation::del_action(int actionRecno)
389 {
390 action_array.linkout(actionRecno);
391 }
392 //---------- End of function Nation::del_action --------//
393
394
395 //--------- Begin of function Nation::is_action_exist --------//
396 //
397 // <short> actionXLoc, actionYLoc - action_?_loc in ActionNode to match with
398 // <short> refXLoc, refYLoc - ref_?_loc in ActionNode to match with
399 // <int> actionMode - action mode
400 // <int> actionPara - parameter of the action
401 // [int] unitRecno - unit recno to match with, only useful for actions under processing.
402 // [int] checkMode - 1-check actionXLoc & actionYLoc only
403 // 2-check refXLoc & refYLoc only
404 // 0-check both
405 // (default: 0)
406 //
407 // return: <int> >0 if the action recno of the existing action
408 // ==0 if not exist
409 //
is_action_exist(short actionXLoc,short actionYLoc,short refXLoc,short refYLoc,int actionMode,int actionPara,int unitRecno,int checkMode)410 int Nation::is_action_exist(short actionXLoc, short actionYLoc, short refXLoc, short refYLoc, int actionMode, int actionPara, int unitRecno, int checkMode)
411 {
412 int i;
413 ActionNode* actionNode;
414
415 for( i=action_count() ; i>0 ; i-- )
416 {
417 actionNode = get_action(i);
418
419 if( actionNode->action_mode == actionMode &&
420 actionNode->action_para == actionPara )
421 {
422 if( unitRecno && unitRecno != actionNode->unit_recno ) // it requests to match the unit recno and it is not matched here
423 continue;
424
425 if( refXLoc>=0 )
426 {
427 if( checkMode==0 || checkMode==2 )
428 {
429 if( actionNode->ref_x_loc==refXLoc && actionNode->ref_y_loc==refYLoc)
430 return i;
431 }
432 }
433 else
434 {
435 if( checkMode==0 || checkMode==1 )
436 {
437 if( actionNode->action_x_loc==actionXLoc && actionNode->action_y_loc==actionYLoc )
438 return i;
439 }
440 }
441 }
442 }
443
444 return 0;
445 }
446 //---------- End of function Nation::is_action_exist --------//
447
448
449 //--------- Begin of function Nation::is_action_exist --------//
450 //
451 // Check if the an action of the specific mode and para
452 // exists in the action_array.
453 //
454 // <int> actionMode - action mode
455 // <int> actionPara - parameter of the action
456 // [int] regionId - if this parameter is given, only
457 // action with destination in this
458 // region will be checked.
459 //
is_action_exist(int actionMode,int actionPara,int regionId)460 int Nation::is_action_exist(int actionMode, int actionPara, int regionId)
461 {
462 int i;
463 ActionNode* actionNode;
464
465 for( i=action_count() ; i>0 ; i-- )
466 {
467 actionNode = get_action(i);
468
469 if( actionNode->action_mode == actionMode &&
470 actionNode->action_para == actionPara )
471 {
472 if( !regionId )
473 return 1;
474
475 err_when( actionNode->action_x_loc < 0 ||
476 actionNode->action_y_loc < 0 ||
477 actionNode->action_x_loc >= MAX_WORLD_X_LOC ||
478 actionNode->action_y_loc >= MAX_WORLD_Y_LOC );
479
480 if( world.get_region_id(actionNode->action_x_loc,
481 actionNode->action_y_loc) == regionId )
482 {
483 return 1;
484 }
485 }
486 }
487
488 return 0;
489 }
490 //---------- End of function Nation::is_action_exist --------//
491
492
493 //--------- Begin of function Nation::is_build_action_exist --------//
494 //
495 // Return 1 if there is already a firm queued for building with
496 // a building location that is within the effective range
497 // of the given position.
498 //
is_build_action_exist(int firmId,int xLoc,int yLoc)499 int Nation::is_build_action_exist(int firmId, int xLoc, int yLoc)
500 {
501 int i;
502 ActionNode* actionNode;
503
504 for( i=action_count() ; i>0 ; i-- )
505 {
506 actionNode = get_action(i);
507
508 if( actionNode->action_mode == ACTION_AI_BUILD_FIRM &&
509 actionNode->action_para == firmId )
510 {
511 if( misc.points_distance( actionNode->action_x_loc, actionNode->action_y_loc,
512 xLoc, yLoc) <= EFFECTIVE_FIRM_TOWN_DISTANCE )
513 {
514 return 1;
515 }
516 }
517 }
518
519 return 0;
520 }
521 //---------- End of function Nation::is_build_action_exist --------//
522
523
524 //--------- Begin of function Nation::action_finished --------//
525 //
526 // The action under processing is finished successfully.
527 //
528 // <uint16_t> aiActionId - the id. of the action to be marked finished.
529 // [short] unitRecno - if this is given, the the unit's all action
530 // will be stopped.
531 // [int] actionFailure - whether the action is failed and called by
532 // action_failure(). (default: 0)
533 //
action_finished(uint16_t aiActionId,short unitRecno,int actionFailure)534 void Nation::action_finished(uint16_t aiActionId, short unitRecno, int actionFailure)
535 {
536 //----- locate the ActionNode of this action ------//
537
538 int actionRecno;
539 ActionNode* actionNode;
540
541 //----- try to match actions by unitRecno first ----//
542
543 for( actionRecno=action_count() ; actionRecno>0 ; actionRecno-- )
544 {
545 actionNode = get_action(actionRecno);
546
547 if( aiActionId == actionNode->action_id )
548 break;
549 }
550
551 if( actionRecno==0 ) // not found
552 {
553 // if( sys.debug_session && !sys.signal_exit_flag )
554 // box.msg( "Error: action_finished() - entry not found." );
555
556 stop_unit_action(unitRecno);
557 return;
558 }
559
560 //------------------------------------------------//
561 //
562 // In the above condition is true, that means this ship
563 // unit has called this function once and the current
564 // calling is a duplicated calling.
565 //
566 //------------------------------------------------//
567
568 int shouldStop=1;
569
570 if( actionNode->action_mode == ACTION_AI_SEA_TRAVEL ) // don't reset the unit's ai_action_id in ACTION_AI_SEA_TRAVEL mode as if we reset it, the ship will take new action and won't wait for the units to go aboard.
571 {
572 if( !unit_array.is_deleted(unitRecno) &&
573 unit_res[ unit_array[unitRecno]->unit_id ]->unit_class == UNIT_CLASS_SHIP )
574 {
575 if( actionNode->action_para2 )
576 {
577 return;
578 }
579 else
580 {
581 actionNode->action_para2 = unitRecno;
582 shouldStop = 0;
583 }
584 }
585 }
586
587 //---------------------------------------------//
588 //
589 // Only handle ACTION_FIXED, for ACTION_DYNAMIC,
590 // the action is immediately deleted when
591 // processing_instance_count == instance_count.
592 //
593 //---------------------------------------------//
594
595 if( actionNode->action_type != ACTION_FIXED )
596 {
597 stop_unit_action(unitRecno);
598 return;
599 }
600
601 //-------------------------------------------------//
602
603 actionNode->processed_instance_count++;
604
605 err_when( actionNode->processed_instance_count > actionNode->processing_instance_count );
606 err_when( actionNode->processed_instance_count > actionNode->instance_count );
607
608 //---- if all requested instances are processed ----//
609
610 int allDoneFlag=0;
611
612 if( actionNode->processed_instance_count >= actionNode->instance_count )
613 allDoneFlag = 1;
614
615 //---- if the action is failed and all the outstanding units are finished, del the action ---//
616
617 else if( actionNode->retry_count==0 &&
618 actionNode->processed_instance_count >= actionNode->processing_instance_count )
619 {
620 allDoneFlag = 1;
621 }
622
623 //------- stop the AI actions of the unit -----//
624
625 if( shouldStop )
626 stop_unit_action(unitRecno);
627
628 //---- if the action is done, see if there needs to be a following action ----//
629
630 if( allDoneFlag )
631 {
632 auto_next_action(actionNode);
633 del_action(actionRecno);
634 }
635 }
636 //---------- End of function Nation::action_finished --------//
637
638
639 //--------- Begin of function Nation::action_failure --------//
640 //
641 // It's basically the same as action_finish(). Now there isn't any
642 // difference.
643 //
644 // <uint16_t> aiActionId - the id. of the action to be marked finished.
645 // [short] unitRecno - if this is given, the the unit's all action
646 // will be stopped.
647 //
action_failure(uint16_t aiActionId,short unitRecno)648 void Nation::action_failure(uint16_t aiActionId, short unitRecno)
649 {
650 //-- if the unit is a ship, ignore it as it will be called by stop2() when it stops, but hasn't yet finished its action --//
651 /*
652 Unit* unitPtr = unit_array[unitRecno];
653
654 if( unit_res[unitPtr->unit_id]->unit_class == UNIT_CLASS_SHIP )
655 {
656 int actionMode = get_action_based_on_id(aiActionId)->action_mode;
657
658 if( actionMode == ACTION_AI_SEA_TRAVEL ||
659 actionMode == ACTION_AI_SEA_TRAVEL2 )
660 {
661 return;
662 }
663 }
664 */
665 //------------------------------------------------//
666
667 action_finished(aiActionId, unitRecno, 1); // 1 - action failure
668 }
669 //---------- End of function Nation::action_failure ---------//
670
671
672 //--------- Begin of function Nation::stop_unit_action --------//
673
stop_unit_action(short unitRecno)674 void Nation::stop_unit_action(short unitRecno)
675 {
676 if( !unitRecno )
677 return;
678
679 //------- stop the AI actions of the unit -----//
680 //
681 // It is possible that this is not an AI unit as
682 // when a player spy cloaked as an enemy unit,
683 // the AI will control it.
684 //
685 //---------------------------------------------//
686
687 if( !unit_array.is_deleted(unitRecno) )
688 {
689 Unit* unitPtr = unit_array[unitRecno];
690
691 unitPtr->ai_action_id = 0;
692
693 //---- if the unit is a ship on the beach and it's mode isn't NO_EXTRA_MOVE, we couldn't call stop2() as that will cause bug ---//
694
695 if(unitPtr->action_mode2==ACTION_SHIP_TO_BEACH)
696 {
697 UnitMarine *shipPtr = (UnitMarine*) unitPtr;
698
699 err_when( unit_res[shipPtr->unit_id]->unit_class != UNIT_CLASS_SHIP );
700
701 if( shipPtr->extra_move_in_beach != NO_EXTRA_MOVE )
702 return;
703 }
704
705 //--------------------------------------------------//
706
707 unitPtr->stop2();
708 unitPtr->reset_action_misc_para();
709
710 err_when(unitPtr->in_auto_defense_mode());
711 err_when(unitPtr->action_x_loc!=-1 || unitPtr->action_y_loc!=-1);
712 err_when(unitPtr->action_mode!=ACTION_STOP);
713 }
714 }
715 //---------- End of function Nation::stop_unit_action ---------//
716
717
718 //--------- Begin of function Nation::auto_next_action --------//
719 //
720 // Automatically create a follow-up action to this action
721 // if this action needs one.
722 //
auto_next_action(ActionNode * actionNode)723 void Nation::auto_next_action(ActionNode* actionNode)
724 {
725 int actionRecno=0;
726
727 switch( actionNode->action_mode )
728 {
729 case ACTION_AI_SEA_TRAVEL:
730 actionNode->action_mode = ACTION_AI_SEA_TRAVEL2;
731 actionNode->instance_count = 1; // only move one ship, it was previously set to the no. units to aboard the ship
732 actionRecno = add_action(actionNode, 1); // 1-immediate process flag
733 break;
734
735 case ACTION_AI_SEA_TRAVEL2:
736 actionNode->action_mode = ACTION_AI_SEA_TRAVEL3;
737 actionRecno = add_action(actionNode, 1); // 1-immediate process flag
738 break;
739 }
740
741 if( actionRecno )
742 process_action(actionRecno);
743 }
744 //---------- End of function Nation::auto_next_action ---------//
745
746
747