Lemon's Spy Mod

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
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. ;)
 

lymond

Rise Up! (Phoenix Style!)
Moderator
Hall of Fame Staff
Joined
Mar 11, 2008
Messages
23,808

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
Location
Red Sector A
♫ Someone's getting a beating... ♪ :trouble:

:lol::lol::lol: :p
 

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
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. :)
 

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.
 

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
Location
Red Sector A
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.
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.

When I get a chance, I'm going to merge this with super spies.
Please do. :yup:
 

stolenrays

Deity
Joined
Aug 2, 2009
Messages
2,061

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.
 

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
Location
Red Sector A
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.
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.
 

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
Location
Red Sector A

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
 

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
Location
Red Sector A
I had a couple of questions, but I saw in another thread that you may have fixed this?
 

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
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. :)
 

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
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.
 

pepoluan

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