New Dawn
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Latest topics
» The good, the bad, and the ugly
Reading Building data from file EmptySun Jun 20, 2010 7:45 pm by Admin

» Events are happing
Reading Building data from file EmptyWed Apr 14, 2010 11:29 pm by Admin

» Progress! . . .
Reading Building data from file EmptyFri Apr 09, 2010 5:10 pm by Admin

» Soulmen(jordan)
Reading Building data from file EmptyWed Feb 24, 2010 7:56 pm by soulmen

» Basic starting blocks
Reading Building data from file EmptyWed Feb 24, 2010 7:41 pm by Admin

» Okay so uni isn’t so demanding as I first thought.
Reading Building data from file EmptyMon Oct 26, 2009 4:39 pm by Admin

» MP Architecture: Client/Server or Peer-2-Peer?
Reading Building data from file EmptySun Oct 04, 2009 2:34 pm by Daemn

» What I am working on at the Moment READ!
Reading Building data from file EmptyFri Sep 25, 2009 5:15 pm by Admin

» Development Framework available at SourceForge
Reading Building data from file EmptyTue Sep 22, 2009 9:46 am by Hairein

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Reading Building data from file

Go down

Reading Building data from file Empty Reading Building data from file

Post by Admin Wed Sep 02, 2009 9:46 am

Okay, as far as I'm concerned this one's quite complecated.

We will need 1 extra class, NationClass. As well as,

A file to store data for the nations

name, id, txtfile name, etc
a quick nation file, e.g "Sparta.txt"

the rest is as follows, p.s you will also need a buildinglist file and individuaal txt files for each building,only one is needed

As everyone else is doing something, i'd like our new programmer to be doing this, sujay. Smile
basic Building File
[BEGIN]

Name LumberCamp_1

InitalCost Wood 100 Marble 240 Bronze 0 Gold 24
CostMulti 106
MaxLevel 20

BuildPointsNeeded 10
BuildNeededMulti 125
BuildPointsGenerated 0
BuildGeneratedMulti 0

Graphicsfile "lumbercamp.jpeg"

[END]

the file to read, depends on the building "clicked" on. For now we shall just use an ID ---->> very draft.

class NationClass : Entity
{
private:
int snationid;
char filename;

public:
void makenation (char* name, int nationid, char* filename )
{
// whatever goes here
setNationID(nationid);
}

setNationID(int amount)
{
snationid = amount;
}
};

-> go into Nation file, will need to use (playerClass for this) decide what building corrasponds to the ID. (This is to be stored under the [BuildingNumbers]
once know what building are working with, usee the string to find the file in file, "buildingslist.txt" if the building name is in this file,
then combine filename with extention. "LumberCamp_1"+".txt". Therefore tell the program to find the file "LumberCamp_1.txt" for reading.

somehow we would need to tell the program that wood = 100, marble = 240, bronze = 0, gold = 24;
we could use , find_first_of("InitalCost");

Resources current_players_resources (wood,marble,bronze,gold)

-> same concept as above. ^^
BuildingClass build (cost, a,b,c,d,e,f,g)

Deduce building requirments

use -> ID go into NationFile, find the

shove this in a loop, repeat for i = 1, for i < the number after the buildingID under [BuildingsReq]
req[i].setReq ( building, level )

want it to create a set of data as such,take this data for the blacksmith 6 1 2 0 5 5 1

req[1].setreq(2,0);
req[2].setreq(5,1);


Building Requirments for buildings are deduced from the NationClass.

In a NationFile
E.g titled "Sparta.nat"

[BuildingNumbers]
TownHall_1 0
LumberCamp_1 1
MarbleMine_1 2
BronzeMine_1 3
GoldMine_1 4
Blacksmith_1 5
Barracks_1 6
Stables_1 7

[BuildingsReq]
5 1 1 0 3 // Blacksmith lvl 1, requires Townhall lvl 3
6 1 2 0 5 5 1 //Barracks lvl 1, requires Townhall lvl 5 & Blacksmith lvl 1

7 1 2 5 4 6 3 //Stables lvl 1, requires Blacksmith lvl 4 & Barracks lvl 3

Admin
Admin
Admin

Posts : 105
Points : 5632
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum