Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4

Author Topic: [LCS]Modding questions(CIA Raids without heat), compiling latest nightly  (Read 9907 times)

Taberone

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #30 on: August 29, 2015, 06:04:27 pm »

I have never seen this syntax. Appearently, the Modder used any new feature, his compilers has to offer, that wouldn't be bad for a new project, but breaks compatibility with a mod.
----
The Good news are, it is easy to fix:

To fix it :
 Replace this :
Code: [Select]
   for(const auto &aug:augmentations)
      xml.AddSubDoc(aug.showXml());

With that :
 
Code: [Select]
  for(int i=0;i<AUGMENTATIONNUM;i++)
    xml.AddSubDoc(augmentations[i].showXml());

I compiled LCS Nightly with it, and it seemed to work. I Implanted a Gorilla Heart into a Hippie, and quit. On reloding he still had the Gorilla Heart. (The line is used for saving the augementations)

After this all files should be able to be compiled. If you have further trouble, with compilation, check, if you linked any files from the sandbox directory, and remove them from the list.

---
The bad news are, I didn't manage to get it properly linked to SDL. To compile it without SDL, got to the includes.h and add at the begining the line
Code: [Select]
#define DONT_INCLUDE_SDLThen click "refresh all" to recompile everything without SDL, and it compiles and links.

For now, you should propably get it compiled and running so far. Maybe someone can help you with SDL or I will find it out in some time.

---
One thing I forget is the Icon. Got to Projekt settings, and there you can select an icon. It is found in the workspace directory.
Note also, that the executable must be in the "Liberal-Crime-Squad-Nightly" directory, to find the curses.dll in its directory and the XML files under art\... .



Replaced the Augmentation live and defined to not include SDL. Compiled and then that happened.
Logged

Purple Gorilla

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #31 on: August 30, 2015, 06:33:19 am »

The heart of the Problem is the line :
Code: [Select]
ncurses.h : no such file or directoryThe rest are errors, because of the missing curses macros.
The macros in common.h should use curses.h instead of ncurses.h.
I don't see, wich file caused the problem; next time you post such a screenshot, you should make the collumn with the path wider, by dragging the bars that separate the headline "line|file|...".

However, the line with the error is 1. Most official LCS source files have the GNU License at the beginning before the code begins, so they can't include commons.h in the first line. The exeptions are the files in sandbox, witch should not be compiled.

So do try the following :
*Go to the directory src\sandbox
*Open the Project in a different window
*Try to compile it
*Check, if the file that couldn't be compiled is in the sandbox directory
*If yes remove the file from the list on the left; retry compiling

In fact, these files should NOT be part of the Project :
* creature_factory_test.cpp
* creature_namegen_test.cpp
* creature_test.cpp
* creature_type_test.cpp
* saveload_boost.cpp

Taberone

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #32 on: August 30, 2015, 11:33:28 pm »

The heart of the Problem is the line :
Code: [Select]
ncurses.h : no such file or directoryThe rest are errors, because of the missing curses macros.
The macros in common.h should use curses.h instead of ncurses.h.
I don't see, wich file caused the problem; next time you post such a screenshot, you should make the collumn with the path wider, by dragging the bars that separate the headline "line|file|...".

However, the line with the error is 1. Most official LCS source files have the GNU License at the beginning before the code begins, so they can't include commons.h in the first line. The exeptions are the files in sandbox, witch should not be compiled.

So do try the following :
*Go to the directory src\sandbox
*Open the Project in a different window
*Try to compile it
*Check, if the file that couldn't be compiled is in the sandbox directory
*If yes remove the file from the list on the left; retry compiling

In fact, these files should NOT be part of the Project :
* creature_factory_test.cpp
* creature_namegen_test.cpp
* creature_test.cpp
* creature_type_test.cpp
* saveload_boost.cpp

I didn't include the sandbox folder for compiling, so the test .cpp files are not part of the project.



Removed the "n" from "ncurses" and





