Commit Graph
28 Commits
Author SHA1 Message Date
ac-stef da426c93cf stream interface for uchar vectors
* read- and write-access through regular stream functions
* automatic cleanup
2015-09-07 14:53:55 +02:00
ac-stef 826499c12d enable gcc to check arguments of printf-like functions
Check printf-like functions like conoutf, if format strings and argument
lists match.

This commit also fixes a lot of code parts that actually had mismatching
argument lists - or did things, that this check does not like.

numtime() was rewritten in an ugly but very portable fashion (it's
recommended to stay away from "long long" format entries, because errors
usually only come up at runtime).

(some code was copied from sauer)
2015-08-02 19:40:41 +02:00
ac-stef fb3a04d5da add access to location where findfile() found the file
"findfilelocation" contains the location, where the file was found.
Not a nice solution, but nice enough :)

Note: if the location is FFL_WORKDIR, the existence of the file has not
actually been checked yet.
2015-06-05 16:00:02 +02:00
ac-stef 2349c7e508 fix ".." handling and add more strict path filtering
Enable path() to collapse multiple levels of "../" (sauer backport). Clean
up multiple consecutive path delimiters. Remove feature to concat several
paths with '&' delimiters (unused in AC).

Filter paths in findfile() to disallow access to files below the AC root
directory.

This commit fixes the problem which prevented downloaded map models from
using stock textures.
2015-05-27 15:47:04 +02:00
ac-stef 03f974b2bc additional text attributes for mapmodels
This adds a means to store additional attributes for mapmodels, including
a caching mechanism, so the mapmodels don't have to be loaded to access
the information. The goal is, to provide fully automatic mapmodel menus
for map editing who also add information about downloaded mapmodels.

Model attributes are extracted everytime, when a model is loaded. At game
end, all available data is written to config/mapmodelattributes.cfg and
restored at next startup. On release, a file with all (but only) official
models should be included. Since autodownloaded models are usually "loaded"
after download, those are automatically added to the database. If someone
adds models manually to the directories (media pack, w/e), the command
"loadallmapmodels" can be used to try to find all available models. The
only way to delete something from the database, is to delete the file
config/mapmodelattributes.cfg when the game is closed.

The current list of attributes is:

keywords
  List of one or more menu topics to list the model under. Check
  config/menus_edit.cfg for available keywords. Unknown keywords will
  be listed separately.

desc
  Short name or description of the model. Will be used as menu entry.

usage
  Important information for how to use that specific model.

author
  Who created the mapmodel. If it's a derivative of another model, state
  the author of the mod (refer to the original author under "license", if
  you like). Always use the exact same spelling for the same author, to
  allow menus to automatically group models by author.

license
  Free-text attribute for license info or info about additional
  contributors (or original authors for derivated works).

distribution
  One of "official", "autodownload" or "manual". Other values default to
  "manual". This is used to determine, if a map contains only original
  media or media that can be download automatically.

version
  Single numerical value to separate older from newer versions. Defaults
  to zero. Higher numbers mean "newer". Maybe someone manages to implement
  a versioning system for custom media in the future...

New commands:

mdlattribute <attr> <value>
  To be used in model config files. Adds a value for a specified
  attribute to the model.

mapmodelregister <modelpath> <attr1> <attr2> ...
  Adds values for all attributes to a specific mapmodel. This is used to
  restore the cached values from config/mapmodelattributes.cfg during
  game start. Does not actually verify of load the model.

mapmodelattributes <modelpath> <attr>
  Returns the value of a specific attribute of a mapmodel. If modelpath
  is a number, it is interpreted as index for the list of models in the
  current map config. If no attribute name is specified, all attributes
  are printed to the console instead.

getmapmodelattributes <list of attribute names>
  Returns a table of all known mapmodels. Each model is listed with the
  modelpath and the values for the requested attributes. To be used
  instead of a fixed table in menu_edit.cfg. In addition to attribute
  names, the function also allows the keywords "explodekeywords" and
  "sortby:" as arguments. If "explodekeywords" is given, all mapmodels
  with more than one keyword are listed multiple times, once for each
  keyword. If an attribute name is preceeded by "sortby:" the list will
  be sorted by this table column. If "sortby:" is used several times,
  this first sort will have highest priority. The list is always sorted
  by path by default.

  example:
    getmapmodelattributes sortby: author sortby: desc explodekeywords

