1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Lemon's Spy Mod

Discussion in 'Civ4 - Mod Components' started by Lemon Merchant, Jun 11, 2012.

  1. Lemon Merchant

    Lemon Merchant Professional Killjoy Moderator

    Joined:
    Jun 27, 2008
    Messages:
    7,350
    Gender:
    Female
    Location:
    Red Sector A
    Tired of having your spies have to trek back to your capital? Are they grumbling from being so tired after traveling though your massive empire? Ever wish that they would just return to the nearest city that you own?

    Well, now they can!

    This is an SDK/XML mod that creates a game option that allows spies to return to the nearest player city, instead of going all the way back to the capital. It's pretty simple, straightforward, and is made for merging. Read the included text file and you should be fine.

    Note that the only the changed files are included.

    You can find the download here: http://forums.civfanatics.com/downloads.php?do=file&id=19414

    I must thank Afforess for showing us all how to do this. ;)
     
  2. lymond

    lymond Rise Up! (Phoenix Style!) Hall of Fame Staff

    Joined:
    Mar 11, 2008
    Messages:
    20,591
    Well, they are female ;) :hide:
     
  3. Lemon Merchant

    Lemon Merchant Professional Killjoy Moderator

    Joined:
    Jun 27, 2008
    Messages:
    7,350
    Gender:
    Female
    Location:
    Red Sector A
    ♫ Someone's getting a beating... ♪ :trouble:

    :lol::lol::lol: :p
     
  4. Lemon Merchant

    Lemon Merchant Professional Killjoy Moderator

    Joined:
    Jun 27, 2008
    Messages:
    7,350
    Gender:
    Female
    Location:
    Red Sector A
    I noticed that there are 22 downloads, so far. Is anyone using this yet? Is it working correctly? I only had one machine to test it on this time, so I'm hoping that there are no issues. :)
     
  5. Jennvare

    Jennvare Prince

    Joined:
    Jan 10, 2010
    Messages:
    371
    If there was anything more I can ask for, it's chance for a spy to fail a mission, but still come out alive. There's nothing like losing a well experience spy for one failed mission. It's a big reason why I rarely use them. Atleast with high experienced units, they can have other units protect them when they are weakened or protect them with other units when attacked. You dont get that option with spies. It's either they live or they die.
     
  6. stolenrays

    stolenrays Deity

    Joined:
    Aug 2, 2009
    Messages:
    2,061
  7. Lemon Merchant

    Lemon Merchant Professional Killjoy Moderator

    Joined:
    Jun 27, 2008
    Messages:
    7,350
    Gender:
    Female
    Location:
    Red Sector A
    I like that idea. I had originally written this for BAT, so I left out anything really game changing like that, but maybe I'll take another looksie at the code and see if I can pull it off.

    Please do. :yup:
     
  8. stolenrays

    stolenrays Deity

    Joined:
    Aug 2, 2009
    Messages:
    2,061
  9. stolenrays

    stolenrays Deity

    Joined:
    Aug 2, 2009
    Messages:
    2,061
    I'm testing it out now. I found one thing I think you need to comment in CvUnit.cpp (I gave you a sample comment):

    Spoiler :
    Code:
    bool CvUnit::espionage(EspionageMissionTypes eMission, int iData)
    {
    /********************************************************************************
    *																				*
    *	Lemon's Spy Mod  - Lemon Merchant - 05/31/12								*
    *																				*
    *	Begin					*
    *																				*
    ********************************************************************************/
    	[B]bool Spync = false;[/B]
    // Lemon's Spy Mod End
    	if (!canEspionage(plot()))
    	{
    		return false;
    	}


    Cvplot and CvUnit are not needed for vanilla BTS.
     
  10. Lemon Merchant

    Lemon Merchant Professional Killjoy Moderator

    Joined:
    Jun 27, 2008
    Messages:
    7,350
    Gender:
    Female
    Location:
    Red Sector A
    Yes, you're right. I had originally put those lines in because VS2010 kept barking at me when I left them out, and the DLL wouldn't compile. Now I can leave them out and it doesn't, which is very weird.

    So it is safe to comment out the two lines that you have indicated.
     
  11. Cruel

    Cruel King

    Joined:
    Jun 22, 2005
    Messages:
    823
    Location:
    São Paulo, Brazil
    :goodjob:
     
  12. Lemon Merchant

    Lemon Merchant Professional Killjoy Moderator

    Joined:
    Jun 27, 2008
    Messages:
    7,350
    Gender:
    Female
    Location:
    Red Sector A
    I'm very flattered. Thank you! :D
     
  13. stolenrays

    stolenrays Deity

    Joined:
    Aug 2, 2009
    Messages:
    2,061
    Lemon, please take a look at the following code block. I can successfully merge your mod into super spies, but it seems as though the afforess mod disables super spies no matter as it is. Afforess's mod makes spies stay put after completing missions outside of cities.

    Spoiler :
    Code:
    /********************************************************************************
    *																				*
    *	Lemon's Spy Mod  - Lemon Merchant - 05/31/12								*
    *																				*
    *	Spies return to nearest player city, rather than capital					*
    *																				*
    ********************************************************************************/
    // Begin new code				
    				if (Spync)   // (LM) if the return to nearest city is selected in options return to nearest city
    				{
    					CvCity* pNearestCity = GC.getMapINLINE().findCity(getX_INLINE(), getY_INLINE(), getOwnerINLINE(), NO_TEAM, true, false, NO_TEAM, NO_DIRECTION );
    
    					if (pNearestCity != NULL)
    					{
    						setXY(pNearestCity->getX_INLINE(), pNearestCity->getY_INLINE(), false, false, false);
    
    						CvWString szBuffer = gDLL->getText("TXT_KEY_ESPIONAGE_SPY_SUCCESS", getNameKey(), pNearestCity->getNameKey());
    						gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), pNearestCity->getX_INLINE(), pNearestCity->getY_INLINE(), true, true);
    					}
    
    				}
    				else  // (LM) return to capital if option not selected
    				{
    					CvCity* pCapital = GET_PLAYER(getOwnerINLINE()).getCapitalCity();
    /************************************************************************************************/
    /* Afforess	                  Start		 07/12/10                                               */
    /*                                                                                              */
    /*Spy actions that aren't in a city don't cause the spy to be sent back                         */
    /************************************************************************************************/
    					if (!plot()->isCity())
    					{
    						pCapital = NULL;
    					}
    /************************************************************************************************/
    /* Afforess	                     END                                                            */
    /************************************************************************************************/
    					if (NULL != pCapital)
    					{
    						setXY(pCapital->getX_INLINE(), pCapital->getY_INLINE(), false, false, false);
    
    						CvWString szBuffer = gDLL->getText("TXT_KEY_ESPIONAGE_SPY_SUCCESS", getNameKey(), pCapital->getNameKey());
    						gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), pCapital->getX_INLINE(), pCapital->getY_INLINE(), true, true);
    					}
    					//TSHEEP Give spies xp for successful missions
    					awardSpyExperience(GET_PLAYER(eTargetPlayer).getTeam(),GC.getEspionageMissionInfo(eMission).getDifficultyMod());
    					//TSHEEP end
    				}
    
    			}
    //	End new code
     
  14. Lemon Merchant

    Lemon Merchant Professional Killjoy Moderator

    Joined:
    Jun 27, 2008
    Messages:
    7,350
    Gender:
    Female
    Location:
    Red Sector A
    I had a couple of questions, but I saw in another thread that you may have fixed this?
     
  15. stolenrays

    stolenrays Deity

    Joined:
    Aug 2, 2009
    Messages:
    2,061
  16. Lemon Merchant

    Lemon Merchant Professional Killjoy Moderator

    Joined:
    Jun 27, 2008
    Messages:
    7,350
    Gender:
    Female
    Location:
    Red Sector A
    Oh good. I was preoccupied with r/l for a bit and couldn't post as soon as I would have liked. I'm glad you got it to work. :)
     
  17. stolenrays

    stolenrays Deity

    Joined:
    Aug 2, 2009
    Messages:
    2,061
  18. Lemon Merchant

    Lemon Merchant Professional Killjoy Moderator

    Joined:
    Jun 27, 2008
    Messages:
    7,350
    Gender:
    Female
    Location:
    Red Sector A
    I think I added it for future modding. Or else it's just badly written code (more likely).

    I wrote it a while ago, and my understanding of C++ has improved since then. I'll have to look at it again and see.
     
  19. stolenrays

    stolenrays Deity

    Joined:
    Aug 2, 2009
    Messages:
    2,061
  20. pepoluan

    pepoluan Chieftain

    Joined:
    May 27, 2006
    Messages:
    94
    Location:
    Jakarta, Indonesia
    Interesting... I want to merge this with K-Mod, if allowed...
     

Share This Page