Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Adds Supported for Stored Templates #1946

Closed
wzdev-ci opened this issue Jun 25, 2010 · 13 comments
Closed

Adds Supported for Stored Templates #1946

wzdev-ci opened this issue Jun 25, 2010 · 13 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_patch (an actual patch, not a request for one) | by EvilGuru


The following patch adds support for saving/loading stored templates.

Stored templates are those which are made available automatically as soon as all prerequisites are researched. The idea is to save the player the burden of having to design the same set of templates every game.

There is currently no support for creating stored templates, however I plan to add a button in the unit design screen. In addition I am also considering bringing the forces editor back from the dead.

To get you started: (~/.warzone2100-trunk/templates.ini)

[template0]
name                           = Medium Cannon Cobra Half Tracks
brain                          = 0
body                           = 32
propulsion                     = 15
repair                         = 0
ecm                            = 0
sensor                         = 0
construct                      = 0
numweaps                       = 1
weap0                          = 99
type                           = 0

Issue migrated from trac:1946 at 2022-04-15 22:03:55 -0700

@wzdev-ci
Copy link
Contributor Author

EvilGuru uploaded file storedtemplates.patch (16.3 KiB)

@wzdev-ci
Copy link
Contributor Author

EvilGuru uploaded file storedtemplates2.patch (21.6 KiB)

@wzdev-ci
Copy link
Contributor Author

EvilGuru commented


The updated version of the patch adds support for modifying templates through the design screen. This is done through a button above the delete/recycle template button.

Currently, due to a lack of suitable icons, the recycle bin # not stored and the turret stored. Click to toggle.

Now, I am sure there are a couple bugs with regards to toggling templates, the logic is a bit ad-hoc as a consequence of how the design screen handles changes/updates to templates.

Please test!

@wzdev-ci
Copy link
Contributor Author

KukY commented


Nice, but wouldn't it be better if template components were stored by IDs?
Reffer to #1905

Will test...

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jun 25, 2010

EvilGuru commented


Replying to Warzone2100/old-trac-import#1946 (comment:2):

Nice, but wouldn't it be better if template components were stored by IDs?
Reffer to #1905
I did see that; my conclusion what whatever method I used to serialise the template was at the mercy of Zarel. Neither seem that intuitive to me and any breakage incurred will be minor (a template changes its type).

@wzdev-ci
Copy link
Contributor Author

KukY commented


I get this while compiling:

------ Build started: Project: Warzone2100, Configuration: Debug Win32 ------
Generating the autorevison.h file...
'svnversion' is not recognized as an internal or external command,
operable program or batch file.
'svn' is not recognized as an internal or external command,
operable program or batch file.
'git' is not recognized as an internal or external command,
operable program or batch file.
'git' is not recognized as an internal or external command,
operable program or batch file.
Revision unchanged (10957). Skipping.
old # "10957"; new "10957"
Generating parser based on grammar...
..\src\scriptvals_parser.y: conflicts: 4 shift/reduce
Generating parser based on grammar...
Generating lexical analyser...
Generating lexical analyser...
Generating lexical analyser...
Compiling...
action.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
challenge.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
component.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
design.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
display.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
display3d.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
drive.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
droid.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
frontend.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
c:\wz\trunk\src\frontend.c(653) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(675) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(687) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(699) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(711) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(853) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(857) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(861) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(933) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(945) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(950) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(954) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(966) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(1127) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(1138) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(1150) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(1163) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(1173) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(1277) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(1293) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(1307) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
c:\wz\trunk\src\frontend.c(1319) : warning C4245: 'function' : conversion from 'int' to 'UDWORD', signed/unsigned mismatch
game.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
hci.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
ingameop.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
init.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
intdisplay.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
c:\wz\trunk\src\intdisplay.c(1249) : warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'WIDGET_DISPLAY'
intelmap.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
intimage.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
intorder.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
keyedit.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
c:\wz\trunk\src\keyedit.c(159) : warning C4054: 'type cast' : from function pointer 'void (__cdecl *)(void)' to data pointer 'void *'
loadsave.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
loop.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
Generating Code...
c:\wz\trunk\src\hci.c(6092) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\hci.c(6098) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\game.c(4207) : warning C4702: unreachable code
c:\wz\trunk\src\game.c(563) : warning C4701: potentially uninitialized local variable 'colour' used
c:\wz\trunk\src\game.c(564) : warning C4701: potentially uninitialized local variable 'team' used
c:\wz\trunk\src\droid.c(793) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\droid.c(793) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\display.c(683) : warning C4701: potentially uninitialized local variable 'dragY' used
c:\wz\trunk\src\display.c(681) : warning C4701: potentially uninitialized local variable 'dragX' used
c:\wz\trunk\src\action.c(1344) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\action.c(2514) : warning C4706: assignment within conditional expression
Compiling...
mapdisplay.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
mission.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
multiint.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
c:\wz\trunk\src\multiint.c(1149) : warning C4090: 'function' : different 'const' qualifiers
multijoin.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
multilimit.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
multimenu.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
power.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
c:\wz\trunk\src\power.c(122) : warning C4305: '+=' : truncation from 'double' to 'float'
radar.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
research.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
scores.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
scriptfuncs.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
c:\wz\trunk\src\scriptfuncs.c(7589) : warning C4245: '=' : conversion from 'int' to 'UWORD', signed/unsigned mismatch
c:\wz\trunk\src\scriptfuncs.c(7621) : warning C4245: '=' : conversion from 'int' to 'UWORD', signed/unsigned mismatch
scripttabs.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
seqdisp.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
structure.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
transporter.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
warcam.c
 *** Warnings 4018,4100,4127,4204,4244,4267,4389 have been squelched. ***