loadallmapmodels
  Tries to load mapmodels from /all/ paths below packages/models/mapmodels.
  Will throw a lot of error messages, because not all directories contain
  models to load. This command can be used to build or rebuild the
  complete list of all available mapmodels. It is only necessary, if models
  are added manually to the directories, since every mapmodel gets added
  to the list when it is loaded - which takes care of all automatically
  downloaded models.

DOCREF mdlattribute mapmodelregister mapmodelattributes
DOCREF getmapmodelattributes loadallmapmodels
2015-05-17 00:24:38 +02:00
ac-stef 453c79ee6d minor fixes to get master to compile again 2015-04-06 10:37:13 +02:00
ac-stef 85f7a22e64 flush logfile in case of crash 2015-03-25 02:56:49 +01:00
ac-stef e369f3e415 move backup() 2015-02-08 17:39:15 +01:00
ac-stef 6ede08d011 keep the last five versions of saved.cfg and init.cfg
Renames the existing saved.cfg to saved-old-1.cfg (and an existing -1 to
-2, and so on) before the new saved.cfg is written.

This should help in cases where players mess up their config, because the
config is deleted with a five-game-starts delay.
2014-11-02 23:17:00 +01:00
ac-stef 128e615ccc fix directory search order
also clarify some log output
(thx grenadier)
2014-09-21 21:19:03 +02:00
ac-stef d81c884cea removed now redundant code
and substituted "copy file and delete original" with "move file"
2014-05-19 18:48:54 +02:00
ac-stef 2768012579 fix: allow creating directories without homedir
With this fix, ac can also create directories relative to the working
directory. This fixes xmaps for users without homedir set.
2014-05-19 17:01:08 +02:00
ac-stef eb60302e67 cleanup
- fix possible crash in conc (but it's still an ugly hack)
- fix noob usage of strcmp
- flag some memory leaks (it would be nice, if the author(s) would clean
   up the mess himself)
- fix crash in substr
- whitespace cleanup

there are plenty more memory leaks in command.cpp - for example, every
goto in cubescript does not clean up anything
2014-05-14 22:54:37 +02:00
Lucas GAUTHERON 71f7dc9588 debugging variables set as constants
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7524 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2013-08-02 12:20:44 +00:00
Lucas GAUTHERON a7a1e46bcc merged branch
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7382 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2013-03-22 19:49:21 +00:00
sireus cfccba92d1 fixed C++11-related warnings
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6853 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-07-07 22:35:30 +00:00
sireus 5137a271b2 statvfs is posix-standardized
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6779 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-04-01 18:31:21 +00:00
sireus 20ca7d0b45 use the types that are actually standadized to 64 bit
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6778 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-04-01 16:51:43 +00:00
sireus 2323874b57 fixed FS free space check false positives (integer overrun)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6401 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-05-02 13:39:46 +00:00
Lee Salzman 8e7e4b87bf gzstream SEEK_END support
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6089 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-02-11 08:57:42 +00:00
Lee Salzman 3da93e5194 FindClose fix
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5949 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2010-12-06 21:33:44 +00:00
flowtron e4bc0ea4c6 informative edittoggle
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5687 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2010-09-11 14:38:51 +00:00
Rafael Barreto bc2ab28dcd fix wrong calculation
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5666 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2010-08-20 19:12:37 +00:00
Rafael Barreto 0067b905b2 removing debug members...
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5659 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2010-08-19 23:00:30 +00:00
Rafael Barreto 01c24f0228 checking if file system has space to write (linux only), reverting the protocol to make it compatible with 1.1.0.1, tagging AUTH as WiP, tunning the player/bot collision... preparing to release patch
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5656 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2010-08-19 19:46:56 +00:00
Lee Salzman 8f7813d754 small gzstream cleanup
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4783 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2010-03-07 01:37:13 +00:00
Lee Salzman b28974415c VC warning fixes
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4718 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2009-11-08 01:08:53 +00:00
Lee Salzman 9256ee374b support for loading from zip files
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4717 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2009-11-08 00:53:19 +00:00