Contents
Back
Forward

13. Developing Scenarios and distributing them


13.1 Compiling and Linking a CSPL program manually
The process of taking a source code and transforming it into an executable file consist of two phases:
compiling and linking.
These phases should be executed automatically by CSPLCompanion, however it may be useful to have a description about how to compile and link manually CSPL programs.
Borland 5.5 comes with two programs; a compiler (BCC32.EXE) and a linker (ILINK32.EXE)
They have a lot of complex options but we are not interested in listing them all.
(BTW: I wrote a batch file CSPLCompanion that should automatize this process and you can find its doc in the appendix A anyway, if something goes wrong may be interesting to see how to compile and link the program manually)
LetŽs say we have coded our CSPL program in two files called csplclient.cpp and csplclient.h; to compile it I suggest the following command line (remember to copy cspl.h file in the same directory as csplclient.cpp !):
BCC32 -c -w- -W csplclient.cpp
    -c option just says compiler to compile only and not launch linker automatically (we need to configure the linker before launching it)
    -w- deactivates Warnings messages
    -W just warns compiler that final executable will be a windows 9x program
The output of compiler will be the file csplclient.obj, an intermediate step between .cpp and .exe
Now you need to call the linker on this object file to finish the work (remember to copy cspl.res and cspl.lib in the same directory of csplclient.obj !)
Here is the right command line:
ILINK32 /aa c0w32.obj csplclient.obj,csplclient.exe,,cspl.lib import32.lib cw32.lib,,cspl.res
(a bit complex, don't you think?)
     /aa warns linker that final .exe will be a windows 32 application
     c0w32.obj is just an initialization module
     csplclient.obj is the name of the object file we obtained through compiling phase
     csplclient.exe is the final name of the executable we will obtain
     cspl.lib is obviously the cspl library
     import32.lib and cw32.lib are two libraries of borland compiler
     cspl.res is resource file for CSPL (it contains info about graphic and menu of CSPL program)
If all goes well, at the end of the linking phase youŽll have your program ready to use (csplclient.exe as we wrote in linker command line)


13.2 Releasing CSPL scenarios
If you want to use CSPL in your scenarios youŽll have to follow these guidelines:
  1. "Register" CSPL
  2. Let the "About CSPL Box" as it is in the template of the CSPL Client
  3. Writes in your readme file a warning about security problems of CSPL scenarios (read section Security Issue)
  4. Add source-code of your CSPL Client


13.3 Security Issue
As we saw during the tutorial the end of CSPL process is the creation of an exe file that will be executed on computers of a lot of civ players; this issues a lot of security problems (what if some malicious designer creates an event to format an hard-disk if a particular unit is killed?), the problems youŽll find to face are the same security problems youŽll face executing foreign executables on your computer.
Premising that CSPL (and its programmer…) cannot be held responsable for damage caused by hostile use of CSPL I want here to suggest some ways to avoid this problem:
  1. Every CSPL designer should add the source-code and makefile of CSPL client with the corresponding scenario; in this way everyone can check the sourcecode and test for its harmless.
  2. Every user worried about security should re-compile the source-code on his computer before using it (this means he has to download CSPL and Borland Compiler).
  3. Every web site hosting scenarios should execute passes 1 & 2 to certify CSPL scenarios as clean.
These are only suggestions obviously, personally I think IŽll apply 1 for each scenario of mine (since it can be useful also as tutorial) and I will apply 2 before trying any CSPL scenario, you can also "trust" other scenario designers, but if viruses or other bad things reach your computer through CSPL youŽve to remember that I warned you…


13.3 Registering CSPL
As you can see, i worked really hard to realize this library, but i don't want to make you pay for using CSPL, so i've decided to make CSPL cardware.
In other words if you've found this library useful, what about sending me a greetings postcard from your country?
the address is reported below:
Angelo Scotto
Casella Postale
CAP 23036
Teglio (SO)
Italy
(No mailbombs, it is not my personal address, it is just the address of the post office...)

If for some strange reasons you find CSPL useful but you can't send me a postcard don't worry, just remember to give me credits in your future CSPL programs.





Contents / Introduction
Chapter I / Chapter II / Chapter III / Chapter IV / Chapter V / Chapter VI / Chapter VII
Chapter VIII / Chapter IX / Chapter X / Chapter XI / Chapter XII / Chapter XIII
Appendix A / Appendix B / Appendix C