Announcement

Collapse
No announcement yet.

E's Source Code attempts

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

  • #61
    Still working but martin I'm getting this (and I didnt touch it!)
    Code:
    CTPDatabase.cpp
    F:\SVN-Code\trunk\ctp2_code\gs\newdb\CTPDatabase.cpp(166) : error C2039: 'Serialize' : is not a member of 'EndGameObjectRecord'
            F:\SVN-Code\trunk\ctp2_code\gs\newdb\EndGameObjectRecord.h(38) : see declaration of 'EndGameObjectRecord'
            C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(59) : while compiling class-template member function 'void __thiscall CTPDatabase::Serialize(class CivArchive &)'
    F:\SVN-Code\trunk\ctp2_code\gs\newdb\CTPDatabase.cpp(181) : error C2664: '__thiscall EndGameObjectRecord::EndGameObjectRecord(const class EndGameObjectRecord &)' : cannot convert parameter 1 from 'class CivArchive' to 'const class EndGameObjectRecor
    d &'
            Reason: cannot convert from 'class CivArchive' to 'const class EndGameObjectRecord'
            No constructor could take the source type, or constructor overload resolution was ambiguous
            C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(59) : while compiling class-template member function 'void __thiscall CTPDatabase::Serialize(class CivArchive &)'
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

    Comment


    • #62
      Originally posted by E
      Still working but martin I'm getting this (and I didnt touch it!)
      The remark in parentheses hits your problem, of course these *Record.* files have to be updated, actual your compiler is supposed to do it automaticly, and if you do a complete rebuild it just does this. But you can update the file manually. To do this just select the EndGameObject.cdb in the file view of Visual Studio and press Ctrl + F7. And then dbgen updates the files for your, given you have recompiled it before.

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

      Comment


      • #63
        You may also have to delete the ctp2_code/gs/database/RiskRecord.h file manually. The SVN update did not delete it for me, but kept it as an unmanaged file. When this file is still present, you will get a lot of errors involving g_theRiskDB.

        Comment


        • #64
          Ok I updated stuff and I think I was following what you said. its compiling but its not working when i add a good in the radius or at all like my working code.


          Code:
          	if(rec->GetNumNeedsCityGood() > 0) {
          		sint32 g;
          		bool found = false;
          		for(g = 0; g < (m_buyingResources[g] + m_collectingResources[g]); g++) {
          				if((HasResource(g) || m_buyingResources[g]) && rec->GetNeedsCityGoodIndex(g)) 
          					break;
          				}
          				if(!found)
          				return FALSE;
          	}
          Formerly known as "E" on Apolyton

          See me at Civfanatics.com

          Comment


          • #65
            Originally posted by E
            Ok I updated stuff and I think I was following what you said. its compiling but its not working when i add a good in the radius or at all like my working code.
            Of course this doesn't work, instead of deleting one lines you deleted two lines, and none of them should be deleted. Actual one of them has to be modifed.

            And you have modified two lines, the first one is modified correctly but the second one doesn't look like, the one in NeedsCityGood. And obviously you didn't get this: GetNeedsCityGoodIndex returns an interger that represents an index into the resource database. An integer that represents a resource database index is expected by the [] operator of m_buyingResources and m_collectingResources. That should be now obviously.

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

            Comment


            • #66
              I havent seen this before:
              Code:
              F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(5411) : error C2446: '<' : no conversion from 'const class ResourceRecord *' to 'long'
                      This conversion requires a reinterpret_cast, a C-style cast or function-style cast
              F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(5411) : error C2040: '<' : 'long' differs in levels of indirection from 'const class ResourceRecord *'

              I did this...

              Code:
              	if(rec->GetNumNeedsCityGood() > 0) {
              		sint32 g;
              		bool found = false;
              		for(g = 0; g < (rec->GetNeedsCityGood(g)); g++) {
              			if((m_buyingResources[g] + m_collectingResources[g]) > 0) {
              				if((HasResource(g) || m_buyingResources[g]) && rec->GetNeedsCityGoodIndex(g)) 
              					break;
              				}
              			}
              				if(!found)
              				return FALSE;
              	}
              I'm leaving on vacation for tweeks so I hope I can figure out on my own before then.
              Formerly known as "E" on Apolyton

              See me at Civfanatics.com

              Comment


              • #67
                Originally posted by E
                I havent seen this before:
                Code:
                F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(5411) : error C2446: '<' : no conversion from 'const class ResourceRecord *' to 'long'
                        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
                F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(5411) : error C2040: '<' : 'long' differs in levels of indirection from 'const class ResourceRecord *'

                I did this...

                Code:
                	if(rec->GetNumNeedsCityGood() > 0) {
                		sint32 g;
                		bool found = false;
                		for(g = 0; g < (rec->GetNeedsCityGood(g)); g++) {
                			if((m_buyingResources[g] + m_collectingResources[g]) > 0) {
                				if((HasResource(g) || m_buyingResources[g]) && rec->GetNeedsCityGoodIndex(g)) 
                					break;
                				}
                			}
                				if(!found)
                				return FALSE;
                	}
                Originally posted by E
                I'm leaving on vacation for tweeks so I hope I can figure out on my own before then.
                Of course this doesn't compile, GetNeedsCityGood(g) returns a pointer on a resource database record. It can be converted to a number but you better don't do it, actual you shouldn't but in the condition of the for-loop on both sides the counting variable, that could lead to nice endless loops. In fact in the condition of the for-loop in the CityStyleOnly code you have there a GetNum function. And in your latest version you deleted the line where the found variable is set to true.

                Actual you already identified the line that contains the essential difference to your CityStyleOnly code:

                Originally posted by E
                Code:
                // Added by E - Compares Unit CityStyle to the CityStyle of the City
                	if(rec->GetNumCityStyleOnly() > 0) {
                		sint32 s;
                		bool found = false;
                		for(s = 0; s < rec->GetNumCityStyleOnly(); s++) {
                			[b]if(rec->GetCityStyleOnlyIndex(s) == m_cityStyle) {[/b]
                				found = true;
                				break;
                			}
                		}
                		if(!found)
                			return FALSE;
                	}
                The line in bold must contain another condition, and I already told you the condition, it's the sum of collected and incomming of a certain type of goods. The GetNeedsCityGoodIndex returns you an index for the good you want to check. Actual I already told you that in word:

                m_buyingResources[sint32]
                m_collectingResources[sint32]
                sint32 GetNeedsCityGoodIndex(sint32)

                So now put one and one together and do the code.

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

                Comment


                • #68
                  Martin, I'll give my code a shot but since you mde the civilsation.cdb I was wondering if using building and wonder attributes could be used to make Civilzation traits, like civ3 but much more diverse and better as an example I would add these flags to the cdb:
                  Code:
                  // for national flags
                  [b]   StringID              NationUnitFlag      [/b]
                  // from building.cdb to add Civilisation traits
                  	Bit(Float) OffenseBonusLand
                  	Bit(Float) OffenseBonusWater
                  	Bit(Float) OffenseBonusAir
                      Bit(Int)   HappyInc
                      Bit        DoubleTelevangelists
                      Bit(Float) ProductionPercent
                  	Bit(Float) FoodPercent
                  	Bit(Float) CommercePercent
                  	Bit(Float) SciencePercent
                      Bit        NoUnhappyPeople
                      Bit        NoRushBuyPenalty
                  	Bit(Float) LowerCrime
                  	Bit(Float) LowerPeaceMovement
                  	Bit(Int)   GoldPerCitizen
                  	Bit        ProtectFromNukes
                  	Bit(Float) ProtectFromBioAgents
                  	Bit(Float) ProtectFromNanoVirus
                  	Bit        Television
                  	Bit        Brokerage
                  	Bit        NuclearPlant
                  	Bit(Float) SciencePerPop
                  	Bit(Int)   RaiseOvercrowdingLevel
                  	Bit(Int)   RaiseMaxPopulation
                  	Bit(Int)   StarvationProtection
                  // from Wonder.cdb for additional civ attributes
                  	Bit(Int) ReduceReadinessCost
                  	Bit EmbassiesEverywhere
                  	Bit(Int) DecCrimePercent
                  	Bit(Int) IncKnowledgePercent
                  	Bit(Int) DecEmpireSize
                  	Bit(Int) IncHappinessEmpire
                  	Bit(Int) IncConvertedCitiesFeePercent
                  	Bit(Int) GoldPerWaterTradeRoute
                  	Bit(Int) GoldPerTelevision
                  	Bit GlobalRadar
                  	Bit SpiesEverywhere
                  	Bit(Int) GoldPerInternationalTradeRoute
                  	Bit ProtectFromBiologicalWarfare
                  	Bit(Int) PollutersToParks
                  	Bit(Int) ReduceWorldPollution
                  	Bit AllCitizensContent
                  	Bit EliminateNukes
                  	Bit AllBoatsDeepWater
                  	Bit(Int) IncreaseBoatMovement
                  	Bit FreeTradeRoutes
                  	Bit(Int) DecreaseMaintenance
                  	Bit(Int) RandomAdvanceChance
                  	Bit(Int) IncreaseHp
                  	Bit(Int) MultiplyTradeRoutes
                  	Bit(Int) IncreaseScientists
                  	Bit(Int) OtherCivRandomAdvanceChance
                  	Bit(Int) IncreaseProduction
                  	Bit(Int) BonusGold
                  	Bit(Int) IncreaseFoodAllCities
                  	Bit(Int) TemporaryFullHappiness
                  	Bit RevoltingCitiesJoinPlayer
                  	Bit NoPollutionUnhappiness
                  	Bit EmbassiesEverywhereEvenAtWar
                  	Bit(Int) IncreaseSpecialists
                  	Bit(Int) IncreaseCathedrals
                  	Bit(Int) IncreaseBrokerages
                  	Bit(Int) IncreaseRegard
                  	Bit PreventConversion
                  	Bit ProtectFromBarbarians
                  	Bit(Record Building) BuildingEverywhere
                  	Bit(Float) PollutionPercent
                  	Bit(Float) PollutionAmount
                  as for the one in bold should it be astring or should we make it a record. this would be code to add national flags to be displayed instead of the color flags for units. I figure I can get the tga info for the flag used and create a bunch of tgas for the national flags. I will take me a day to do all 44 civs but I think it would be nice. And I think I'd have to do that change in the DrawHerald code. but we can come back to this later
                  Formerly known as "E" on Apolyton

                  See me at Civfanatics.com

                  Comment


                  • #69
                    Originally posted by E
                    as for the one in bold should it be a string or should we make it a record.
                    Depends on what you want to do it with. Actual I would prefer to make it a string not a StringID, this way you don't have to modify any text files of the string databses, and all languages it would be the same.

                    Originally posted by E
                    this would be code to add national flags to be displayed instead of the color flags for units.
                    Why instead and not in addition?

                    Originally posted by E
                    I figure I can get the tga info for the flag used and create a bunch of tgas for the national flags. I will take me a day to do all 44 civs but I think it would be nice.
                    We have now 63 civs in the game since Locutus' interface update, and with a new interface the game could even now handle much more civs.

                    Originally posted by E
                    And I think I'd have to do that change in the DrawHerald code. but we can come back to this later
                    I am not sure whether it is so simple.

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

                    Comment


                    • #70
                      going through the code but on my compile I got this:

                      Code:
                      F:\SVN-Code\trunk\ctp2_code\gs\slic\SlicDBConduit.h(118) : error C2039: 'm_intArrayAccessor' : is not a member of 'EndGameObjectRecordAccessorInfo'
                              ..\gs\newdb\EndGameObjectRecord.h(163) : see declaration of 'EndGameObjectRecordAccessorInfo'
                              F:\SVN-Code\trunk\ctp2_code\gs\slic\SlicDBConduit.h(111) : while compiling class-template member function 'long __thiscall SlicDBConduit::GetValue(long,const char *,const long
                      )'
                      F:\SVN-Code\trunk\ctp2_code\gs\slic\SlicDBConduit.h(119) : error C2039: 'm_intArrayAccessor' : is not a member of 'EndGameObjectRecordAccessorInfo'
                              ..\gs\newdb\EndGameObjectRecord.h(163) : see declaration of 'EndGameObjectRecordAccessorInfo'
                              F:\SVN-Code\trunk\ctp2_code\gs\slic\SlicDBConduit.h(111) : while compiling class-template member function 'long __thiscall SlicDBConduit::GetValue(long,const char *,const long
                      )'
                      F:\SVN-Code\trunk\ctp2_code\gs\slic\SlicDBConduit.h(121) : error C2039: 'm_floatArrayAccessor' : is not a member of 'EndGameObjectRecordAccessorInfo'
                              ..\gs\newdb\EndGameObjectRecord.h(163) : see declaration of 'EndGameObjectRecordAccessorInfo'
                              F:\SVN-Code\trunk\ctp2_code\gs\slic\SlicDBConduit.h(111) : while compiling class-template member function 'long __thiscall SlicDBConduit::GetValue(long,const char *,const long
                      )'
                      F:\SVN-Code\trunk\ctp2_code\gs\slic\SlicDBConduit.h(122) : error C2039: 'm_floatArrayAccessor' : is not a member of 'EndGameObjectRecordAccessorInfo'
                              ..\gs\newdb\EndGameObjectRecord.h(163) : see declaration of 'EndGameObjectRecordAccessorInfo'
                              F:\SVN-Code\trunk\ctp2_code\gs\slic\SlicDBConduit.h(111) : while compiling class-template member function 'long __thiscall SlicDBConduit::GetValue(long,const char *,const long
                      )'
                      its not my code and i have the latest svn update.


                      but I did this code and it compiled, but I cant test it since the above errors prevent compiling ctp2.exe

                      Code:
                      	if(rec->GetNumNeedsCityGood() > 0) {
                      		sint32 g;
                      		bool found = false;
                      		for(g = 0; g < rec->GetNumNeedsCityGood(); g++) {
                      			if(rec->GetNeedsCityGoodIndex(g) == (m_buyingResources[g] + m_collectingResources[g]) > 0) {
                      				if((HasResource(g) || m_buyingResources[g]) && rec->GetNeedsCityGoodIndex(g)== g) 
                      					break;
                      			}
                      		}
                      				if(!found)
                      				return FALSE;
                      	}
                      Formerly known as "E" on Apolyton

                      See me at Civfanatics.com

                      Comment


                      • #71
                        Originally posted by E
                        going through the code but on my compile I got this:

                        [..]

                        its not my code and i have the latest svn update.
                        That's a problem of the *.dsw file, I commit an update, when I have done the DiffDB. (Actual this is the plan)

                        Originally posted by E
                        but I did this code and it compiled, but I cant test it since the above errors prevent compiling ctp2.exe

                        Code:
                        	if(rec->GetNumNeedsCityGood() > 0) {
                        		sint32 g;
                        		bool found = false;
                        		for(g = 0; g < rec->GetNumNeedsCityGood(); g++) {
                        			if(rec->GetNeedsCityGoodIndex(g) == (m_buyingResources[g] + m_collectingResources[g]) > 0) {
                        				if((HasResource(g) || m_buyingResources[g]) && rec->GetNeedsCityGoodIndex(g)== g) 
                        					break;
                        			}
                        		}
                        				if(!found)
                        				return FALSE;
                        	}
                        However this code doesn't work, now you have to modify one line, delete one line and add one line. You don't modify the found variable, that's bad.

                        And the other think is: What part of the following statement did you not understand?

                        <returns a good database index>GetNeedsCityGoodIndex
                        m_buyingResources[<exspects a good database index>]
                        m_collectingResources[<exspects a good database index>]

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

                        Comment


                        • #72
                          Originally posted by Martin Gühmann

                          Originally posted by E
                          going through the code but on my compile I got this:

                          [..]

                          its not my code and i have the latest svn update.

                          That's a problem of the *.dsw file, I commit an update, when I have done the DiffDB. (Actual this is the plan)
                          Well I forgot to mention the solution of course you have to recompile the EndGameObject.cdb manually. To do this just select the file in the tree view of MSVS and press Ctrl+F7.

                          Oh and please read again my last post especilly the last part I had some problem with this forum html-parser.

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

                          Comment


                          • #73
                            Originally posted by Martin Gühmann


                            However this code doesn't work, now you have to modify one line, delete one line and add one line. You don't modify the found variable, that's bad.

                            And the other think is: What part of the following statement did you not understand?

                            <returns a good database index>GetNeedsCityGoodIndex
                            m_buyingResources[<exspects a good database index>]
                            m_collectingResources[<exspects a good database index>]

                            -Martin

                            can you give me more detail as to what to add what to modify and what to delete? not the lines specifically but maybe explain why somethings have to be added, etc.

                            also for the add line. I'm assuming I have to replace the found = true line that I deleted, but in one post where I bolded everything you said the line to delete is below the bold which is the one I deleted.

                            as far as the statement, the part i guess I didnt understand is the bracket. I assumed that my twooptions were to not pass a variable (leave it blank) or pass the "g" variable. in which case the code only comiled if I passed the g. So how did I mess that up?

                            tonight I might start from scratch (again) and try to identify what needs to be changed and try to understand why it needs to be changed again although my old code worked.
                            Formerly known as "E" on Apolyton

                            See me at Civfanatics.com

                            Comment


                            • #74
                              Originally posted by E
                              can you give me more detail as to what to add what to modify and what to delete? not the lines specifically but maybe explain why somethings have to be added, etc.

                              also for the add line. I'm assuming I have to replace the found = true line that I deleted,
                              Actual you have to readd, otherwise your algorithm can't find out whether you have the needed good.

                              Originally posted by E
                              but in one post where I bolded everything you said the line to delete is below the bold which is the one I deleted.
                              The language difficuilies, actual I said: "but the line to delete is under the bold" it is under not below. A litteral translation into German can mean that it is one of the bold and according to Meriam Webster under can mean "within the group or designation of" in English and that is indeed the intended meaning: The line to delete is within the group of the bold. Otherwise I would be too specific. Obviously it can be very misstakable.

                              Originally posted by E
                              as far as the statement, the part i guess I didnt understand is the bracket. I assumed that my twooptions were to not pass a variable (leave it blank) or pass the "g" variable. in which case the code only comiled if I passed the g. So how did I mess that up?
                              The brakets, they form an operator something like plus or minus, the only difference is that it works on arrays or objects if they have such an operator defined.

                              It is index based, therefore it accepts everything that is integerlike. The output of the GetNeedsCityGoodIndex is an integer, to be precise it is sint32 representing an index into the Resource aka Good database.

                              If you know look at the operator of the Resource class then you see that it accesses the underlying m_supply array, and actual I asked you for the size of this array, the answer is that it has the same size as the Resource database, meaning each element of that array represents some piece of information of exactly one element in the Resource database. And of course the according infomation for one good can be found under the same index as the good in its database.

                              Again to this, actual I just have described it above, so the final conclusion is up to you. But just this: The output of one thing is the input of two other things.

                              <returns a good database index>GetNeedsCityGoodIndex

                              m_buyingResources[<exspects a good database index>]

                              m_collectingResources[<exspects a good database index>]


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

                              Comment


                              • #75
                                Ok, I think I figured what you are saying and it compiles and it works EXCEPT I removed the
                                Code:
                                ((m_buyingResources[g] + m_collectingResources[g]) > 0)
                                Not sure how to fit that back in... but here is the code and i did anothre compiled revision


                                Code:
                                	if(rec->GetNumNeedsCityGood() > 0) {
                                		sint32 g;
                                		bool found = false;
                                		for(g = 0; g < rec->GetNumNeedsCityGood(); g++) {
                                			if((HasResource(rec->GetNeedsCityGoodIndex(g))) || m_buyingResources[rec->GetNeedsCityGoodIndex(g)])
                                				found = true;
                                					break;
                                		}
                                				if(!found)
                                				return FALSE;
                                	}
                                Formerly known as "E" on Apolyton

                                See me at Civfanatics.com

                                Comment

                                Working...
                                X