Redefining a function?

I use a public source code for something and it contains some functions in the source code that I always remove. I always customize this source code so it's a lot better but I still get updates from them every once in a while and make my changes, because it's easier than making as many updates as they do myself. There are 3 defines I want to remove, portion of some structures I want removed, and a few functions I want removed.

I know I could just do a "search and replace" and then change the structures manually (I just have #undefine for the defines in my separate source I added.) But this is just much more of a pain for me, so if there's any way to just make ALL these changes I want to make in one source and then download their copy and add my ONE source to it to fix everything, that would be great. Look below for some examples of what I'm trying to do.

Their Source [example #1]
1
2
3
4
5
6
7
8
9
10
11
12
13
VOID ChangeUIColor(VOID)
{
    PCSCOMMAND pCmd=pCommands;
    int i;
    while(pCmd) {
        if (pCmd->UI==0) 
         {
            //
            for(i=0;i<sizeof(UIColors);i++) UIColor++;
         }
    }
  pCmd=pCmd->pNext;
}


My Source (added to their project)
1
2
//Redefining ChangeUIColor function to do nothing
VOID ChangeUIColor = {//} 


Their Source [example #2]
1
2
3
4
5
6
7
8
9
10
11
12
typedef struct _ServerData {
/*0x000*/ DWORD ServerID;
/*0x004*/ BYTE Second; //How long it's been running
/*0x005*/ BYTE Minute;
/*0x006*/ BYTE Hour
/*0x007*/ BYTE Day;
/*0x008*/ BYTE Month;
/*0x009*/ DWORD Year;
/*0x00D*/ BYTE MapID
/*0x00E*/ float Location[0x3]; //X, Y and Z of host
/*0x1A*/
} ServerData, *pServerData;


My Source (added to their project)
1
2
3
4
5
6
7
//Note that I actually want to RENAME the
//Location floats to the below names, I know
//this doesn't accomplish that - I'm just asking how
ServerData sd;
sd.Location[0x1] = float CurXLoc;
sd.Location[0x2] = float CurYLoc;
sd.Location[0x3] = float CurZLoc;


I'm almost positive that the first example can be done. To globally redefine a function to do something else, or nothing if that's what I decide. This source code is a DLL with several source and header files and I had a question about that. Would it matter if my custom source was compiled before or after the source containing this function?

I also am undefining a few #define's in their source code because they have some dynamic variables defined statically for whatever reason. Such as CurrentWeapon is #define'd to 0 (with different weapons having different ID's.) I use these dynamic variables in a few of my addons and when I do a code like this..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
typedef struct _MyInfo
{
/*0x000*/ DWORD SelfID; //Unique ID #
/*0x004*/ DWORD CurHP;
/*0x008*/ DWORD CurArmor;
/*0x00C*/ DWORD Played; //Play time on current server
/*0x010*/ DWORD CurrentWeapon; //Weapons.h for full list
/*0x014*/ float CurXLoc;
/*0x018*/ float CurYLoc;
/*0x01C*/ float CurZLoc;
/*0x020*/
} CurSetup, *pCurSetup;

#define CurXLoc 0
#define CurYLoc 0
#define CurZLoc 0
#define CurrentWeapon 0

CHAR *GetWeaponNameByID(int WeaponID)
{
//Pull WeaponID from memory structure
    CurSetup Me;
    DWORD MyWeaponID = Me.CurrentWeapon;

//Call function to get weapon name from it's ID
  CHAR *WeaponName = Call__GetWeaponNameByID__Function(MyWeaponID);

//Return weapons name
  return WeaponName;
}


I also have it for a function I made that uses CurXLoc, CurYLoc and CurZLoc. So I think I made my problem as crystal clear as possible, hopefully someone has the answers. To sum it all up, I basically need to add a CPP (source) file to a current DLL project with several CPP and H (header) files already in it.

I need this one custom source file that I add to change around the source however I want, same as search/replace would but simpler. This includes removing, changing the name, editing, and everything in between to any function, define, or variable that I want to whatever I want. Whew, I think that's about it. Thanks a lot!!
So is this not possible or is it just that no one wants to read my little essay? hehe.. Any comments, good or bad, would be nice if anyone has some ideas. Thanks ;)
No, AFAIK, you can't redefine functions...you could overload them, but then the other functions would still exist and could cause problems.
Topic archived. No new replies allowed.