Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Call To Power II > CtP2-Source Code Project > DESIGN: A couple of map good functions for SLIC
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
CivGroups
CTP2 Source Code Project (59): Not a Member - Join

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
MrBaggins is offline MrBaggins
King

May 1999
time: 05:33
  Old Post 31-12-2003 20:52
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
DESIGN: A couple of map good functions for SLIC Support Apolyton, buy Civilization: The Boardgame

Haven't packaged yet, but has been compiled, and seems to work just fine.

In slicfunc.h (prior to last #endif)

code:
// New good slic function prototypes. See cpp for details SLICFUNC(SFR_VOID, PlantSpecificGood); SLICFUNC(SFR_VOID, RemoveGood);


In SlicEngine.cpp (at the end of AddBuiltinFunctions() )

code:
#if !defined(ACTIVISION_ORIGINAL) // new good functions by MrBaggins m_functionHash->Add(new Slic_PlantSpecificGood); m_functionHash->Add(new Slic_RemoveGood); #endif


In SlicFunc.cpp (at the end)

code:
//---------------------------------------------------------------------------- // // Authored : MrBaggins // // Name : Slic_PlantSpecificGood // // Description: Rather than planting a random good, as per the standard SLIC // function, this allows the specification of which good subtype // to plant // // Parameters : SlicArg 0: location // SlicArg 1: int // // Globals : g_theWorld : World gamestate functionality // g_tiledMap : UI update functionality // // Returns : SFN_ERROR : execution result // // Remark(s) : Allows for the specification of a good sub // a range of 0 (no good), or 1-4 (the specific good subtype, // as defined in ctp2_data\default\gamedata\goods.txt// //---------------------------------------------------------------------------- SFN_ERROR Slic_PlantSpecificGood::Call(SlicArgList *args) { #if !defined(ACTIVISION_ORIGINAL) if(args->m_numArgs != 2) return SFN_ERROR_NUM_ARGS; MapPoint pos; if(!args->GetPos(0, pos)) return SFN_ERROR_TYPE_ARGS; sint32 goodsubtype; if(!args->GetInt(1, goodsubtype)) return SFN_ERROR_TYPE_ARGS; if(goodsubtype<0 || goodsubtype>4) return SFN_ERROR_OUT_OF_RANGE; g_theWorld->SetGood(pos.x, pos.y, goodsubtype); g_tiledMap->PostProcessTile(pos, g_theWorld->GetTileInfo(pos)); g_tiledMap->TileChanged(pos); g_tiledMap->RedrawTile(&pos); #endif return SFN_ERROR_OK; } //---------------------------------------------------------------------------- // // Authored : MrBaggins // // Name : Slic_RemoveGood // // Description: New complimentary function to PlantGood // // Parameters : SlicArg 0: location // // Globals : g_theWorld : World gamestate functionality // g_tiledMap : UI update functionality // // Returns : SFN_ERROR : execution result // //---------------------------------------------------------------------------- SFN_ERROR Slic_RemoveGood::Call(SlicArgList *args) { #if !defined(ACTIVISION_ORIGINAL) if(args->m_numArgs != 1) return SFN_ERROR_NUM_ARGS; MapPoint pos; if(!args->GetPos(0, pos)) return SFN_ERROR_TYPE_ARGS; g_theWorld->SetGood(pos.x, pos.y, 0); // plants a good of subtype 0 AKA no good, at location x,y. g_tiledMap->PostProcessTile(pos, g_theWorld->GetTileInfo(pos)); g_tiledMap->TileChanged(pos); g_tiledMap->RedrawTile(&pos); #endif return SFN_ERROR_OK; }

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:33
Post  Old Post 01-01-2004 21:48 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton buy from Amazon

One note to the #if and #endif statements. These are precompiler derectives so first it is searched for such derectives, if the statement behind the #if is true the following code until an #endif or #else is left in otherwise it is removed. So you shouldn't place the precompiler derectives inside the functions if you added them entirely, but outside, and that should also be done for the other functions and code I added to the file, unfortunatly I didn't know it better at that time and therefore huge blocks of code are outside of these #if #else #endif blocks.

-Martin

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:33.
Apolyton Time is 00:33.
    top of page
Rate This Thread:
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0310 seconds (84.27% PHP - 15.73% MySQL) with 36 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net