Announcement

Collapse
No announcement yet.

DEBUG: Code Questions (Compiling, Bugs, Revision Reports, Etc)

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

  • DEBUG: Code Questions (Compiling, Bugs, Revision Reports, Etc)

    I'm creating this thread because the revision reports just reports changes and the playtest thread really should only

    be for experiences (good, bad, crashes).

    So this thread will be for problems arising from revision changes that break compiling or bugs detected. I know the

    code now has a lot of TODOs in there and I don't have a way of tracking them all down but I'll try to list them here.

    CURRENT ISSUES, BUGS, REQUESTS

    * Barbarian build lists
    * Player[m_owner] = Null
    * Invisible Units "revealed"
    * Terraform Resouce Bug
    * No Piracy Agreements
    * AI Tile Imp placement/choice
    * Barbs only attack cities
    * Barbs ZOC not updating
    * Missing savegame graph
    * AI sea Invasion Lag
    * Brazil scenario persistence
    * Turnlength not implemented
    * Map Import
    * Growth rate
    * Vanishing Space planes
    * Ingame Menu - New Game Crash
    * Empire Manager commerce miscalculates

    FIXED ISSUES
    * Worker Bug && here
    * Unit Upgrades only graphic not DB traits
    * Scenario Loading
    * Great Library errors
    * Unit Herald Rework
    * drawTransitionTile memory crash
    Last edited by Martin Gühmann; May 26, 2008, 18:55.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

  • #2
    Originally posted by E
    Since revision 709

    this line of code (used in my sectarianhappiness but may cause crashes elsewhere) compiles but causes a crash:
    Code:
    		if(m_cityStyle != g_player[m_owner]->GetCivilisation()->GetCityStyle()) {
    why is that?
    Originally posted by Martin Gühmann
    Sinply if g_player[m_owner] is NULL then it crashs.

    By the way E you shouldn't post such questions here, this thread is for revisions reports, there are a lot of other threads you can use.

    -Martin

    putting a
    Code:
    if (g_player[m_owner] != NULL) {
    doesn't work either. But this code used to work before 709 so I think a MSVC6++ compatibility was broken. Fortunately this crash can be avoided by having the userprofile for sectarianhappiness to be off. But this line is the same as cultureonly units and other stuff throughout the code so something is broken.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

    Comment


    • #3
      am I the only one that gets a lot of assert errors when trying to run civctp_dbg.exe? at start up it hits me with setnew.h ln 52 and then a game i get diplomat.cpp ln870
      then it may throw up other diplomat errors in line 206,207,208 or 543
      Formerly known as "E" on Apolyton

      See me at Civfanatics.com

      Comment


      • #4
        Well, you could always use the debugger, you can set breakpoints everywhere within the code.

        And by the way E, I thought you were a mod now, so you can move posts into new threads. Or are there some technical difficulties?

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

        Comment


        • #5
          I'm limited in my mod powers... but i did delete some of the stuff from the revision reports (the last twoposts) for clean up sake.

          I would use the debugger but that is almost unusable now because of the errors i get in setnew.h and diplomat.cpp
          Formerly known as "E" on Apolyton

          See me at Civfanatics.com

          Comment


          • #6
            Originally posted by E
            I would use the debugger but that is almost unusable now because of the errors i get in setnew.h and diplomat.cpp
            You don't need to run a turn with the AI, as you said the code in question is called when you open the city manager.

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

            Comment


            • #7
              it happens on start up. You don't get this problem?

              Code:
              You don't need to run a turn with the AI
              are you saying there is a way to shut off the AI?
              Formerly known as "E" on Apolyton

              See me at Civfanatics.com

              Comment


              • #8
                Originally posted by E
                it happens on start up. You don't get this problem?
                I get it, too. But as far as I know it is just one assert. So that isn't aproblem.

                Originally posted by E
                Code:
                You don't need to run a turn with the AI
                are you saying there is a way to shut off the AI?
                No, I don't say to turn of the AI. But since your code is called as you said when you open the city manager, you don't need to test it on the AI turn. So just open the city manager and don't press the end turn button. And by the way the scenario editor can help you, too.

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

                Comment


                • #9
                  Having upgraded to v.719 I decided to have a look at the scenarios. Attempting to run any scenario (excl. World Map and AE Mod) gives a series of messages like this one referencing a variety of databases. Attempting to go continue past all of them works but on trying to reenter the main window then this appears. After some random clicking further parts of a menu appear but nothing actually does anything. The game does close via Alt+F4.

                  Comment


                  • #10
                    Originally posted by cap601
                    Having upgraded to v.719 I decided to have a look at the scenarios. Attempting to run any scenario (excl. World Map and AE Mod) gives a series of messages like this one referencing a variety of databases.
                    thanks cap, i'll look at it. the good its referencing is located in the AE mod which is weird because the scenarios should begoing to the default folder not he AE mod. This might be a case where you still have the AE_mod "loaded" and then try to start a scenario. I guess to work around it is to only start a scenario on start-up not to click through the various ones. That is, if you haven't already tried that

                    Attempting to go continue past all of them works but on trying to reenter the main window then this appears. After some random clicking further parts of a menu appear but nothing actually does anything. The game does close via Alt+F4.
                    I've found that going past them never works. I do know that there is always a slic error on start-up with alex scenario. I've wanted to redoit by resaving the game as a scenario but Fromafar said its good to keep it as is (not exactly sure why)
                    Formerly known as "E" on Apolyton

                    See me at Civfanatics.com

                    Comment


                    • #11
                      Originally posted by E
                      thanks cap, i'll look at it. the good its referencing is located in the AE mod which is weird because the scenarios should begoing to the default folder not he AE mod. This might be a case where you still have the AE_mod "loaded" and then try to start a scenario. I guess to work around it is to only start a scenario on start-up not to click through the various ones. That is, if you haven't already tried that
                      The errors do appear even if the AE mod is not loaded before the scenario.

                      Comment


                      • #12
                        I can see it's buggy but how is unit upgrading meant to work? I haven't run across any options to do it at any point yet.

                        Comment


                        • #13
                          unit upgrading is suupposed to work under a few conditions:

                          1) your unit is in a city
                          2) the technology is available for a new unit (see in the unit.txt UpgradeTo line)
                          3) you have the gold to do it (gold rush modifier times the difference in shield value)
                          4) you 'sentry' the unit in a city.

                          i think thats all the details. the method was based on the unitupdater code in SAP

                          for the record it used to work good to the playterster eye but it was messy in the code. Martin worked to fix that but I think he left off the change the actual unit part (not it just changes the sprite)
                          Formerly known as "E" on Apolyton

                          See me at Civfanatics.com

                          Comment


                          • #14
                            I think this is the source of the worker bug


                            the current code is first with the '*/' stuff and i put an older version of code in. I have to test it though
                            Code:
                            void CityData::ChangePopulation(sint32 delta)
                            {
                            /*   //this code was change and maybe source of worker bug since workers done twice
                            	m_population += delta;
                            	m_numSpecialists[POP_WORKER] += (sint16)delta; //this might be extra
                            	
                            	if (delta < 0) 
                                {
                            		m_numSpecialists[POP_WORKER] += (sint16)delta;
                            		if(m_numSpecialists[POP_WORKER] < 0) {
                            			sint32 needToRemove = -m_numSpecialists[POP_WORKER];
                            			m_numSpecialists[POP_WORKER] = 0;
                            
                            			for (sint32 i = 0; i < POP_MAX && needToRemove > 0; i++) 
                                        {
                            				if(m_numSpecialists[i] >= (sint16)needToRemove) {
                            					m_numSpecialists[i] -= (sint16)needToRemove;
                            					needToRemove = 0;
                            				} else if(m_numSpecialists[i] >= 0) {
                            					needToRemove -= m_numSpecialists[i];
                            					m_numSpecialists[i] = 0;
                            				}
                            			}
                            		}
                            	}
                            */
                            
                            //original code (from rev 632 archive)
                            	m_population += delta;
                            	
                            
                            	if(delta > 0) {
                            		
                            		m_numSpecialists[POP_WORKER] += (sint16)delta;
                            	} else {
                            		
                            		
                            		m_numSpecialists[POP_WORKER] += (sint16)delta;
                            		if(m_numSpecialists[POP_WORKER] < 0) {
                            			sint32 needToRemove = -m_numSpecialists[POP_WORKER];
                            			m_numSpecialists[POP_WORKER] = 0;
                            
                            			sint32 i;
                            			for(i = 0; i < POP_MAX && needToRemove > 0; i++) {
                            				if(m_numSpecialists[i] >= (sint16)needToRemove) {
                            					m_numSpecialists[i] -= (sint16)needToRemove;
                            					needToRemove = 0;
                            				} else if(m_numSpecialists[i] >= 0) {
                            					needToRemove -= m_numSpecialists[i];
                            					m_numSpecialists[i] = 0;
                            				}
                            			}
                            		}
                            	}
                            	AdjustSizeIndices();
                            	UpdateSprite();
                            
                            	if(g_network.IsHost()) {
                            		g_network.Block(m_owner);
                            		g_network.Enqueue(m_home_city.AccessData(), this);
                            		g_network.Unblock(m_owner);
                            	}
                            
                            	if(m_population <= 0) {
                            		g_gevManager->AddEvent(GEV_INSERT_AfterCurrent, GEV_KillCity,
                            		                       GEA_City, m_home_city.m_id,
                            		                       GEA_Int, CAUSE_REMOVE_CITY_UNKNOWN,
                            		                       GEA_Player, -1,
                            		                       GEA_End);
                            	}
                            }
                            Formerly known as "E" on Apolyton

                            See me at Civfanatics.com

                            Comment


                            • #15
                              Wouldn't that be fixed if you set the marked line in an else statement at the end (i.e. it only runs with delta>=0)? That appears to be the only major change between the two code blocks (excl. part from AdjustSizeIndices(); onwards)

                              Comment

                              Working...
                              X