Announcement

Collapse
No announcement yet.

DEBUG: infrastructure

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DEBUG: infrastructure

    Some time ago I noticed that you can't create a custom build queue with 'infrastructure' in it. I tracked it down to ui\interface\EditQueue.cpp:

    Code:
          case k_GAME_OBJ_TYPE_INFRASTRUCTURE:
    		c3files_fprintf(saveFile, "CAP\n");
    		break;
    	case k_GAME_OBJ_TYPE_CAPITALIZATION:
    		c3files_fprintf(saveFile, "INF\n");
    		break;
    After making the obvious change, you can create custom queues that correctly contain these items, and save them. But you can't load them. I tried using the VC++ debugger (first time) but didn't get anywhere. Any help here would be appreciated.

  • #2
    It is a bit difficult to offer help on the VC++ debugger without knowing more details (what are you trying to do? what does/doesn't work?).

    But anyway, you may even run the debug executable without using the debugger. When attempting to load the new build queue, you should get an Assert (failure) popup.
    This will direct you to BuildQueue::Load in gs\gameobj\bldque.cpp.

    Comment


    • #3
      Thanks, I think I've got it now. These lines were missing from BuildQueue::Load,

      Code:
      case 'C':
      	Assert(buf[1] == 'A' && buf[2] == 'P');
      	if(buf[1] == 'A' && buf[2] == 'P') {
      		category = k_GAME_OBJ_TYPE_CAPITALIZATION;
      		type = 0;
      	} else {
      		continue;
      	}
      	break;
      case 'I':
      	Assert(buf[1] == 'N' && buf[2] == 'F');
      	if(buf[1] == 'N' && buf[2] == 'F') {
      		category = k_GAME_OBJ_TYPE_INFRASTRUCTURE;
      		type = 0;
      	} else {
      		continue;
      	}
      	break;
      It seems to work now, but I'll try it a few more times with different queues to be more sure.

      Actually, what I was really interested in is the question "Why doesn't the AI use infrastructure?" I've tracked this one down, too, and have got them using it. The problem now is to get them to stop using it: infrastructure and capitalization never get built, so they'll just stay there.

      Comment


      • #4
        Originally posted by Peter Triggs ......edit........

        Actually, what I was really interested in is the question "Why doesn't the AI use infrastructure?" I've tracked this one down, too, and have got them using it. The problem now is to get them to stop using it: infrastructure and capitalization never get built, so they'll just stay there.

        I never thought i'd find something funny in one of these types of threads
        Just out of curiosity Peter, the code you come up with to fix certain problems; is it already in the program but not finished , or do you create it from scratch? thanx for the smile
        'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

        Bush's Republican=Neo-con for all intent and purpose. be afraid.

        Comment


        • #5
          In this case - the code that I wrote today that does get them to stop using infrastructure/capitalization - it was adapted from something that I'd previously written in SLIC. But sometimes, like the code I quoted immediately above, it was just a matter of noticing that those lines were in Editqueue but not in Buildqueue.

          Comment


          • #6
            How did you solve this problem, Peter. Do you remove infrastructure/capitalization from the build queue and let the AI decide again or do you make the to reconsider its decision.

            -Martin
            Civ2 military advisor: "No complaints, Sir!"

            Comment


            • #7
              I put in a few lines so that whenever it discovers an advance, it looks through it's cities and clears the buildqueue's of those cities that have infrastructure or capitalization on top. There's already code in the game that will clear an AI's buildqueue on the first turn of war, so I think this should be ok. If there's a problem, we can clear the buildqueue of any AI civ that is at war but is using infrastructure/capitalization.

              BTW, if you haven't come across this and you want to see something incredibly complicated, switch on k_DBG_SCHEDULER in main_InitializeLogs of civ3_main.cpp. The options for this are set in c3debug.h:

              typedef void (* CivExceptionFunction) (void);

              #define k_DBG_ALL 0xffffffff
              #define k_DBG_NONE 0x00000000
              #define k_DBG_INFO 0x00000001
              #define k_DBG_AI 0x00000002
              #define k_DBG_NET 0x00000004
              #define k_DBG_GRAPHICS 0x00000008
              #define k_DBG_DATABASE 0x00000010
              #define k_DBG_FILE 0x00000020
              #define k_DBG_GAMESTATE 0x00000040
              #define k_DBG_UI 0x00000080
              #define k_DBG_FIX 0x00000100
              #define k_DBG_SLIC 0x00000200
              #define k_DBG_SCHEDULER 0x00000400
              #define k_DBG_SCHEDULER_DETAIL 0x00000c00
              #define k_DBG_SCHEDULER_ALL 0x00001c00
              #define k_DBG_DIPLOMACY 0x00002000
              #define k_DBG_MAPANALYSIS 0x00004000
              You can choose any combination of these in the above function.

              But beware, k_DBG_SCHEDULER, which prints out the debug info for how the AI 'tasks it's units', spews out up to 5 m of log files per turn. Azmel must have the patience of a saint.

              Comment

              Working...
              X