Announcement

Collapse
No announcement yet.

E's Source Code attempts

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

  • Originally posted by Martin Gühmann


    According to the crash.txt the crash is caused by something that is called by the BeginTurnImprovements method. Maybe you should recompile again or even better you should use the debug version of the executable.
    yeah i had that tidbit in the beginturnimps so i figure its the source or the crash but not sure how...

    If you add a parameter to the parameter list of a function and you don't add the parameter in question everywhere it is used you get linker errors as you got.

    -Martin
    would adding the parameter crash things or should it be ok?


    on another note:

    Code:
    BOOL ArmyData::MoveIntoForeigner(const MapPoint &pos)
    {
    	CellUnitList defender;
    	g_theWorld->GetArmy(pos, defender);
    
    	if(defender.Num() <= 0)
    		return FALSE;
    
    	BOOL i_died = FALSE;
    
    	PLAYER_INDEX defense_owner = defender.GetOwner();
    //EMOD
    	if (AgreementMatrix::s_agreements.HasAgreement(defense_owner, m_owner, PROPOSAL_TREATY_DECLARE_WAR) && 
    
    //outcommented because not called?
    //	if (IsEnemy(defense_owner) && 
    //		!g_player[m_owner]->WillViolateCeaseFire(defense_owner) &&
    //		!g_player[m_owner]->WillViolatePact(defense_owner) &&
    		CanFight(defender)) { 
    
    [i]...somecode...[/i]
    
    BOOL ArmyData::VerifyAttack(UNIT_ORDER_TYPE order, const MapPoint &pos,
    							sint32 defense_owner)
    {
    //EMOD
    	if (!AgreementMatrix::s_agreements.HasAgreement(defense_owner, m_owner, PROPOSAL_TREATY_DECLARE_WAR))
    
    //outcommented original
    //	if(IsEnemy(defense_owner) &&
    //	   !g_player[m_owner]->WillViolateCeaseFire(defense_owner) &&
    //	   !g_player[m_owner]->WillViolatePact(defense_owner))
    // EMOD
    		{
    			SlicObject *so = new SlicObject("110bCantAttackHaveTreaty") ;
    			so->AddRecipient(m_owner);
    			so->AddCivilisation(defense_owner);
    			so->AddUnit(m_array[0]);
    			so->AddLocation(pos);
    			so->AddOrder(order);
    			g_slicEngine->Execute(so);
    			g_selected_item->ForceDirectorSelect(Army(m_id));
    			return FALSE;
    		}
    // end EMOD
    		return TRUE;
    
    [i]...somecode...[/i]
    and corresponding script.slc
    Code:
    alertBox '110bCantAttackHaveTreaty' {
    	Text(ID_CANT_ATTACK_HAVE_TREATY);
    
    	MessageType("DIPLOMATIC");
    	
    
    	Button(ID_BUTTON_NO) {
    		ClearOrders(unit[0]);
    		Kill();
    	}
    
    	Button(ID_BUTTON_YES) {
    		//BreakAlliance(player[0]);
    		DeclareWar(player[0]);
    		AddOrder(unit[0], location[0]);
    		Kill();
    	}
    }
    I added the DeclareWar because I saw it was a SLIc function in the c3cmdline.cpp like breakalliance is (the original code). So far the pop up works when you are not at war but selecting yes to declare war doesnt work (beforeI assume it just brokethe alliance but didnt allowed the war) so I wonder why the declare war i added doesnt work? So far the popup works and you have to declare war in the diplo window then you can attack. A little cumbersome but it prevents accidental wars. How can I fix this?
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

    Comment


    • Originally posted by E
      would adding the parameter crash things or should it be ok?
      There shouldn't be any problems.

      Originally posted by E
      and corresponding script.slc
      Code:
      alertBox '110bCantAttackHaveTreaty' {
      	Text(ID_CANT_ATTACK_HAVE_TREATY);
      
      	MessageType("DIPLOMATIC");
      	
      
      	Button(ID_BUTTON_NO) {
      		ClearOrders(unit[0]);
      		Kill();
      	}
      
      	Button(ID_BUTTON_YES) {
      		//BreakAlliance(player[0]);
      		DeclareWar(player[0]);
      		AddOrder(unit[0], location[0]);
      		Kill();
      	}
      }
      I added the DeclareWar because I saw it was a SLIc function in the c3cmdline.cpp like breakalliance is (the original code). So far the pop up works when you are not at war but selecting yes to declare war doesnt work (beforeI assume it just brokethe alliance but didnt allowed the war) so I wonder why the declare war i added doesnt work? So far the popup works and you have to declare war in the diplo window then you can attack. A little cumbersome but it prevents accidental wars. How can I fix this?
      Why don't you get any slic errors. The DeclareWar function should through an incorrect number of arguments error.

      First argument is sender, second argument is the receiver, both players are represented by integers.

      Now what happens if you try to attack team mates in MP?

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

      Comment


      • I dont know why it doesn't give Slic errors. maybe declare war is not implemented?

        I never played MP, maybe MAQ can say something...

        but for the code for teammates in MP they souldnt be affected because the code I have keeps that message there. I changed !WillViolate to !Agreement DeclareWar.

        I think the restricting thing was that it looked for !WillViolate which doesnt seem to be used.

        but it does look like verifyattack is only used for mp play. do you think i should pull my code out of there and add it elsewhere (maybe a separate function?) I do see it impacting my sneakattack code as implemented now...
        Last edited by Ekmek; March 21, 2006, 18:58.
        Formerly known as "E" on Apolyton

        See me at Civfanatics.com

        Comment


        • Originally posted by E
          I dont know why it doesn't give Slic errors. maybe declare war is not implemented?
          If you don't know whether it is implemented than look it. Anyway in my version of the code it is implemented. I guess is that you disabled DebugSlic in your userprofile.txt.

          Originally posted by E
          I never played MP, maybe MAQ can say something...

          but for the code for teammates in MP they souldnt be affected because the code I have keeps that message there. I changed !WillViolate to !Agreement DeclareWar.

          I think the restricting thing was that it looked for !WillViolate which doesnt seem to be used.

          but it does look like verifyattack is only used for mp play. do you think i should pull my code out of there and add it elsewhere (maybe a separate function?) I do see it impacting my sneakattack code as implemented now...
          The problem I see is that there is something wrong with IsEnemy. It just checks whether the other player is not an team mate and whether there is no alliance. Than it adds whether there is no cease fire and if there is no eco pact, anti-pollution or trade pact. But a piece treaty isn't on the list and the way check isn't there either.

          In most cases you don't have a treaty at all meaning no piece, no cease fire or no alliance - noting. That's why the program fails.

          Now we have to fix it. And one problem is that in MP it should be impossible to attack ones team mates. But this is possible onces the message is working as expected.

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

          Comment


          • This is the code I have and it checks everything EXCEPT f you are at war. But my messages keep saying {player1.civ_plural} and not the civ name and yes doesnt do anything when I click it.


            Code:
            BOOL ArmyData::VerifyAttack(UNIT_ORDER_TYPE order, const MapPoint &pos,
            							sint32 defense_owner)
            {
            	if (!AgreementMatrix::s_agreements.HasAgreement(defense_owner, m_owner, PROPOSAL_TREATY_DECLARE_WAR)){
            
            	   
            	SlicObject *so;
            	if(g_network.IsActive() && g_network.TeamsEnabled() &&
            	   g_player[m_owner]->m_networkGroup == g_player[defense_owner]->m_networkGroup) {
            		so = new SlicObject("110aCantAttackTeammates");
            	} else if(!IsEnemy(defense_owner)) {
            		so = new SlicObject("110CantAttackAllies");
            	} else {
            		so = new SlicObject("110bCantAttackHaveTreaty");
            	}
            
            	so->AddRecipient(m_owner);
            	so->AddCivilisation(defense_owner);
            	so->AddUnit(m_array[0]);
            	so->AddLocation(pos);
            	so->AddOrder(order);
            	g_slicEngine->Execute(so);
            	g_selected_item->ForceDirectorSelect(Army(m_id));
            	return FALSE;
            	}
            	return TRUE;
            }

            Also why is my compiler throwing up thousands of warnings? it didnt do that before.
            Formerly known as "E" on Apolyton

            See me at Civfanatics.com

            Comment


            • Originally posted by E
              This is the code I have and it checks everything EXCEPT f you are at war.
              Actually the code checks if you are at war and if not show a message. The code seems to be ok since the team mates shouldn't be at war.

              Originally posted by E
              But my messages keep saying {player1.civ_plural} and not the civ name and yes doesnt do anything when I click it.
              It rather says something else, anyway it is a leftover from CTP1 and noone updated the message. I am fixing it.

              For the button we may have to work, but so far I don't know whether you modified the slic code so that the DeclareWar can declare war. Use as first argument the unit's owner.

              Originally posted by E
              Also why is my compiler throwing up thousands of warnings? it didnt do that before.
              If you don't give me at least a few of these warnings I can only specualte maybe you have raised the warning level.

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

              Comment


              • Originally posted by Martin Gühmann

                It rather says something else, anyway it is a leftover from CTP1 and noone updated the message. I am fixing it.
                cool thanks. But would fixing the message cause backward compatibility problems with mods? Thats why I stuck to this message (110b) because it was close enough still allow cradle etc to work without the code calling for a message not in the script. I guess it wouldnt be hard to put a mod playtest patch together.

                For the button we may have to work, but so far I don't know whether you modified the slic code so that the DeclareWar can declare war. Use as first argument the unit's owner.
                Sorry, I did modify the slic to say declarewar(player[0], player[1]) and nothing happened. So I think it might be a source code issue. And I did put debug slic to YES and DeclareWar with both arguments didnt throw up errors (but I did find out that I havent updated to the 9-15-05 txt files on the SVN, )

                If you don't give me at least a few of these warnings I can only specualte maybe you have raised the warning level.
                How do I adjust the warning settings? I dont recall playing with them but maybe i did it on accident. In the meantime my ctp2.plg file is getting huge its at 1.6mb. Actually I have the plg file in my build (do I need it there?) and it has all the warnings there (I cant get into a RAR at work)
                Formerly known as "E" on Apolyton

                See me at Civfanatics.com

                Comment


                • Originally posted by E
                  cool thanks. But would fixing the message cause backward compatibility problems with mods? Thats why I stuck to this message (110b) because it was close enough still allow cradle etc to work without the code calling for a message not in the script. I guess it wouldnt be hard to put a mod playtest patch together.
                  I don't mind too much about full compatibility as long as it does not crash and the message contains some kind of string it is okay in my eyes. Of course you could rename the message ID so that we have a new one, actually one that does not tell us there is a treaty even if there is not a treaty but just a state of war absence.

                  Originally posted by E
                  Sorry, I did modify the slic to say declarewar(player[0], player[1]) and nothing happened. So I think it might be a source code issue. And I did put debug slic to YES and DeclareWar with both arguments didnt throw up errors (but I did find out that I havent updated to the 9-15-05 txt files on the SVN, )
                  Maybe you could try something like this:
                  declarewar(unit[0].owner, player[0]);

                  Of course you can modify the source code, but with the unit - the attacker unit - you have all pieces of information together you need.

                  Originally posted by E
                  How do I adjust the warning settings? I dont recall playing with them but maybe i did it on accident. In the meantime my ctp2.plg file is getting huge its at 1.6mb. Actually I have the plg file in my build (do I need it there?) and it has all the warnings there (I cant get into a RAR at work)
                  You can delete ctp2.plg, but be warned it is regenerated while you are compiling the project. To lower the warning level: Click on the Project menu option on the main menu bar then Settings. Then you get a popup window with settings click on the C/C++ tab and set there the warning level to level 3, if it isn't on level 3.

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

                  Comment


                  • Originally posted by Martin Gühmann
                    Maybe you could try something like this:
                    declarewar(unit[0].owner, player[0]);

                    Of course you can modify the source code, but with the unit - the attacker unit - you have all pieces of information together you need.
                    tis is the slic i'm using but still the yes doesn't declare war BUT the civ name works, thanks!

                    Code:
                    alertBox '110CantAttackAllies' {
                    	if(AllUnitsCanBeExpelled(location[0])) {
                    		Text(ID_CANT_ATTACK_ALLIES_CAN_EXPEL);
                    	} else {
                    		Text(ID_CANT_ATTACK_ALLIES);
                    	}
                    
                    	MessageType("DIPLOMATIC");
                    	
                    
                    	Button(ID_BUTTON_NO) {
                    		ClearOrders(unit[0]);
                    		Kill();
                    	}
                    
                    	Button(ID_BUTTON_YES) {
                    		//BreakAlliance(player[0]);
                    		Declarewar(unit[0].owner, player[0]);
                    		AddOrder(unit[0], location[0]);
                    		Kill();
                    	}
                    
                    	if(AllUnitsCanBeExpelled(location[0])) {
                    		Button(ID_BUTTON_EXPEL) {
                    			AddExpelOrder(unit[0], location[0]);
                    			Kill();
                    		}
                    	}
                    }
                    You can delete ctp2.plg, but be warned it is regenerated while you are compiling the project. To lower the warning level: Click on the Project menu option on the main menu bar then Settings. Then you get a popup window with settings click on the C/C++ tab and set there the warning level to level 3, if it isn't on level 3.
                    my settings were on 4 and i see a box 'warning as errors' not checked. But I'm still getting a lot of warnings like:

                    Code:
                    C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xlocale(296) : warning C4663: C++ language change: to explicitly specialize class template 'codecvt' use the following syntax:
                            template<> class codecvt ...
                    C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xlocale(387) : warning C4018: '<' : signed/unsigned mismatch
                    C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xlocale(519) : warning C4663: C++ language change: to explicitly specialize class template 'ctype' use the following syntax:
                            template<> class ctype ...
                    C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\vector(249) : warning C4663: C++ language change: to explicitly specialize class template 'vector' use the following syntax:
                            template<> class vector > ...
                    ..\ui\netshell\netfunc.h(392) : warning C4244: '+=' : conversion from 'int' to 'unsigned char', possible loss of data
                    ..\ui\netshell\netfunc.h(413) : warning C4244: 'argument' : conversion from 'int' to 'unsigned char', possible loss of data
                    ..\ui\netshell\ns_gamesetup.h(194) : warning C4244: 'return' : conversion from 'int' to 'char', possible loss of data
                    ..\ui\netshell\ns_gamesetup.h(200) : warning C4244: 'return' : conversion from 'const int' to 'char', possible loss of data
                    ..\ui\netshell\ns_gamesetup.h(205) : warning C4244: 'return' : conversion from 'int' to 'char', possible loss of data
                    ..\ui\netshell\ns_gamesetup.h(211) : warning C4244: 'return' : conversion from 'const int' to 'char', possible loss of data
                    ..\ui\netshell\ns_gamesetup.h(216) : warning C4244: 'return' : conversion from 'int' to 'char', possible loss of data
                    ..\ui\netshell\ns_gamesetup.h(222) : warning C4244: 'return' : conversion from 'const int' to 'char', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\installationdata.h(27) : warning C4097: typedef-name 'GameObj' used as synonym for class-name 'GAMEOBJ'
                    ..\robot\pathing\Path.h(29) : warning C4244: 'argument' : conversion from 'enum WORLD_DIRECTION' to 'signed char', possible loss of data
                    C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\list(30) : warning C4510: '_Node' : default constructor could not be generated
                            C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\list(27) : see declaration of '_Node'
                            ..\gs\events\GameEventHook.h(119) : see reference to class template instantiation 'std::list >' being compiled
                    C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\list(30) : warning C4610: struct '_Node' can never be instantiated - user defined constructor required
                            ..\gs\events\GameEventHook.h(119) : see reference to class template instantiation 'std::list >' being compiled
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Vision.h(145) : warning C4244: '+=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Vision.h(147) : warning C4244: '-=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Vision.h(153) : warning C4244: '+=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Vision.h(155) : warning C4244: '-=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Vision.h(157) : warning C4244: '-=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Vision.h(159) : warning C4244: '+=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(108) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(110) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(112) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(119) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(120) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(121) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(123) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(125) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(127) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(180) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(181) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(182) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(198) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(201) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(204) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(212) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(215) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(218) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(356) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(357) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(358) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(360) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(361) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(362) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(364) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(365) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(366) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(381) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(383) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(385) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(424) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(428) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(432) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(522) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(523) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(524) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(526) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(527) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(528) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(530) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(531) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(532) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(542) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(543) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(544) : warning C4244: '=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(546) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(548) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(550) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(581) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(584) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\gfx_utils\pixelutils.h(587) : warning C4244: '=' : conversion from 'int' to 'short', possible loss of data
                    ..\gfx\spritesys\Anim.h(81) : warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
                    ..\gfx\spritesys\Anim.h(85) : warning C4244: 'argument' : conversion from 'enum ANIMTYPE' to 'unsigned short', possible loss of data
                    ..\gfx\spritesys\FacedSprite.h(100) : warning C4244: 'return' : conversion from 'const unsigned int' to 'unsigned short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(3514) : warning C4244: '+=' : conversion from 'double' to 'long', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(4245) : warning C4245: '=' : conversion from 'const int' to 'unsigned long', signed/unsigned mismatch
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(6866) : warning C4244: '-=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(6867) : warning C4244: '+=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(7046) : warning C4244: '+=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(7050) : warning C4244: '+=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(7058) : warning C4244: '-=' : conversion from 'int' to 'short', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(7696) : warning C4244: '+=' : conversion from 'double' to 'long', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(7759) : warning C4244: '+=' : conversion from 'double' to 'long', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(7765) : warning C4244: '+=' : conversion from 'double' to 'long', possible loss of data
                    F:\SVN-Code\trunk\ctp2_code\gs\gameobj\CityData.cpp(7770) : warning C4244: '+=' : conversion from 'double' to 'long', possible loss of data
                    Last edited by Ekmek; March 23, 2006, 00:06.
                    Formerly known as "E" on Apolyton

                    See me at Civfanatics.com

                    Comment


                    • Not tooverload you Martin but by accident I created a way to have units of different countries occupy the same cell. I was trying to add sneakattack to the moveintoforiegner and i did this code:

                      Code:
                      BOOL ArmyData::MoveIntoForeigner(const MapPoint &pos)
                      {
                      	CellUnitList defender;
                      	g_theWorld->GetArmy(pos, defender);
                      
                      	if(defender.Num() <= 0)
                      		return FALSE;
                      
                      	BOOL i_died = FALSE;
                      
                      	PLAYER_INDEX defense_owner = defender.GetOwner();
                      //EMOD
                      	if (AgreementMatrix::s_agreements.HasAgreement(defense_owner, m_owner, PROPOSAL_TREATY_DECLARE_WAR) && 
                      
                      //outcommented because not called?
                      //	if (IsEnemy(defense_owner) && 
                      //		!g_player[m_owner]->WillViolateCeaseFire(defense_owner) &&
                      //		!g_player[m_owner]->WillViolatePact(defense_owner) &&
                      		CanFight(defender)) { 
                      
                      		
                      		InformAI(UNIT_ORDER_FINISH_ATTACK, pos); 
                      
                      		sint32 numCloaked = 0;
                      		for(sint32 i = 0; i < defender.Num(); i++) {
                      			if(defender.m_array[i].IsCloaked())
                      				numCloaked++;
                      		}
                      		if(numCloaked >= defender.Num() || m_array[0].AccessData()->PacMan()) {
                      			defender.KillList(CAUSE_REMOVE_ARMY_UNKNOWN, GetOwner());
                      		} else {
                      
                      			bool allSingleUse = true;
                      			sint32 i;
                      			for(i = 0; i < m_nElements; i++) {
                      				if(!m_array[i].GetDBRec()->GetSingleUse()) {
                      					allSingleUse = false;
                      					break;
                      				}
                      			}
                      
                      			Army me(m_id);
                      			if(!allSingleUse) {
                      				g_gevManager->AddEvent(GEV_INSERT_AfterCurrent,
                      									   GEV_Battle,
                      									   GEA_Army, me,
                      									   GEA_MapPoint, pos,
                      									   GEA_End);
                      			}
                      
                      			
                      			for(i = 0; i < m_nElements; i++) {
                      				if(m_array[i].GetDBRec()->GetSingleUse()) {
                      					static CellUnitList defender;
                      					defender.Clear();
                      					g_theWorld->GetArmy(pos, defender);					
                      
                      					MapPoint nonConstPos = pos;
                      					g_director->AddAttackPos(m_array[i], nonConstPos);
                      					m_array[i].Bombard(defender, FALSE);
                      
                      					for(sint32 j = 0; j < defender.Num(); j++) {
                      						if(defender[j].GetHP() < 0.5) {
                      							g_gevManager->AddEvent(GEV_INSERT_AfterCurrent,
                      												   GEV_KillUnit,
                      												   GEA_Unit, defender[j].m_id,
                      												   GEA_Int, CAUSE_REMOVE_ARMY_BOMBARD,
                      												   GEA_Player, m_owner,
                      												   GEA_End);
                      						}
                      					}
                      
                      					g_gevManager->AddEvent(GEV_INSERT_AfterCurrent,
                      										   GEV_KillUnit,
                      										   GEA_Unit, m_array[i].m_id,
                      										   GEA_Int, CAUSE_REMOVE_ARMY_SINGLE_USE,
                      										   GEA_Player, -1,
                      										   GEA_End);										   
                      				}
                      			}
                      			return FALSE;
                      		}
                      	} else {
                      //EMOD to allow for sneak attacks without popup	
                      		Unit ta = GetTopVisibleUnit(g_selected_item->GetVisiblePlayer());
                      
                      	
                      		if (ta.m_id == 0) {
                      			ta = m_array[0];
                      		}
                      
                      		Unit td = defender.GetTopVisibleUnit(g_selected_item->GetVisiblePlayer()); 
                          
                      	
                      		if (td.m_id == 0) {
                      			td = defender[0];
                      		}
                      		
                      		bool AlltaSneakAttack = true;
                      		sint32 i;
                      		for (i = m_nElements - 1; i>= 0; i--) {   //for(i = 0; i < m_nElements; i++) {
                      			if(!m_array[i].GetDBRec()->GetSneakAttack()){
                      				AlltaSneakAttack = false;
                      				break;
                      			}
                      		}
                      	
                      	
                      		if (ta.m_id == 0) {
                      			if(!m_array[0].GetDBRec()->GetSneakAttack()){
                      				AlltaSneakAttack = false;
                      			}
                      		}
                      
                      
                      		bool AllDefSneakAttack = true;
                      		for(i = 0; i < defender.Num(); i++) {
                      			if(!defender[i].GetDBRec()->GetSneakAttack()){
                      				AllDefSneakAttack = false;
                      				break;
                      			}
                      		} 
                      
                      		if (td.m_id == 0) {
                      			if(!defender[0].GetDBRec()->GetSneakAttack()){
                      				AllDefSneakAttack = false;
                      			}
                      		}
                      		
                      	
                      		if(!AlltaSneakAttack && !AllDefSneakAttack){
                      //end EMOD
                      			VerifyAttack(UNIT_ORDER_MOVE_TO, pos, defense_owner);
                      			return FALSE;
                      		}//EMOD
                      
                      
                      	}
                      	return TRUE;
                      }
                      So I opened the potential for civ4 like movement but I think I can make it another flag, like IgnoreOccupiedCell.

                      even weirder, when I added
                      Code:
                      ...above code...
                      
                      		if(!AlltaSneakAttack && !AllDefSneakAttack){
                      //end EMOD
                      			VerifyAttack(UNIT_ORDER_MOVE_TO, pos, defense_owner);
                      			return FALSE;
                      		} else {//EMOD
                      		if(IsEnemy(defense_owner) &&
                      	   !g_player[m_owner]->WillViolateCeaseFire(defense_owner) &&
                      	   !g_player[m_owner]->WillViolatePact(defense_owner))
                      
                      	   				g_gevManager->AddEvent(GEV_INSERT_AfterCurrent,
                      									   GEV_Battle,
                      									   GEA_Army, me,
                      									   GEA_MapPoint, pos,
                      									   GEA_End);
                      		return TRUE; 
                      		} //EMOD
                      I got the battle event BUT i also had to fiht my identical unit that kept my color but added to the defender (And it beat me after the real defender was killed... real weird.

                      EDIT: I finally got it working by:
                      Code:
                      ..above code..
                      
                      		if(!AlltaSneakAttack && !AllDefSneakAttack){
                      //end EMOD
                      			VerifyAttack(UNIT_ORDER_MOVE_TO, pos, defense_owner);
                      			return FALSE;
                      		} else {//EMOD
                      			Fight(defender);
                      
                      		} //EMOD
                      	}
                      	return FALSE;
                      I think thats the best way because trying the events didnt do it.
                      Last edited by Ekmek; March 23, 2006, 01:21.
                      Formerly known as "E" on Apolyton

                      See me at Civfanatics.com

                      Comment


                      • Originally posted by E
                        tis is the slic i'm using but still the yes doesn't declare war BUT the civ name works, thanks!
                        At least we came closer to it. Now we have to figure out why it does not work. There are now two parts that might not work. First part is the declare war action, you can use the diplo overview to check this. The second part is the unit move, if this does not work the unit is left without movement, but should be selected, once you have pressed the yes button.

                        If the latter work but not the declare war part than the message should pop up again to ask you whether to attack.

                        Originally posted by E
                        my settings were on 4 and i see a box 'warning as errors' not checked. But I'm still getting a lot of warnings like:
                        Well recompiling everything should help. Maybe you wait until you have to do it anyway.

                        Originally posted by E
                        Not tooverload you Martin but by accident I created a way to have units of different countries occupy the same cell. I was trying to add sneakattack to the moveintoforiegner and i did this code:
                        Actually it overloads. However experimenting with the MoveUnits event I also was able to move units of two civs on one tile. I even was able to group them into one army. Unfortunately the game crashed when I tryed to move the stack.

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

                        Comment


                        • well, i got declaring war to work BUT the add orders causes an 0 is out ofarray slic crash. I tried turning it to unit owner and stuff and looked for other examples but I think the slic event called in army data is the problem because it doesnt send the unit info to the message (my best guess)

                          Code:
                          alertBox '110bCantAttackHaveTreaty' {
                          	Text(ID_CANT_ATTACK_HAVE_TREATY);
                          
                          	MessageType("DIPLOMATIC");
                          	
                          
                          	Button(ID_BUTTON_NO) {
                          		ClearOrders(unit[0]);
                          		Kill();
                          	}
                          
                          	Button(ID_BUTTON_YES) {
                          		//BreakAlliance(player[0]);
                          		DeclareWar(g.player, player[0]);
                          		//AddOrder(unit[0], location[0]);
                          		Kill();
                          	}
                          }

                          If the AddOrders isn't do able should we change the ldl.txt from
                          "This action will break our treaty with the {player[0].civ_name_plural}. Are you sure you wish to continue?"
                          to something like
                          "This action is an act of War! Do you REALLY want to declare war on the {player[0].civ_name_plural}?"

                          then the yes would declare war, but then you'd have to do the action again. Also there is no pop-up to say that war was declared (hitting yes just changes the diplomacy settings). I did have it where clicking yes had the other civ declare war on you (which is what happened when you accidentally attacked) but I changed it because I think there is a regard hit for the side that declares war (right?)










                          PS Google language tools gave me this for translating my new text so we can do that for the ldl
                          French
                          Cette action est un acte de guerre! Faites-vous veulent VRAIMENT déclarer la guerre sur

                          German
                          Diese Tätigkeit ist eine Kriegshandlung! Tun Sie Sie möchten WIRKLICH Krieg auf erklären

                          Italian
                          Questa azione è un atto della guerra! Facciali REALMENTE desiderano dichiarare la guerra con

                          Spanish
                          ¡Esta acción es un acto de la guerra! Hágale REALMENTE desean declarar guerra en
                          Last edited by Ekmek; March 24, 2006, 12:21.
                          Formerly known as "E" on Apolyton

                          See me at Civfanatics.com

                          Comment


                          • Originally posted by E
                            well, i got declaring war to work BUT the add orders causes an 0 is out ofarray slic crash. I tried turning it to unit owner and stuff and looked for other examples but I think the slic event called in army data is the problem because it doesnt send the unit info to the message (my best guess)
                            Well I looked into the source code and so far I have no idea why this happens there are now two possibilities since you didn't tell me which of the two arrays are out of bounce: The unit array, the location array or maybe both.

                            At least it seems that the unit array isn't filled outherwise the owner retrievemenet would work and therefore DeclareWar as well. What you can do is to put into a message the unit owner as number and the x and y coordinates as numbers as well so that we can see wether this is correct.

                            Originally posted by E
                            then the yes would declare war, but then you'd have to do the action again. Also there is no pop-up to say that war was declared (hitting yes just changes the diplomacy settings). I did have it where clicking yes had the other civ declare war on you (which is what happened when you accidentally attacked) but I changed it because I think there is a regard hit for the side that declares war (right?)
                            Actually it is the action of the player and thus he has to declare war, not the victim.

                            Originally posted by E
                            PS Google language tools gave me this for translating my new text so we can do that for the ldl
                            Well here is an example in German, maybe slight colloquial:

                            Mal gucken was bei solch einer Roboterübersetzung herauskommt.

                            Let's see what we get with such a robot translation:

                            Times look which with such a robot translation comes out.

                            Well all these three sentences above are suposed to mean the same. However mal can mean times if you use it like 2 times 3. But not here and to translate it with time isn't such a good idea either.

                            A "let's" is much better in this context. Maybe the German version is just an abbrivieation of: "Lasst uns mal gucken...". "look" and "see" are exchangeable, but for some reason I prefer see. What and which: "Was" doesn't seem to be used as a relative pronoun, so for me a what seems to be better, but I maybe wrong. And finally have a look at the world order: "comes out" - the verb at the end of a sentence you can't this in English, but you must do this in a German subordinate clause.

                            Well I prefer my own translation or better my own words. These might not be free of errors, but they contain much less errors than a simple robot translation.

                            And in German your the message is something like:

                            "This action is an act of War! Do you REALLY want to declare war on the {player[0].civ_name_plural}?"
                            "Diese Aktion kommt einer Kriegserklärung gleich! Wollen Sie wirklich den {player[0].civ_name_plural#DAT} den Krieg erklären?"

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

                            Comment


                            • Originally posted by Martin Gühmann


                              Well I looked into the source code and so far I have no idea why this happens there are now two possibilities since you didn't tell me which of the two arrays are out of bounce: The unit array, the location array or maybe both.
                              I hit YES to continue on the crash and it came up again so I'm assuming both arrays were out of bounds

                              At least it seems that the unit array isn't filled outherwise the owner retrievemenet would work and therefore DeclareWar as well. What you can do is to put into a message the unit owner as number and the x and y coordinates as numbers as well so that we can see wether this is correct.
                              Actually it is the action of the player and thus he has to declare war, not the victim.
                              Good, the my set up works as it should (in the declaring war part)


                              "This action is an act of War! Do you REALLY want to declare war on the {player[0].civ_name_plural}?"
                              "Diese Aktion kommt einer Kriegserklärung gleich! Wollen Sie wirklich den {player[0].civ_name_plural#DAT} den Krieg erklären?"
                              hmm I gues we'll still need translators

                              A "quick" question on the Database and how it loads. I noticed the problem with my enablesgood cose is that the good is only available from an improvement if that good exists"in nature" (that is as a normal good) somewhere on the map.

                              So that leads me to believe that with each game a "custom" ResourceDB is built based on the resources that get randomly placed on the map. Where can I find how thats done and have it load all resources (atleast once) all the time?
                              Formerly known as "E" on Apolyton

                              See me at Civfanatics.com

                              Comment


                              • Originally posted by E
                                I hit YES to continue on the crash and it came up again so I'm assuming both arrays were out of bounds
                                Than I can assume this, too. However I looked into the source code and it seemed that there they are filled in prperly. It might be a general problem with location and unit arraies in the message boxes. But that is a little bit hard to figure out. However you could figure out whether putting an army into the slic context works.

                                Originally posted by E
                                hmm I gues we'll still need translators
                                Yes, we still need translators. By the way did you try the robot translation on my German text bit? Have some fun with robot translation.

                                Originally posted by E
                                A "quick" question on the Database and how it loads. I noticed the problem with my enablesgood cose is that the good is only available from an improvement if that good exists"in nature" (that is as a normal good) somewhere on the map.

                                So that leads me to believe that with each game a "custom" ResourceDB is built based on the resources that get randomly placed on the map. Where can I find how thats done and have it load all resources (atleast once) all the time?
                                Not really a custom ResourceDB, however there is some kind of resource map that contains good prbabilities or prices or whatever. That might be recomputed.

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

                                Comment

                                Working...
                                X