Also I tried modding my regular LCS(Not the Nightly I'm compiling) and added in a P90 and Five SeveN. I tried to make them both sellable by gangsters and mercenaries, but only the P90 appears for sale.

Logged

Reelya

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #33 on: August 31, 2015, 03:06:57 am »

"Undeclared" generally means you're missing a header file link. Cpp files used header files to tell each other what services are available. Seeing "undeclared" means one of the cpp files isn't linking to the header files it needs, you can look for the string LCSCreateFile and work out why that's not happening.

So, you need to make sure the names e.g. LCSCreateFile are somewhere on the include path for the file dumpcaps.cpp. If it's not, then that's pretty odd unless you actually removed an #include statement yourself.

BTW if you stop seeing "undeclared" errors and get "undefined" errors instead, that's a good sign. That's what you get when everything is correctly described at the header-level, and the program is trying to stitch all the modules together. "undefined" means one of the cpp files or a library is missing. Don't worry about this until you get all the includes working.

Purple Gorilla

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #34 on: August 31, 2015, 01:48:33 pm »

Oh, sorry. I forgot the dumpcaps.cpp, what is not a part of the game too.

Further would it be important, which file caused all the problem, before you changed ncurses.h in curses.h, and in which file you changed it. It seems, there is still a file too much in the project. If it all was in dumpcaps.cpp then removing it from the project should solve all problems, otherwise there might be a file too much too. The file commons.h which all proper source files include, checks for the constnad WIN32, and then includes curses.h instead of ncurses.h, so it shoudn't be necessary to change a line.

For the problem with the XML :
* There seem to be no hard limits to number of weapons, number of shopitems, or stringlength, so I assume it is a syntax error somewhere.
* Did you close the <item> block with </item>
* Are the descriptor strings (WEAPON_SEMIPISTOL_FIVESEVEN) in WEAPONS.XML and ARMSDEALER.XML exactly the same ? Maybe you should rename it to WEAPON_SEMIPISTOL_57, WEAPON_FIVESEVEN or something to avoid typos.
* Is the entry in WEAPONS.XML correct. To check, comment it out (embrace it with <!--    -->), copy the entry of another weapon, and rename it to WEAPON_SEMIPISTOL_FIVESEVEN. Does this work ? If yes, there is a mistake in the WEAPONS.XML entry

Taberone

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #35 on: August 31, 2015, 11:42:23 pm »

Oh, sorry. I forgot the dumpcaps.cpp, what is not a part of the game too.

Further would it be important, which file caused all the problem, before you changed ncurses.h in curses.h, and in which file you changed it. It seems, there is still a file too much in the project. If it all was in dumpcaps.cpp then removing it from the project should solve all problems, otherwise there might be a file too much too. The file commons.h which all proper source files include, checks for the constnad WIN32, and then includes curses.h instead of ncurses.h, so it shoudn't be necessary to change a line.

For the problem with the XML :
* There seem to be no hard limits to number of weapons, number of shopitems, or stringlength, so I assume it is a syntax error somewhere.
* Did you close the <item> block with </item>
* Are the descriptor strings (WEAPON_SEMIPISTOL_FIVESEVEN) in WEAPONS.XML and ARMSDEALER.XML exactly the same ? Maybe you should rename it to WEAPON_SEMIPISTOL_57, WEAPON_FIVESEVEN or something to avoid typos.
* Is the entry in WEAPONS.XML correct. To check, comment it out (embrace it with <!--    -->), copy the entry of another weapon, and rename it to WEAPON_SEMIPISTOL_FIVESEVEN. Does this work ? If yes, there is a mistake in the WEAPONS.XML entry



Almost there.



Also what should the Project Type be, and how do I set the icon for LCS to be the newspaper thing?



As for the XML thing, this is the name for the Five SeveN and how it appears in the shop.
Logged

Purple Gorilla

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #36 on: September 01, 2015, 02:36:01 pm »

From the Linker output, I see two Problems:
* multiple definition of main : This means one of the sandbox files or the DUMPCAPS.CPP are still part of the project. The startup code of a C-Programme calls the main() function, and every C-programme must have exactly one main function. The main() function of LCS is inside the GAME.CPP. The files in the sandbox directory and dumpcaps (maybe others too ?) are standalone programmes, that have their own main() function. If one of them is still in the project, this error happens. To fix it use search->search in files  [CTRL+ALT+F], and search for main(   (with the bracket). You should than find files wich have a line like int main(int argc, char* argv[]). The file GAME.CPP should have this line, but all other files with such a line should not be part of the project, so remove them in the menu in the left.
* The Symbols Mix_blabla are SDL symbols, so it still trys to link to the SDL library. You said, you already added the line #define DONT_INCLUDE_SDL in INCLUDES.H . So, first check, if it is right - the top of the INCLUDES.H should now look like that :
Code: [Select]
/*
    File created by Chris Johnson.
    These were previously all in game.cpp.

    This file includes all the the enums, defines, and included headers required globally by all components.

    All code released under GNU GPL.
*/
#ifndef INCLUDES_H_INCLUDED
#define INCLUDES_H_INCLUDED
#define DONT_INCLUDE_SDL
/*
   DEBUG DEFINES
*/
// Don't save the game
//#define NOSAVE
...
Note, the #define DONT_INCLUDE_SDL

Second, recompile everything. To do this go to execute->refresh all [CTRL+F11]. Then, it should work

The project-type should be WIN32 Console, as it is using Textmode. (I'm not sure if curses needs this, but some error-messages use the console)

For the Icon, click Browse (right from there you set the project type to console), and use the LCS_NEWS_ICON.ICO from the directory workspaces, the full path for you should be "C:\Users\Alan\Desktop\ERIC RUTH GAMES\Liberal-Crime-Squad-nightly\workspaces\lcs_news_icon.ico"

----
In the ARMSDEALER.XML, you DID not close the item block, as I said already. It is now clear, because the department block ends after it. It should be :
Code: [Select]
...
 <item>
   <class>WEAPON</class>
   <type>WEAPON_SEMIPISTOL_FIVESEVEN</type>
   <price>2000</price> 
 </item>
</department>
( note the </item>)

Further, did you add ammo for the new weapons ? They need an entry in ARMSDEALER.XML too, and must be created in CLIPS.XML .

Taberone

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #37 on: September 03, 2015, 09:29:30 pm »

From the Linker output, I see two Problems:
* multiple definition of main : This means one of the sandbox files or the DUMPCAPS.CPP are still part of the project. The startup code of a C-Programme calls the main() function, and every C-programme must have exactly one main function. The main() function of LCS is inside the GAME.CPP. The files in the sandbox directory and dumpcaps (maybe others too ?) are standalone programmes, that have their own main() function. If one of them is still in the project, this error happens. To fix it use search->search in files  [CTRL+ALT+F], and search for main(   (with the bracket). You should than find files wich have a line like int main(int argc, char* argv[]). The file GAME.CPP should have this line, but all other files with such a line should not be part of the project, so remove them in the menu in the left.
* The Symbols Mix_blabla are SDL symbols, so it still trys to link to the SDL library. You said, you already added the line #define DONT_INCLUDE_SDL in INCLUDES.H . So, first check, if it is right - the top of the INCLUDES.H should now look like that :
Code: [Select]
/*
    File created by Chris Johnson.
    These were previously all in game.cpp.

    This file includes all the the enums, defines, and included headers required globally by all components.

    All code released under GNU GPL.
*/
#ifndef INCLUDES_H_INCLUDED
#define INCLUDES_H_INCLUDED
#define DONT_INCLUDE_SDL
/*
   DEBUG DEFINES
*/
// Don't save the game
//#define NOSAVE
...
Note, the #define DONT_INCLUDE_SDL

Second, recompile everything. To do this go to execute->refresh all [CTRL+F11]. Then, it should work

The project-type should be WIN32 Console, as it is using Textmode. (I'm not sure if curses needs this, but some error-messages use the console)

For the Icon, click Browse (right from there you set the project type to console), and use the LCS_NEWS_ICON.ICO from the directory workspaces, the full path for you should be "C:\Users\Alan\Desktop\ERIC RUTH GAMES\Liberal-Crime-Squad-nightly\workspaces\lcs_news_icon.ico"

----
In the ARMSDEALER.XML, you DID not close the item block, as I said already. It is now clear, because the department block ends after it. It should be :
Code: [Select]
...
 <item>
   <class>WEAPON</class>
   <type>WEAPON_SEMIPISTOL_FIVESEVEN</type>
   <price>2000</price> 
 </item>
</department>
( note the </item>)

Further, did you add ammo for the new weapons ? They need an entry in ARMSDEALER.XML too, and must be created in CLIPS.XML .



Do I remove the int main() in this part? Only other place thats not Game.CPP where theres an int main()



Recompiling got me to this part



As for creating clips in Armsdealer.xml(Not the LCS thats being compiled, different LCS version, forgot to clarify) what letter do I assign for the FN 5.7 Mag and P90 Mag? One that won't conflict with any other letter? (Separate ammo for the Five SeveN and P90 because the Five SeveN has 20 rounds and the P90 has 50. Not sure how I can get the same ammo to have different capacity for different weapons.)
« Last Edit: September 03, 2015, 11:21:20 pm by Taberone »
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #38 on: September 03, 2015, 09:41:41 pm »

First up, you need to be aware that editing code is almost never required to get a working program to compile. It's basically guaranteed to just break things more. You should be asking "is this file meant to be in the project, or not?" rather than "do i need to edit this file". The files are already edited - it's a working program. You've just got the wrong files in there or the linkage isn't specified correctly in your compiler settings.

Basically just delete the extra file that has another "main". That entire file is part of a completely separate program.

From a broader perspective, if you find yourself actually editing code to make an already working program compile, then you're probably just breaking things even further. It's a working program, if it's not compiling then the code isn't the problem - your problem is your compiler settings, i.e:

- having too many files that don't belong (the files from the testing part are not part of the game, and are causing conflicts)

- using the wrong versions of external libraries - this happens when you are linking things to a library that wasn't provided with the project, you could be using a newer or older version of the library that's not compatible with the project

- not setting up your include paths correctly

- having cpp files missing that are needed, this will causes the "undefined" errors in the final linker stage

If you're getting stuck in making edits to cpp and .h files I can almost guarantee that you're going to find you need to undo all the edits later on when you work out what the problem with your compiler is.
« Last Edit: September 03, 2015, 10:01:17 pm by Reelya »
Logged

Purple Gorilla

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #39 on: September 04, 2015, 01:57:39 pm »

As I told you twice to remove the DUMPCAPS.CPP from the project, and Reelya told you too, there seems to be a misunderstanding.

Go to the menu on the left, there the files of the project are listed, and seek the DUMPCAPS.CPP. Then click right, and pick "delete file". This will remove it from the project.

----
To the ammo problem. Shop items should generally have individual letters. The game doesn't check that weapon you are wielding, for the shop options, as magazines are individual items, not a variable on a weapon. (You can also buy ammo, while wielding the wrong weapon, the ammo is then placed in the squad equipment).

So, you either let them use the same magazines, with the same number of shots, or make two different magazines as different shop items.

Ammo is bit inconsistent anyway : All rifles use the same magazines, despite the AK-47 beeing a different caliber, while the MP5 and the 9mm Semiauto use different magazines wich are both 9mm 15 shot (thought the real-life MP5 uses 30 shot magazines).

Taberone

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #40 on: September 04, 2015, 07:40:51 pm »

As I told you twice to remove the DUMPCAPS.CPP from the project, and Reelya told you too, there seems to be a misunderstanding.

Go to the menu on the left, there the files of the project are listed, and seek the DUMPCAPS.CPP. Then click right, and pick "delete file". This will remove it from the project.

----
To the ammo problem. Shop items should generally have individual letters. The game doesn't check that weapon you are wielding, for the shop options, as magazines are individual items, not a variable on a weapon. (You can also buy ammo, while wielding the wrong weapon, the ammo is then placed in the squad equipment).

So, you either let them use the same magazines, with the same number of shots, or make two different magazines as different shop items.

Ammo is bit inconsistent anyway : All rifles use the same magazines, despite the AK-47 beeing a different caliber, while the MP5 and the 9mm Semiauto use different magazines wich are both 9mm 15 shot (thought the real-life MP5 uses 30 shot magazines).



Dumpcaps.cpp is already deleted. Deleted the cursesgraphics file(It was the test one) and any other test files and it still gave the errors in vehicle and vehicletype

First up, you need to be aware that editing code is almost never required to get a working program to compile. It's basically guaranteed to just break things more. You should be asking "is this file meant to be in the project, or not?" rather than "do i need to edit this file". The files are already edited - it's a working program. You've just got the wrong files in there or the linkage isn't specified correctly in your compiler settings.

From a broader perspective, if you find yourself actually editing code to make an already working program compile, then you're probably just breaking things even further. It's a working program, if it's not compiling then the code isn't the problem - your problem is your compiler settings, i.e:

- having too many files that don't belong (the files from the testing part are not part of the game, and are causing conflicts)

- using the wrong versions of external libraries - this happens when you are linking things to a library that wasn't provided with the project, you could be using a newer or older version of the library that's not compatible with the project

- not setting up your include paths correctly

- having cpp files missing that are needed, this will causes the "undefined" errors in the final linker stage

If you're getting stuck in making edits to cpp and .h files I can almost guarantee that you're going to find you need to undo all the edits later on when you work out what the problem with your compiler is.

Would it be a good time to start from square one?
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #41 on: September 04, 2015, 09:50:52 pm »

I'd say you'd be best off having two separate build to see how that works out. You've learnt a lot about using the compiler from the first effort. Don't ditch the work you've put in, but it is always worth trying things with a vanilla version of the program if you've made changes that might have broken things (and it's really easy to break programs by making changes, this happens all the time for programmers).

Even as a programmer sometimes you do hav to rollback to an earlier version of your own program because you made a lot of changes and broke stuff, and can't work out which part broke things. In those situations, I re-implement the changes one at a time, and in doing so I normally discover where the error was. But always keep the "broken" version for references just in case.

Purple Gorilla

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #42 on: September 05, 2015, 08:24:16 am »

Do you get warnings or errors ? When I compile it, I get warnings about type conversions, in vehicle and vehicletype, but this is no problem, it still compiles. If the only problems are compiler warnings, then you are maybe already done. Check of if you can run it. If you get a black window, that crashes immideadly, the you are done (to prevent it from chrashing, copy the executable in the same directory as the art directory or wise versa). If you get a message like "Project not compiled", then there are still actual errors.

If you want to start from scratch, remeber, that three changes were necessary, the nullptr to NULL, the for loop, and the DONT_INCLUDE_SDL are necessary. Everything else is probably a problem with the compiler settings.

Taberone

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #43 on: September 06, 2015, 10:12:21 am »

I'll get around to trying to compile again eventually, but in the mean time I've been finishing a mod for the R855 release of LCS that gives the Conservatives a wider variety of weapons along with adding in 3 new weapons and making the M249/AA12 sellable by gangbangers.



Gang Members can't sell Sniper Rifle Clips for some reason. Is there a way to add a second page to the store??
« Last Edit: September 06, 2015, 11:54:18 am by Taberone »
Logged

Purple Gorilla

  • Bay Watcher
    • View Profile
Re: [LCS]Modifying game messages + Compiling LCS Nightly?
« Reply #44 on: September 06, 2015, 01:06:08 pm »

Congratulation, you just found a bug.

According to the source code, both fullscreen and halfscreen shops support multiple pages. The half screen shop, you are seeing,  has code to display multiple pages, and code for buying from them, but there is no code, to change the page.

The fullscreen shop however has code for turning the pages with arrow keys. In older versions, gangmembers and mercenaries used the fullscreen shop, so what you are doing, would work there.

If you can compile it, it should also be possible to mod it in yourself. The function is void Shop::browse_halfscreen(squadst& customers, int& buyer) const in SHOP.CPP


This is the code for parsing a keypress :
Code: [Select]
     if(c=='e' && customers.squad[0]->base!=-1)
         equip(location[customers.squad[0]->base]->loot,-1);
      else if(c=='s'&&allow_selling_&&len(location[customers.squad[0]->base]->loot))
         sell_loot(customers);
      else if(c=='m'&&sell_masks_&&ledger.get_funds()>=15)
         maskselect(*customers.squad[buyer]);
      else if(c=='b') choose_buyer(customers,buyer);
      else if(c=='0') party_status=-1;
      else if(c>='1'&&c<='6')
      {
         if(customers.squad[c-'1']!=NULL)
         {
            if(party_status==c-'1')
               fullstatus(party_status);
            else party_status=c-'1';
         }
      }
      else if(c=='x'||c==ENTER||c==ESC||c==SPACEBAR) break;


This should work :
Code: [Select]
      if(c=='e' && customers.squad[0]->base!=-1)
         equip(location[customers.squad[0]->base]->loot,-1);
      else if(c=='s'&&allow_selling_&&len(location[customers.squad[0]->base]->loot))
         sell_loot(customers);
      else if(c=='m'&&sell_masks_&&ledger.get_funds()>=15)
         maskselect(*customers.squad[buyer]);
      else if(c=='b') choose_buyer(customers,buyer);
      else if(c=='0') party_status=-1;
      else if(c>='1'&&c<='6')
      {
         if(customers.squad[c-'1']!=NULL)
         {
            if(party_status==c-'1')
               fullstatus(party_status);
            else party_status=c-'1';
         }
      }
      else if(c=='x'||c==ENTER||c==ESC||c==SPACEBAR) break;
      //PAGE UP
      else if((c==interface_pgup||c==KEY_UP||c==KEY_LEFT)&&page>0) page--;
      //PAGE DOWN
      else if((c==interface_pgdn||c==KEY_DOWN||c==KEY_RIGHT)&&(page+1)*19<len(available_options)) page++;
I copied the lines from the fullscreen shop, and replaced the 'if' with 'else if'. It compiles, but I can't try it out so far, as it needs many items to work.
Pages: 1 2 [3] 4