Generating Code...
c:\wz\trunk\src\structure.c(3855) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\structure.c(4425) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\structure.c(4457) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\scriptfuncs.c(5738) : warning C4701: potentially uninitialized local variable 'psStat' used
c:\wz\trunk\src\multimenu.c(399) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\multimenu.c(403) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\multimenu.c(562) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\multimenu.c(590) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\multiint.c(375) : warning C4701: potentially uninitialized local variable 'plCliffL' used
c:\wz\trunk\src\multiint.c(375) : warning C4701: potentially uninitialized local variable 'plCliffH' used
c:\wz\trunk\src\multiint.c(380) : warning C4701: potentially uninitialized local variable 'plWater' used
c:\wz\trunk\src\multiint.c(385) : warning C4701: potentially uninitialized local variable 'plRoadL' used
c:\wz\trunk\src\multiint.c(385) : warning C4701: potentially uninitialized local variable 'plRoadH' used
c:\wz\trunk\src\multiint.c(390) : warning C4701: potentially uninitialized local variable 'plGroundL' used
c:\wz\trunk\src\multiint.c(390) : warning C4701: potentially uninitialized local variable 'plGroundH' used
c:\wz\trunk\src\multiint.c(2952) : warning C4700: uninitialized local variable 'player_id' used
c:\wz\trunk\src\mission.c(755) : warning C4706: assignment within conditional expression
c:\wz\trunk\src\mission.c(789) : warning C4706: assignment within conditional expression
Linking...
design.obj : error LNK2001: unresolved external symbol _addStoredTemplate
design.obj : error LNK2001: unresolved external symbol _removeStoredTemplate
design.obj : error LNK2001: unresolved external symbol _isStoredTemplate
init.obj : error LNK2001: unresolved external symbol _initStoredTemplates
init.obj : error LNK2001: unresolved external symbol _shutdownStoredTemplates
research.obj : error LNK2001: unresolved external symbol _designStoredTemplates
C:\WZ\Trunk\win32\Debug\Warzone2100-Dbg.exe : fatal error LNK1120: 6 unresolved externals
Build log was saved at "file://c:\WZ\Trunk\win32\Debug\BuildLog.htm"
Warzone2100 - 7 error(s), 57 warning(s)
====###### Build: 0 succeeded, 1 failed, 12 up-to-date, 0 skipped====

Any help?

@wzdev-ci
Copy link
Contributor Author

EvilGuru commented


Sure.

I've only updated the automake Makefiles, which are those used by GNU/Linux and friends. Mac OS X (Xcode) and Windows (MSVC/MinGW) do things slightly differently and hence will need to be updated.

While I can help with the Xcode project I am unsure how to add files to the build system used by MinGW.

@wzdev-ci
Copy link
Contributor Author

KukY commented


Ok...

So, what are my chances that I will be able to compile it under MSVC and test it anytime soon? :D

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jun 26, 2010

EvilGuru commented


Replying to Warzone2100/old-trac-import#1946 (comment:6):

So, what are my chances that I will be able to compile it under MSVC and test it anytime soon? :D
Near to 100%. Just open up win32/Warzone2100.vcproj (I believe there is also a vs2k8 project file also) with a text editor and add storedtemplates.[ch].

The project files for Visual Studio are just XML and reasonably easy to grok (look how existing files are defined, copy + paste, change the file name).

@wzdev-ci
Copy link
Contributor Author

KukY commented


Ok, I'll try it.

@wzdev-ci
Copy link
Contributor Author

Per changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

Per changed resolution from `` to fixed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Aug 4, 2012

Per Inge Mathisen commented


Implement stored templates. Button graphics is a placeholder for now. Loosely based
on original patch by EvilGuru. Closes #1946.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant